From 4e93db4d0ac0aef2a5f5aa1687d6e2979ea221a4 Mon Sep 17 00:00:00 2001 From: Tolriq Date: Fri, 4 Aug 2023 15:07:59 +0200 Subject: [PATCH] Format passed to audioSink.configure is missing information. AudioSink might require the identifying data and metadata to be able to take decisions. --- .../media3/exoplayer/audio/DecoderAudioRenderer.java | 6 ++++++ .../media3/exoplayer/audio/MediaCodecAudioRenderer.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DecoderAudioRenderer.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DecoderAudioRenderer.java index 5c0bb4b7fc..309c4aa323 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DecoderAudioRenderer.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DecoderAudioRenderer.java @@ -447,6 +447,12 @@ public abstract class DecoderAudioRenderer< .buildUpon() .setEncoderDelay(encoderDelay) .setEncoderPadding(encoderPadding) + .setMetadata(inputFormat.metadata) + .setId(inputFormat.id) + .setLabel(inputFormat.label) + .setLanguage(inputFormat.language) + .setSelectionFlags(inputFormat.selectionFlags) + .setRoleFlags(inputFormat.roleFlags) .build(); audioSink.configure(outputFormat, /* specifiedBufferSize= */ 0, /* outputChannels= */ null); audioTrackNeedsConfigure = false; diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/MediaCodecAudioRenderer.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/MediaCodecAudioRenderer.java index 793577a446..c70734b9d4 100644 --- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/MediaCodecAudioRenderer.java +++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/MediaCodecAudioRenderer.java @@ -562,6 +562,12 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media .setPcmEncoding(pcmEncoding) .setEncoderDelay(format.encoderDelay) .setEncoderPadding(format.encoderPadding) + .setMetadata(format.metadata) + .setId(format.id) + .setLabel(format.label) + .setLanguage(format.language) + .setSelectionFlags(format.selectionFlags) + .setRoleFlags(format.roleFlags) .setChannelCount(mediaFormat.getInteger(MediaFormat.KEY_CHANNEL_COUNT)) .setSampleRate(mediaFormat.getInteger(MediaFormat.KEY_SAMPLE_RATE)) .build();