Skip to content

Commit 8d58577

Browse files
committed
Do not flush eac3(joc) decoder on reuse
eac3(joc) decoders do not need to be flushed to be reused for the next compatible track. This change allows for gapless playback on devices with Dolby decoders that require internal re-initialization on flush.
1 parent cf0d9d2 commit 8d58577

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

libraries/exoplayer/src/main/java/androidx/media3/exoplayer/mediacodec/MediaCodecInfo.java

+11
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,17 @@ public DecoderReuseEvaluation canReuseCodec(Format oldFormat, Format newFormat)
494494
}
495495
}
496496

497+
// For eac3 and eac3-joc formats, adaptation is possible without reconfiguration or flushing.
498+
if (discardReasons == 0 && (MimeTypes.AUDIO_E_AC3_JOC.equals(mimeType)
499+
|| MimeTypes.AUDIO_E_AC3.equals(mimeType))) {
500+
return new DecoderReuseEvaluation(
501+
name,
502+
oldFormat,
503+
newFormat,
504+
REUSE_RESULT_YES_WITHOUT_RECONFIGURATION,
505+
/* discardReasons= */ 0);
506+
}
507+
497508
if (!oldFormat.initializationDataEquals(newFormat)) {
498509
discardReasons |= DISCARD_REASON_INITIALIZATION_DATA_CHANGED;
499510
}

0 commit comments

Comments
 (0)