From dbd7e055e5c5391993bf8af7813c25e4ad6160db Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Tue, 19 Nov 2019 11:57:23 +0000 Subject: [PATCH] Reconfigure audio sink when PCM encoding changes Note: - Fixing this uncovers another bug in how audio processor draining works, so the test playlist still doesn't play correctly after this change. - Once we reconfigure the audio sink based on the ExoPlayer Format rather than the codec MediaFormat in a later change, this change can be reverted. Issue: #6601 PiperOrigin-RevId: 281264149 --- RELEASENOTES.md | 2 ++ .../android/exoplayer2/audio/MediaCodecAudioRenderer.java | 1 + 2 files changed, 3 insertions(+) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 3882aaadb5..1442c5b643 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -16,6 +16,8 @@ * Use `ExoMediaDrm.Provider` in `OfflineLicenseHelper` to avoid `ExoMediaDrm` leaks ([#4721](https://github.com/google/ExoPlayer/issues/4721)). * Fix byte order of HDR10+ static metadata to match CTA-861.3. +* Reconfigure audio sink when PCM encoding changes + ([#6601](https://github.com/google/ExoPlayer/issues/6601)). * Make `MediaSourceEventListener.LoadEventInfo` a top-level class. ### 2.11.0 (not yet released) ### diff --git a/library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java b/library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java index 873219d31d..a6a8b03448 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/audio/MediaCodecAudioRenderer.java @@ -512,6 +512,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media return Util.areEqual(oldFormat.sampleMimeType, newFormat.sampleMimeType) && oldFormat.channelCount == newFormat.channelCount && oldFormat.sampleRate == newFormat.sampleRate + && oldFormat.pcmEncoding == newFormat.pcmEncoding && oldFormat.initializationDataEquals(newFormat) && !MimeTypes.AUDIO_OPUS.equals(oldFormat.sampleMimeType); }