mirror of
https://github.com/androidx/media.git
synced 2025-05-15 11:39:56 +08:00
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 {
|
||||
seekToCurrentPosition(/* sendDiscontinuity= */ true);
|
||||
reselectTracksInternalAndSeek();
|
||||
}
|
||||
|
||||
private void updatePlaybackPositions() throws ExoPlaybackException {
|
||||
@ -1696,6 +1696,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
enabledRendererCount--;
|
||||
}
|
||||
|
||||
private void reselectTracksInternalAndSeek() throws ExoPlaybackException {
|
||||
reselectTracksInternal();
|
||||
seekToCurrentPosition(/* sendDiscontinuity= */ true);
|
||||
}
|
||||
|
||||
private void reselectTracksInternal() throws ExoPlaybackException {
|
||||
float playbackSpeed = mediaClock.getPlaybackParameters().speed;
|
||||
// Reselect tracks on each period in turn, until the selection changes.
|
||||
|
@ -466,7 +466,6 @@ public final class DefaultAudioSink implements AudioSink {
|
||||
@GuardedBy("releaseExecutorLock")
|
||||
private static int pendingReleaseCount;
|
||||
|
||||
private final AudioCapabilities audioCapabilities;
|
||||
private final androidx.media3.common.audio.AudioProcessorChain audioProcessorChain;
|
||||
private final boolean enableFloatOutput;
|
||||
private final ChannelMappingAudioProcessor channelMappingAudioProcessor;
|
||||
@ -491,6 +490,7 @@ public final class DefaultAudioSink implements AudioSink {
|
||||
private @MonotonicNonNull Configuration configuration;
|
||||
private @MonotonicNonNull AudioProcessingPipeline audioProcessingPipeline;
|
||||
@Nullable private AudioTrack audioTrack;
|
||||
private AudioCapabilities audioCapabilities;
|
||||
|
||||
private AudioAttributes audioAttributes;
|
||||
@Nullable private MediaPositionParameters afterDrainParameters;
|
||||
@ -1141,6 +1141,8 @@ public final class DefaultAudioSink implements AudioSink {
|
||||
listener.onAudioSinkError(e);
|
||||
}
|
||||
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.
|
||||
}
|
||||
writeExceptionPendingExceptionHolder.throwExceptionIfDeadlineIsReached(e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user