mirror of
https://github.com/androidx/media.git
synced 2025-05-10 00:59:51 +08:00
Fix playback for Vivo codecs that output non-16-bit audio
PiperOrigin-RevId: 288468497
This commit is contained in:
parent
35fbb7f7ca
commit
692c8ee0ac
@ -79,6 +79,11 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||
private static final int MAX_PENDING_STREAM_CHANGE_COUNT = 10;
|
||||
|
||||
private static final String TAG = "MediaCodecAudioRenderer";
|
||||
/**
|
||||
* Custom key used to indicate bits per sample by some decoders on Vivo devices. For example
|
||||
* OMX.vivo.alac.decoder on the Vivo Z1 Pro.
|
||||
*/
|
||||
private static final String VIVO_BITS_PER_SAMPLE_KEY = "v-bits-per-sample";
|
||||
|
||||
private final Context context;
|
||||
private final EventDispatcher eventDispatcher;
|
||||
@ -566,8 +571,12 @@ public class MediaCodecAudioRenderer extends MediaCodecRenderer implements Media
|
||||
mediaFormat.getString(MediaFormat.KEY_MIME));
|
||||
} else {
|
||||
mediaFormat = outputMediaFormat;
|
||||
if (outputMediaFormat.containsKey(VIVO_BITS_PER_SAMPLE_KEY)) {
|
||||
encoding = Util.getPcmEncoding(outputMediaFormat.getInteger(VIVO_BITS_PER_SAMPLE_KEY));
|
||||
} else {
|
||||
encoding = getPcmEncoding(inputFormat);
|
||||
}
|
||||
}
|
||||
int channelCount = mediaFormat.getInteger(MediaFormat.KEY_CHANNEL_COUNT);
|
||||
int sampleRate = mediaFormat.getInteger(MediaFormat.KEY_SAMPLE_RATE);
|
||||
int[] channelMap;
|
||||
|
Loading…
x
Reference in New Issue
Block a user