Skip to content

Commit 657703e

Browse files
andrewlewisicbaker
authored andcommitted
Fix E-AC3 output capability check without sample rate
PiperOrigin-RevId: 432189509 (cherry picked from commit e66d0c9)
1 parent 71685da commit 657703e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

RELEASENOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
### dev-v2 (not yet released)
44

5+
* Audio:
6+
* Fix error checking audio capabilities for Dolby Atmos (E-AC3-JOC) in
7+
HLS.
58
* Extractors:
69
* FMP4: Fix issue where emsg sample metadata could be output in the wrong
710
order for streams containing both v0 and v1 emsg atoms

library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1730,8 +1730,11 @@ private static Pair<Integer, Integer> getEncodingAndChannelConfigForPassthrough(
17301730
// the channel count for this encoding, but before then there is no way to query it so we
17311731
// assume 6 channel audio is supported.
17321732
if (Util.SDK_INT >= 29) {
1733+
// Default to 48 kHz if the format doesn't have a sample rate (for example, for chunkless
1734+
// HLS preparation). See [Internal: b/222127949].
1735+
int sampleRate = format.sampleRate != Format.NO_VALUE ? format.sampleRate : 48000;
17331736
channelCount =
1734-
getMaxSupportedChannelCountForPassthroughV29(C.ENCODING_E_AC3_JOC, format.sampleRate);
1737+
getMaxSupportedChannelCountForPassthroughV29(C.ENCODING_E_AC3_JOC, sampleRate);
17351738
if (channelCount == 0) {
17361739
Log.w(TAG, "E-AC3 JOC encoding supported but no channel count supported");
17371740
return null;

0 commit comments

Comments
 (0)