Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DTS Express Audio Buffer Underflow Issue. #650

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update nits
  • Loading branch information
cedricxperi authored and tianyif committed Oct 12, 2023
commit 0f200ba5d190a184fd9c6f19b9488c770534c5d4
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ public class DefaultAudioTrackBufferSizeProvider
*/
private static final int DTSHD_BUFFER_MULTIPLICATION_FACTOR = 4;

/**
* A builder to create {@link DefaultAudioTrackBufferSizeProvider} instances.
*/
/** A builder to create {@link DefaultAudioTrackBufferSizeProvider} instances. */

public static class Builder {

Expand Down Expand Up @@ -156,7 +154,7 @@ public Builder setAc3BufferMultiplicationFactor(int ac3BufferMultiplicationFacto
/**
* Sets the multiplication factor to apply to the passthrough buffer for DTS-HD (DTS Express)
* to avoid underruns on some devices (e.g., Xiaomi A2 TV). Default is
* {@value #DTSHD_BUFFER_MULTIPLICATION_FACTOR}.
* {@link #DTSHD_BUFFER_MULTIPLICATION_FACTOR}.
*/
@CanIgnoreReturnValue
public Builder setDtshdBufferMultiplicationFactor(int dtshdBufferMultiplicationFactor) {
Expand Down Expand Up @@ -259,8 +257,8 @@ protected int getPassthroughBufferSizeInBytes(@C.Encoding int encoding, int bitr
if (encoding == C.ENCODING_AC3) {
bufferSizeUs *= ac3BufferMultiplicationFactor;
} else if (encoding == C.ENCODING_DTS_HD) {
// DTSHD (DTS Express) for streaming uses a frame size (number of audio samples per channel
// per frame of 4096. This requires a higher multiple for the buffersize computation.
// DTS-HD (DTS Express) for streaming uses a frame size (number of audio samples per channel
// per frame) of 4096. This requires a higher multiple for the buffersize computation.
// Otherwise, there will be buffer underflow during DASH playback.
bufferSizeUs *= dtshdBufferMultiplicationFactor;
}
Expand Down