mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Remove experimental keepAudioTrackOnSeek.
PiperOrigin-RevId: 570966027 (cherry picked from commit 068d420ba2d27847c5c581d851ff6a5e1ec45611)
This commit is contained in:
parent
21c714d8d4
commit
fbb64e2db2
@ -614,12 +614,6 @@ public interface AudioSink {
|
||||
*/
|
||||
void flush();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #flush()}.
|
||||
*/
|
||||
@Deprecated
|
||||
void experimentalFlushWithoutAudioTrackRelease();
|
||||
|
||||
/** Resets the sink, releasing any resources that it currently holds. */
|
||||
void reset();
|
||||
|
||||
|
@ -145,7 +145,6 @@ public abstract class DecoderAudioRenderer<
|
||||
private int encoderDelay;
|
||||
private int encoderPadding;
|
||||
|
||||
private boolean experimentalKeepAudioTrackOnSeek;
|
||||
private boolean firstStreamSampleRead;
|
||||
|
||||
@Nullable private T decoder;
|
||||
@ -229,14 +228,6 @@ public abstract class DecoderAudioRenderer<
|
||||
pendingOutputStreamOffsetsUs = new long[MAX_PENDING_OUTPUT_STREAM_OFFSET_COUNT];
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Experimental method being removed.
|
||||
*/
|
||||
@Deprecated
|
||||
public void experimentalSetEnableKeepAudioTrackOnSeek(boolean enableKeepAudioTrackOnSeek) {
|
||||
this.experimentalKeepAudioTrackOnSeek = enableKeepAudioTrackOnSeek;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public MediaClock getMediaClock() {
|
||||
@ -610,11 +601,7 @@ public abstract class DecoderAudioRenderer<
|
||||
|
||||
@Override
|
||||
protected void onPositionReset(long positionUs, boolean joining) throws ExoPlaybackException {
|
||||
if (experimentalKeepAudioTrackOnSeek) {
|
||||
audioSink.experimentalFlushWithoutAudioTrackRelease();
|
||||
} else {
|
||||
audioSink.flush();
|
||||
}
|
||||
audioSink.flush();
|
||||
|
||||
currentPositionUs = positionUs;
|
||||
allowPositionDiscontinuity = true;
|
||||
|
@ -1444,39 +1444,6 @@ public final class DefaultAudioSink implements AudioSink {
|
||||
initializationExceptionPendingExceptionHolder.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void experimentalFlushWithoutAudioTrackRelease() {
|
||||
// Prior to SDK 25, AudioTrack flush does not work as intended, and therefore it must be
|
||||
// released and reinitialized. (Internal reference: b/143500232)
|
||||
if (Util.SDK_INT < 25) {
|
||||
flush();
|
||||
return;
|
||||
}
|
||||
|
||||
writeExceptionPendingExceptionHolder.clear();
|
||||
initializationExceptionPendingExceptionHolder.clear();
|
||||
|
||||
if (!isAudioTrackInitialized()) {
|
||||
return;
|
||||
}
|
||||
|
||||
resetSinkStateForFlush();
|
||||
if (audioTrackPositionTracker.isPlaying()) {
|
||||
audioTrack.pause();
|
||||
}
|
||||
audioTrack.flush();
|
||||
|
||||
audioTrackPositionTracker.reset();
|
||||
audioTrackPositionTracker.setAudioTrack(
|
||||
audioTrack,
|
||||
/* isPassthrough= */ configuration.outputMode == OUTPUT_MODE_PASSTHROUGH,
|
||||
configuration.outputEncoding,
|
||||
configuration.outputPcmFrameSize,
|
||||
configuration.bufferSize);
|
||||
|
||||
startMediaTimeUsNeedsInit = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
flush();
|
||||
|
@ -199,11 +199,6 @@ public class ForwardingAudioSink implements AudioSink {
|
||||
sink.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void experimentalFlushWithoutAudioTrackRelease() {
|
||||
sink.experimentalFlushWithoutAudioTrackRelease();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
sink.reset();
|
||||
|
@ -117,8 +117,6 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||
private boolean allowPositionDiscontinuity;
|
||||
private boolean audioSinkNeedsReset;
|
||||
|
||||
private boolean experimentalKeepAudioTrackOnSeek;
|
||||
|
||||
@Nullable private WakeupListener wakeupListener;
|
||||
|
||||
/**
|
||||
@ -273,14 +271,6 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||
return TAG;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Experimental method being removed.
|
||||
*/
|
||||
@Deprecated
|
||||
public void experimentalSetEnableKeepAudioTrackOnSeek(boolean enableKeepAudioTrackOnSeek) {
|
||||
this.experimentalKeepAudioTrackOnSeek = enableKeepAudioTrackOnSeek;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Capabilities int supportsFormat(MediaCodecSelector mediaCodecSelector, Format format)
|
||||
throws DecoderQueryException {
|
||||
@ -620,11 +610,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||
@Override
|
||||
protected void onPositionReset(long positionUs, boolean joining) throws ExoPlaybackException {
|
||||
super.onPositionReset(positionUs, joining);
|
||||
if (experimentalKeepAudioTrackOnSeek) {
|
||||
audioSink.experimentalFlushWithoutAudioTrackRelease();
|
||||
} else {
|
||||
audioSink.flush();
|
||||
}
|
||||
audioSink.flush();
|
||||
|
||||
currentPositionUs = positionUs;
|
||||
allowPositionDiscontinuity = true;
|
||||
|
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package androidx.media3.exoplayer.audio;
|
||||
|
||||
import static androidx.media3.exoplayer.audio.AudioSink.CURRENT_POSITION_NOT_SET;
|
||||
import static androidx.media3.exoplayer.audio.AudioSink.SINK_FORMAT_SUPPORTED_DIRECTLY;
|
||||
import static androidx.media3.exoplayer.audio.AudioSink.SINK_FORMAT_SUPPORTED_WITH_TRANSCODING;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
@ -317,42 +316,6 @@ public final class DefaultAudioSinkTest {
|
||||
assertThat(defaultAudioSink.supportsFormat(aacLcFormat)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlesBufferAfterExperimentalFlush() throws Exception {
|
||||
// This is demonstrating that no Exceptions are thrown as a result of handling a buffer after an
|
||||
// experimental flush.
|
||||
configureDefaultAudioSink(CHANNEL_COUNT_STEREO);
|
||||
assertThat(
|
||||
defaultAudioSink.handleBuffer(
|
||||
createDefaultSilenceBuffer(),
|
||||
/* presentationTimeUs= */ 0,
|
||||
/* encodedAccessUnitCount= */ 1))
|
||||
.isTrue();
|
||||
|
||||
// After the experimental flush we can successfully queue more input.
|
||||
defaultAudioSink.experimentalFlushWithoutAudioTrackRelease();
|
||||
assertThat(
|
||||
defaultAudioSink.handleBuffer(
|
||||
createDefaultSilenceBuffer(),
|
||||
/* presentationTimeUs= */ 5_000,
|
||||
/* encodedAccessUnitCount= */ 1))
|
||||
.isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCurrentPosition_returnsUnset_afterExperimentalFlush() throws Exception {
|
||||
configureDefaultAudioSink(CHANNEL_COUNT_STEREO);
|
||||
assertThat(
|
||||
defaultAudioSink.handleBuffer(
|
||||
createDefaultSilenceBuffer(),
|
||||
/* presentationTimeUs= */ 5 * C.MICROS_PER_SECOND,
|
||||
/* encodedAccessUnitCount= */ 1))
|
||||
.isTrue();
|
||||
defaultAudioSink.experimentalFlushWithoutAudioTrackRelease();
|
||||
assertThat(defaultAudioSink.getCurrentPositionUs(/* sourceEnded= */ false))
|
||||
.isEqualTo(CURRENT_POSITION_NOT_SET);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void configure_throwsConfigurationException_withInvalidInput() {
|
||||
Format format = new Format.Builder().setSampleMimeType(MimeTypes.AUDIO_AAC).build();
|
||||
|
Loading…
x
Reference in New Issue
Block a user