Fix E-AC3 output capability check without sample rate

#minor-release

PiperOrigin-RevId: 432189509
This commit is contained in:
andrewlewis 2022-03-03 15:29:15 +00:00 committed by Ian Baker
parent 540f2061cb
commit e66d0c9039
2 changed files with 7 additions and 1 deletions

View File

@ -15,6 +15,9 @@
* Track selection:
* Flatten `TrackSelectionOverrides` class into `TrackSelectionParameters`,
and promote `TrackSelectionOverride` to a top level class.
* Audio:
* Fix error checking audio capabilities for Dolby Atmos (E-AC3-JOC) in
HLS.
* Extractors:
* Matroska: Parse `DiscardPadding` for Opus tracks.
* FMP4: Fix issue where emsg sample metadata could be output in the wrong

View File

@ -1736,8 +1736,11 @@ public final class DefaultAudioSink implements AudioSink {
// the channel count for this encoding, but before then there is no way to query it so we
// assume 6 channel audio is supported.
if (Util.SDK_INT >= 29) {
// Default to 48 kHz if the format doesn't have a sample rate (for example, for chunkless
// HLS preparation). See [Internal: b/222127949].
int sampleRate = format.sampleRate != Format.NO_VALUE ? format.sampleRate : 48000;
channelCount =
getMaxSupportedChannelCountForPassthroughV29(C.ENCODING_E_AC3_JOC, format.sampleRate);
getMaxSupportedChannelCountForPassthroughV29(C.ENCODING_E_AC3_JOC, sampleRate);
if (channelCount == 0) {
Log.w(TAG, "E-AC3 JOC encoding supported but no channel count supported");
return null;