mirror of
https://github.com/androidx/media.git
synced 2025-05-10 00:59:51 +08:00
Double the buffer duration for AC3
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=219765107
This commit is contained in:
parent
76688589d2
commit
3b1d0e270b
@ -172,6 +172,9 @@ public final class DefaultAudioSink implements AudioSink {
|
||||
*/
|
||||
private static final int BUFFER_MULTIPLICATION_FACTOR = 4;
|
||||
|
||||
/** To avoid underruns on some devices (e.g., Broadcom 7271), scale up the AC3 buffer duration. */
|
||||
private static final int AC3_BUFFER_MULTIPLICATION_FACTOR = 2;
|
||||
|
||||
/**
|
||||
* @see AudioTrack#ERROR_BAD_VALUE
|
||||
*/
|
||||
@ -483,6 +486,9 @@ public final class DefaultAudioSink implements AudioSink {
|
||||
return Util.constrainValue(multipliedBufferSize, minAppBufferSize, maxAppBufferSize);
|
||||
} else {
|
||||
int rate = getMaximumEncodedRateBytesPerSecond(outputEncoding);
|
||||
if (outputEncoding == C.ENCODING_AC3) {
|
||||
rate *= AC3_BUFFER_MULTIPLICATION_FACTOR;
|
||||
}
|
||||
return (int) (PASSTHROUGH_BUFFER_DURATION_US * rate / C.MICROS_PER_SECOND);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user