Handle dead object error during writing buffer to AudioTrack
PiperOrigin-RevId: 514989776
This commit is contained in:
parent
67d15ec575
commit
e052b63514
@ -912,7 +912,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void attemptRendererErrorRecovery() throws ExoPlaybackException {
|
private void attemptRendererErrorRecovery() throws ExoPlaybackException {
|
||||||
seekToCurrentPosition(/* sendDiscontinuity= */ true);
|
reselectTracksInternalAndSeek();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePlaybackPositions() throws ExoPlaybackException {
|
private void updatePlaybackPositions() throws ExoPlaybackException {
|
||||||
@ -1696,6 +1696,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
enabledRendererCount--;
|
enabledRendererCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void reselectTracksInternalAndSeek() throws ExoPlaybackException {
|
||||||
|
reselectTracksInternal();
|
||||||
|
seekToCurrentPosition(/* sendDiscontinuity= */ true);
|
||||||
|
}
|
||||||
|
|
||||||
private void reselectTracksInternal() throws ExoPlaybackException {
|
private void reselectTracksInternal() throws ExoPlaybackException {
|
||||||
float playbackSpeed = mediaClock.getPlaybackParameters().speed;
|
float playbackSpeed = mediaClock.getPlaybackParameters().speed;
|
||||||
// Reselect tracks on each period in turn, until the selection changes.
|
// Reselect tracks on each period in turn, until the selection changes.
|
||||||
|
@ -466,7 +466,6 @@ public final class DefaultAudioSink implements AudioSink {
|
|||||||
@GuardedBy("releaseExecutorLock")
|
@GuardedBy("releaseExecutorLock")
|
||||||
private static int pendingReleaseCount;
|
private static int pendingReleaseCount;
|
||||||
|
|
||||||
private final AudioCapabilities audioCapabilities;
|
|
||||||
private final androidx.media3.common.audio.AudioProcessorChain audioProcessorChain;
|
private final androidx.media3.common.audio.AudioProcessorChain audioProcessorChain;
|
||||||
private final boolean enableFloatOutput;
|
private final boolean enableFloatOutput;
|
||||||
private final ChannelMappingAudioProcessor channelMappingAudioProcessor;
|
private final ChannelMappingAudioProcessor channelMappingAudioProcessor;
|
||||||
@ -491,6 +490,7 @@ public final class DefaultAudioSink implements AudioSink {
|
|||||||
private @MonotonicNonNull Configuration configuration;
|
private @MonotonicNonNull Configuration configuration;
|
||||||
private @MonotonicNonNull AudioProcessingPipeline audioProcessingPipeline;
|
private @MonotonicNonNull AudioProcessingPipeline audioProcessingPipeline;
|
||||||
@Nullable private AudioTrack audioTrack;
|
@Nullable private AudioTrack audioTrack;
|
||||||
|
private AudioCapabilities audioCapabilities;
|
||||||
|
|
||||||
private AudioAttributes audioAttributes;
|
private AudioAttributes audioAttributes;
|
||||||
@Nullable private MediaPositionParameters afterDrainParameters;
|
@Nullable private MediaPositionParameters afterDrainParameters;
|
||||||
@ -1141,6 +1141,8 @@ public final class DefaultAudioSink implements AudioSink {
|
|||||||
listener.onAudioSinkError(e);
|
listener.onAudioSinkError(e);
|
||||||
}
|
}
|
||||||
if (e.isRecoverable) {
|
if (e.isRecoverable) {
|
||||||
|
// Change to the audio capabilities supported by all the devices during the error recovery.
|
||||||
|
audioCapabilities = DEFAULT_AUDIO_CAPABILITIES;
|
||||||
throw e; // Do not delay the exception if it can be recovered at higher level.
|
throw e; // Do not delay the exception if it can be recovered at higher level.
|
||||||
}
|
}
|
||||||
writeExceptionPendingExceptionHolder.throwExceptionIfDeadlineIsReached(e);
|
writeExceptionPendingExceptionHolder.throwExceptionIfDeadlineIsReached(e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user