Commit 3b1d0e27 by andrewlewis Committed by Oliver Woodman

Double the buffer duration for AC3

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219765107
parent 76688589
......@@ -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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment