Skip to content

Commit

Permalink
Add setCodecOperatingRate workaround for 48KHz audio on ZTE Axon7 mini.
Browse files Browse the repository at this point in the history
Issue:#5821
PiperOrigin-RevId: 247621164
  • Loading branch information
tonihei authored and ojw28 committed May 15, 2019
1 parent ac07c56 commit 6ead148
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Fix NPE when using HLS chunkless preparation
([#5868](https://github.com/google/ExoPlayer/issues/5868)).
* Offline: Add option to remove all downloads.
* Add a workaround for a decoder failure on ZTE Axon7 mini devices when playing
48kHz audio ([#5821](https://github.com/google/ExoPlayer/issues/5821)).

### 2.10.0 ###

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ protected MediaFormat getMediaFormat(
// Set codec configuration values.
if (Util.SDK_INT >= 23) {
mediaFormat.setInteger(MediaFormat.KEY_PRIORITY, 0 /* realtime priority */);
if (codecOperatingRate != CODEC_OPERATING_RATE_UNSET) {
if (codecOperatingRate != CODEC_OPERATING_RATE_UNSET && !deviceDoesntSupportOperatingRate()) {
mediaFormat.setFloat(MediaFormat.KEY_OPERATING_RATE, codecOperatingRate);
}
}
Expand All @@ -809,6 +809,17 @@ private void updateCurrentPosition() {
}
}

/**
* Returns whether the device's decoders are known to not support setting the codec operating
* rate.
*
* <p>See <a href="https://github.com/google/ExoPlayer/issues/5821">GitHub issue #5821</a>.
*/
private static boolean deviceDoesntSupportOperatingRate() {
return Util.SDK_INT == 23
&& ("ZTE B2017G".equals(Util.MODEL) || "AXON 7 mini".equals(Util.MODEL));
}

/**
* Returns whether the decoder is known to output six audio channels when provided with input with
* fewer than six channels.
Expand Down

0 comments on commit 6ead148

Please sign in to comment.