Commit 2674e055 by krocard Committed by Oliver Woodman

Make audio track min buffer size configurable.

Move the code in its own class as DefaultAudioTrack
is getting very big. It also help for testability.

The new class is easily configurable and highly tested.
Manual test was used to catch any regression.

https://github.com/google/ExoPlayer/issues/8891

PiperOrigin-RevId: 415268938
parent 0aa23b08
......@@ -30,6 +30,9 @@
constructors.
* Change `AudioCapabilities` APIs to require passing explicitly
`AudioCapabilities.DEFAULT_AUDIO_CAPABILITIES` instead of `null`.
* Allow customization of the `AudioTrack` buffer size calculation by
injecting an `AudioTrackBufferSizeProvider` to `DefaultAudioSink`.
([#8891](https://github.com/google/ExoPlayer/issues/8891)).
* Extractors:
* Fix inconsistency with spec in H.265 SPS nal units parsing
((#9719)[https://github.com/google/ExoPlayer/issues/9719]).
......
......@@ -808,6 +808,23 @@ public final class Util {
}
/**
* Returns the value of the {@code long} argument; throwing an exception if the value overflows an
* {@code int}.
*
* <p>Equivalent to API 26 {@link Math#toIntExact}.
*
* @param value The long value.
* @return The argument as an int.
* @throws ArithmeticException If the {@code argument} overflows an int.
*/
public static int toIntExact(long value) {
if ((int) value != value) {
throw new ArithmeticException(); // integer overflow
}
return (int) value;
}
/**
* Returns the index of the first occurrence of {@code value} in {@code array}, or {@link
* C#INDEX_UNSET} if {@code value} is not contained in {@code array}.
*
......
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