mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Merge pull request #1011 from cedricxperi:dts-lbr-hls-bitrate-unknown-fix
PiperOrigin-RevId: 603302863
This commit is contained in:
commit
f85860c041
@ -765,6 +765,15 @@ public final class DefaultAudioSink implements AudioSink {
|
|||||||
"Invalid output channel config (mode=" + outputMode + ") for: " + inputFormat,
|
"Invalid output channel config (mode=" + outputMode + ") for: " + inputFormat,
|
||||||
inputFormat);
|
inputFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replace unknown bitrate by maximum allowed bitrate for DTS Express to avoid allocating an
|
||||||
|
// AudioTrack buffer for the much larger maximum bitrate of the underlying DTS-HD encoding.
|
||||||
|
int bitrate = inputFormat.bitrate;
|
||||||
|
if (MimeTypes.AUDIO_DTS_EXPRESS.equals(inputFormat.sampleMimeType)
|
||||||
|
&& bitrate == Format.NO_VALUE) {
|
||||||
|
bitrate = DtsUtil.DTS_EXPRESS_MAX_RATE_BITS_PER_SECOND;
|
||||||
|
}
|
||||||
|
|
||||||
int bufferSize =
|
int bufferSize =
|
||||||
specifiedBufferSize != 0
|
specifiedBufferSize != 0
|
||||||
? specifiedBufferSize
|
? specifiedBufferSize
|
||||||
@ -774,7 +783,7 @@ public final class DefaultAudioSink implements AudioSink {
|
|||||||
outputMode,
|
outputMode,
|
||||||
outputPcmFrameSize != C.LENGTH_UNSET ? outputPcmFrameSize : 1,
|
outputPcmFrameSize != C.LENGTH_UNSET ? outputPcmFrameSize : 1,
|
||||||
outputSampleRate,
|
outputSampleRate,
|
||||||
inputFormat.bitrate,
|
bitrate,
|
||||||
enableAudioTrackPlaybackParams ? MAX_PLAYBACK_SPEED : DEFAULT_PLAYBACK_SPEED);
|
enableAudioTrackPlaybackParams ? MAX_PLAYBACK_SPEED : DEFAULT_PLAYBACK_SPEED);
|
||||||
offloadDisabledUntilNextConfiguration = false;
|
offloadDisabledUntilNextConfiguration = false;
|
||||||
Configuration pendingConfiguration =
|
Configuration pendingConfiguration =
|
||||||
|
@ -143,6 +143,9 @@ public final class DtsUtil {
|
|||||||
/** Maximum rate for a DTS-HD audio stream, in bytes per second. */
|
/** Maximum rate for a DTS-HD audio stream, in bytes per second. */
|
||||||
public static final int DTS_HD_MAX_RATE_BYTES_PER_SECOND = 18000 * 1000 / 8;
|
public static final int DTS_HD_MAX_RATE_BYTES_PER_SECOND = 18000 * 1000 / 8;
|
||||||
|
|
||||||
|
/** Maximum bit-rate for a DTS Express audio stream, in bits per second. */
|
||||||
|
public static final int DTS_EXPRESS_MAX_RATE_BITS_PER_SECOND = 768000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DTS Core Syncword (in different Endianness). See ETSI TS 102 114 V1.6.1 (2019-08), Section 5.3.
|
* DTS Core Syncword (in different Endianness). See ETSI TS 102 114 V1.6.1 (2019-08), Section 5.3.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user