mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Add setCodecOperatingRate workaround for 48KHz audio on ZTE Axon7 mini.
Issue:#5821 PiperOrigin-RevId: 247621164
This commit is contained in:
parent
ac07c56dab
commit
6ead14880b
2 changed files with 14 additions and 1 deletions
|
|
@ -5,6 +5,8 @@
|
||||||
* Fix NPE when using HLS chunkless preparation
|
* Fix NPE when using HLS chunkless preparation
|
||||||
([#5868](https://github.com/google/ExoPlayer/issues/5868)).
|
([#5868](https://github.com/google/ExoPlayer/issues/5868)).
|
||||||
* Offline: Add option to remove all downloads.
|
* 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 ###
|
### 2.10.0 ###
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -786,7 +786,7 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||||
// Set codec configuration values.
|
// Set codec configuration values.
|
||||||
if (Util.SDK_INT >= 23) {
|
if (Util.SDK_INT >= 23) {
|
||||||
mediaFormat.setInteger(MediaFormat.KEY_PRIORITY, 0 /* realtime priority */);
|
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);
|
mediaFormat.setFloat(MediaFormat.KEY_OPERATING_RATE, codecOperatingRate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -809,6 +809,17 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Returns whether the decoder is known to output six audio channels when provided with input with
|
||||||
* fewer than six channels.
|
* fewer than six channels.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue