mirror of
https://github.com/samsonjs/media.git
synced 2026-03-30 10:15:48 +00: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
57042adec7
commit
1866e6bfba
1 changed files with 6 additions and 0 deletions
|
|
@ -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
|
||||
*/
|
||||
|
|
@ -484,6 +487,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…
Reference in a new issue