mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Handle dead object error during writing buffer to AudioTrack
PiperOrigin-RevId: 514989776
This commit is contained in:
parent
87d1c3e624
commit
bb9ac21434
2 changed files with 9 additions and 2 deletions
|
|
@ -904,7 +904,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
}
|
||||
|
||||
private void attemptRendererErrorRecovery() throws ExoPlaybackException {
|
||||
seekToCurrentPosition(/* sendDiscontinuity= */ true);
|
||||
reselectTracksInternalAndSeek();
|
||||
}
|
||||
|
||||
private void updatePlaybackPositions() throws ExoPlaybackException {
|
||||
|
|
@ -1688,6 +1688,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.
|
||||
|
|
|
|||
|
|
@ -453,7 +453,6 @@ public final class DefaultAudioSink implements AudioSink {
|
|||
@GuardedBy("releaseExecutorLock")
|
||||
private static int pendingReleaseCount;
|
||||
|
||||
private final AudioCapabilities audioCapabilities;
|
||||
private final com.google.android.exoplayer2.audio.AudioProcessorChain audioProcessorChain;
|
||||
private final boolean enableFloatOutput;
|
||||
private final ChannelMappingAudioProcessor channelMappingAudioProcessor;
|
||||
|
|
@ -478,6 +477,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;
|
||||
|
|
@ -1128,6 +1128,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