Skip to content

Commit d0e7214

Browse files
committedMay 6, 2024·
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 13a3aa7 commit d0e7214

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
@@ -479,6 +479,17 @@ public DecoderReuseEvaluation canReuseCodec(Format oldFormat, Format newFormat)
479479
}
480480
}
481481

482+
// For eac3 and eac3-joc formats, adaptation is possible without reconfiguration or flushing.
483+
if (discardReasons == 0 && (MimeTypes.AUDIO_E_AC3_JOC.equals(mimeType)
484+
|| MimeTypes.AUDIO_E_AC3.equals(mimeType))) {
485+
return new DecoderReuseEvaluation(
486+
name,
487+
oldFormat,
488+
newFormat,
489+
REUSE_RESULT_YES_WITHOUT_RECONFIGURATION,
490+
/* discardReasons= */ 0);
491+
}
492+
482493
if (!oldFormat.initializationDataEquals(newFormat)) {
483494
discardReasons |= DISCARD_REASON_INITIALIZATION_DATA_CHANGED;
484495
}

0 commit comments

Comments
 (0)