mirror of
https://github.com/samsonjs/media.git
synced 2026-03-27 09:45:47 +00:00
Handle dead object error during writing buffer to AudioTrack
PiperOrigin-RevId: 514989776
This commit is contained in:
parent
67d15ec575
commit
e052b63514
2 changed files with 9 additions and 2 deletions
|
|
@ -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…
Reference in a new issue