mirror of
https://github.com/samsonjs/media.git
synced 2026-04-08 11:45:51 +00:00
Allow renderer retry for audio track offload initialization failure
If render error occurs due to AudioTrack initialization failure in offload mode, then ExoPlayer should allow retry as subsequent attempt will be with DefaultAudioSink disabling offload. PiperOrigin-RevId: 609304897
This commit is contained in:
parent
d952a06214
commit
9046f2edb6
4 changed files with 15 additions and 1 deletions
|
|
@ -17,6 +17,8 @@
|
|||
* Track Selection:
|
||||
* Extractors:
|
||||
* Audio:
|
||||
* Allow renderer recovery by disabling offload if audio track fails to
|
||||
initialize in offload mode.
|
||||
* Video:
|
||||
* Text:
|
||||
* Metadata:
|
||||
|
|
|
|||
|
|
@ -224,6 +224,9 @@ public class PlaybackException extends Exception implements Bundleable {
|
|||
/** Caused by an AudioTrack write operation failure in offload mode. */
|
||||
@UnstableApi public static final int ERROR_CODE_AUDIO_TRACK_OFFLOAD_WRITE_FAILED = 5003;
|
||||
|
||||
/** Caused by an AudioTrack write operation failure in offload mode. */
|
||||
@UnstableApi public static final int ERROR_CODE_AUDIO_TRACK_OFFLOAD_INIT_FAILED = 5004;
|
||||
|
||||
// DRM errors (6xxx).
|
||||
|
||||
/** Caused by an unspecified error related to DRM protection. */
|
||||
|
|
@ -330,6 +333,8 @@ public class PlaybackException extends Exception implements Bundleable {
|
|||
return "ERROR_CODE_AUDIO_TRACK_WRITE_FAILED";
|
||||
case ERROR_CODE_AUDIO_TRACK_OFFLOAD_WRITE_FAILED:
|
||||
return "ERROR_CODE_AUDIO_TRACK_OFFLOAD_WRITE_FAILED";
|
||||
case ERROR_CODE_AUDIO_TRACK_OFFLOAD_INIT_FAILED:
|
||||
return "ERROR_CODE_AUDIO_TRACK_OFFLOAD_INIT_FAILED";
|
||||
case ERROR_CODE_DRM_UNSPECIFIED:
|
||||
return "ERROR_CODE_DRM_UNSPECIFIED";
|
||||
case ERROR_CODE_DRM_SCHEME_UNSUPPORTED:
|
||||
|
|
|
|||
|
|
@ -622,6 +622,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||
}
|
||||
if (e.isRecoverable
|
||||
&& (pendingRecoverableRendererError == null
|
||||
|| e.errorCode == PlaybackException.ERROR_CODE_AUDIO_TRACK_OFFLOAD_INIT_FAILED
|
||||
|| e.errorCode == PlaybackException.ERROR_CODE_AUDIO_TRACK_OFFLOAD_WRITE_FAILED)) {
|
||||
// If pendingRecoverableRendererError != null and error was
|
||||
// ERROR_CODE_AUDIO_TRACK_OFFLOAD_WRITE_FAILED then upon retry, renderer will attempt with
|
||||
|
|
|
|||
|
|
@ -743,7 +743,13 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
|||
fullyConsumed = audioSink.handleBuffer(buffer, bufferPresentationTimeUs, sampleCount);
|
||||
} catch (InitializationException e) {
|
||||
throw createRendererException(
|
||||
e, inputFormat, e.isRecoverable, PlaybackException.ERROR_CODE_AUDIO_TRACK_INIT_FAILED);
|
||||
e,
|
||||
inputFormat,
|
||||
e.isRecoverable,
|
||||
isBypassEnabled()
|
||||
&& getConfiguration().offloadModePreferred != AudioSink.OFFLOAD_MODE_DISABLED
|
||||
? PlaybackException.ERROR_CODE_AUDIO_TRACK_OFFLOAD_INIT_FAILED
|
||||
: PlaybackException.ERROR_CODE_AUDIO_TRACK_INIT_FAILED);
|
||||
} catch (WriteException e) {
|
||||
throw createRendererException(
|
||||
e,
|
||||
|
|
|
|||
Loading…
Reference in a new issue