mirror of
https://github.com/androidx/media.git
synced 2025-05-08 16:10:38 +08:00
Return offload unsupported for DTSX P2 and API < 34.
This commit is contained in:
parent
19676084e6
commit
8ab1a68939
@ -81,18 +81,17 @@ public final class DefaultAudioOffloadSupportProvider
|
||||
|
||||
@C.Encoding
|
||||
int encoding = MimeTypes.getEncoding(checkNotNull(format.sampleMimeType), format.codecs);
|
||||
if (encoding == C.ENCODING_INVALID) {
|
||||
// AudioFormat.ENCODING_DTS_UHD_P2 is defined from API 34 onwards. We return offload
|
||||
// unsupported to prevent crash in Util.getAudioFormat() below when it tries to create
|
||||
// an AudioFormat with ENCODING_DTS_UHD_P2.
|
||||
if ((encoding == C.ENCODING_INVALID) ||
|
||||
((Util.SDK_INT < 34) && (encoding == C.ENCODING_DTS_UHD_P2))) {
|
||||
return AudioOffloadSupport.DEFAULT_UNSUPPORTED;
|
||||
}
|
||||
int channelConfig = Util.getAudioTrackChannelConfig(format.channelCount);
|
||||
if (channelConfig == AudioFormat.CHANNEL_INVALID) {
|
||||
return AudioOffloadSupport.DEFAULT_UNSUPPORTED;
|
||||
}
|
||||
// AudioFormat.ENCODING_DTS_UHD_P2 is defined from API 34 onwards. Before that encoding should
|
||||
// be set to C.ENCODING_DTS, which is supported by TV ICs for offload playback.
|
||||
if ((Util.SDK_INT < 34) && (encoding == C.ENCODING_DTS_UHD_P2)) {
|
||||
encoding = C.ENCODING_DTS;
|
||||
}
|
||||
AudioFormat audioFormat = Util.getAudioFormat(format.sampleRate, channelConfig, encoding);
|
||||
if (Util.SDK_INT >= 31) {
|
||||
return Api31.getOffloadedPlaybackSupport(
|
||||
|
Loading…
x
Reference in New Issue
Block a user