Format passed to audioSink.configure is missing information.

AudioSink might require the identifying data and metadata to be able to take decisions.
This commit is contained in:
Tolriq 2023-08-04 15:07:59 +02:00 committed by tonihei
parent 53b882d803
commit 4e93db4d0a
2 changed files with 12 additions and 0 deletions

View File

@ -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;

View File

@ -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();