mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Remove dead code from ExoPlayerImpl
now minSdk is 21
PiperOrigin-RevId: 651815091
This commit is contained in:
parent
6a9ff95bf0
commit
d035b745cd
@ -47,9 +47,7 @@ import android.graphics.Rect;
|
|||||||
import android.graphics.SurfaceTexture;
|
import android.graphics.SurfaceTexture;
|
||||||
import android.media.AudioDeviceCallback;
|
import android.media.AudioDeviceCallback;
|
||||||
import android.media.AudioDeviceInfo;
|
import android.media.AudioDeviceInfo;
|
||||||
import android.media.AudioFormat;
|
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.media.AudioTrack;
|
|
||||||
import android.media.MediaFormat;
|
import android.media.MediaFormat;
|
||||||
import android.media.metrics.LogSessionId;
|
import android.media.metrics.LogSessionId;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
@ -202,7 +200,6 @@ import java.util.concurrent.TimeoutException;
|
|||||||
private MediaMetadata playlistMetadata;
|
private MediaMetadata playlistMetadata;
|
||||||
@Nullable private Format videoFormat;
|
@Nullable private Format videoFormat;
|
||||||
@Nullable private Format audioFormat;
|
@Nullable private Format audioFormat;
|
||||||
@Nullable private AudioTrack keepSessionIdAudioTrack;
|
|
||||||
@Nullable private Object videoOutput;
|
@Nullable private Object videoOutput;
|
||||||
@Nullable private Surface ownedSurface;
|
@Nullable private Surface ownedSurface;
|
||||||
@Nullable private SurfaceHolder surfaceHolder;
|
@Nullable private SurfaceHolder surfaceHolder;
|
||||||
@ -387,11 +384,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
playlistMetadata = MediaMetadata.EMPTY;
|
playlistMetadata = MediaMetadata.EMPTY;
|
||||||
staticAndDynamicMediaMetadata = MediaMetadata.EMPTY;
|
staticAndDynamicMediaMetadata = MediaMetadata.EMPTY;
|
||||||
maskingWindowIndex = C.INDEX_UNSET;
|
maskingWindowIndex = C.INDEX_UNSET;
|
||||||
if (Util.SDK_INT < 21) {
|
audioSessionId = Util.generateAudioSessionIdV21(applicationContext);
|
||||||
audioSessionId = initializeKeepSessionIdAudioTrack(C.AUDIO_SESSION_ID_UNSET);
|
|
||||||
} else {
|
|
||||||
audioSessionId = Util.generateAudioSessionIdV21(applicationContext);
|
|
||||||
}
|
|
||||||
currentCueGroup = CueGroup.EMPTY_TIME_ZERO;
|
currentCueGroup = CueGroup.EMPTY_TIME_ZERO;
|
||||||
throwsWhenUsingWrongThread = true;
|
throwsWhenUsingWrongThread = true;
|
||||||
|
|
||||||
@ -1050,10 +1043,6 @@ import java.util.concurrent.TimeoutException;
|
|||||||
+ MediaLibraryInfo.registeredModules()
|
+ MediaLibraryInfo.registeredModules()
|
||||||
+ "]");
|
+ "]");
|
||||||
verifyApplicationThread();
|
verifyApplicationThread();
|
||||||
if (Util.SDK_INT < 21 && keepSessionIdAudioTrack != null) {
|
|
||||||
keepSessionIdAudioTrack.release();
|
|
||||||
keepSessionIdAudioTrack = null;
|
|
||||||
}
|
|
||||||
audioBecomingNoisyManager.setEnabled(false);
|
audioBecomingNoisyManager.setEnabled(false);
|
||||||
if (streamVolumeManager != null) {
|
if (streamVolumeManager != null) {
|
||||||
streamVolumeManager.release();
|
streamVolumeManager.release();
|
||||||
@ -1515,15 +1504,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (audioSessionId == C.AUDIO_SESSION_ID_UNSET) {
|
if (audioSessionId == C.AUDIO_SESSION_ID_UNSET) {
|
||||||
if (Util.SDK_INT < 21) {
|
audioSessionId = Util.generateAudioSessionIdV21(applicationContext);
|
||||||
audioSessionId = initializeKeepSessionIdAudioTrack(C.AUDIO_SESSION_ID_UNSET);
|
|
||||||
} else {
|
|
||||||
audioSessionId = Util.generateAudioSessionIdV21(applicationContext);
|
|
||||||
}
|
|
||||||
} else if (Util.SDK_INT < 21) {
|
|
||||||
// We need to re-initialize keepSessionIdAudioTrack to make sure the session is kept alive for
|
|
||||||
// as long as the player is using it.
|
|
||||||
initializeKeepSessionIdAudioTrack(audioSessionId);
|
|
||||||
}
|
}
|
||||||
this.audioSessionId = audioSessionId;
|
this.audioSessionId = audioSessionId;
|
||||||
sendRendererMessage(TRACK_TYPE_AUDIO, MSG_SET_AUDIO_SESSION_ID, audioSessionId);
|
sendRendererMessage(TRACK_TYPE_AUDIO, MSG_SET_AUDIO_SESSION_ID, audioSessionId);
|
||||||
@ -2913,40 +2894,6 @@ import java.util.concurrent.TimeoutException;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes {@link #keepSessionIdAudioTrack} to keep an audio session ID alive. If the audio
|
|
||||||
* session ID is {@link C#AUDIO_SESSION_ID_UNSET} then a new audio session ID is generated.
|
|
||||||
*
|
|
||||||
* <p>Use of this method is only required on API level 21 and earlier.
|
|
||||||
*
|
|
||||||
* @param audioSessionId The audio session ID, or {@link C#AUDIO_SESSION_ID_UNSET} to generate a
|
|
||||||
* new one.
|
|
||||||
* @return The audio session ID.
|
|
||||||
*/
|
|
||||||
private int initializeKeepSessionIdAudioTrack(int audioSessionId) {
|
|
||||||
if (keepSessionIdAudioTrack != null
|
|
||||||
&& keepSessionIdAudioTrack.getAudioSessionId() != audioSessionId) {
|
|
||||||
keepSessionIdAudioTrack.release();
|
|
||||||
keepSessionIdAudioTrack = null;
|
|
||||||
}
|
|
||||||
if (keepSessionIdAudioTrack == null) {
|
|
||||||
int sampleRate = 4000; // Minimum sample rate supported by the platform.
|
|
||||||
int channelConfig = AudioFormat.CHANNEL_OUT_MONO;
|
|
||||||
@C.PcmEncoding int encoding = C.ENCODING_PCM_16BIT;
|
|
||||||
int bufferSize = 2; // Use a two byte buffer, as it is not actually used for playback.
|
|
||||||
keepSessionIdAudioTrack =
|
|
||||||
new AudioTrack(
|
|
||||||
C.STREAM_TYPE_DEFAULT,
|
|
||||||
sampleRate,
|
|
||||||
channelConfig,
|
|
||||||
encoding,
|
|
||||||
bufferSize,
|
|
||||||
AudioTrack.MODE_STATIC,
|
|
||||||
audioSessionId);
|
|
||||||
}
|
|
||||||
return keepSessionIdAudioTrack.getAudioSessionId();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updatePriorityTaskManagerForIsLoadingChange(boolean isLoading) {
|
private void updatePriorityTaskManagerForIsLoadingChange(boolean isLoading) {
|
||||||
if (priorityTaskManager != null) {
|
if (priorityTaskManager != null) {
|
||||||
if (isLoading && !isPriorityTaskManagerRegistered) {
|
if (isLoading && !isPriorityTaskManagerRegistered) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user