mirror of
https://github.com/samsonjs/media.git
synced 2026-03-25 09:25:53 +00:00
Add HALF_UP rounding TODO to scaleLargeTimestamp (and its usages)
PiperOrigin-RevId: 686921743
This commit is contained in:
parent
64e0397811
commit
8cb558e875
2 changed files with 4 additions and 0 deletions
|
|
@ -1909,6 +1909,8 @@ public final class Util {
|
|||
* @param divisor The divisor.
|
||||
* @return The scaled timestamp.
|
||||
*/
|
||||
// TODO: b/372204124 - Consider switching this (and impls below) to HALF_UP rounding to reduce
|
||||
// round-trip errors when switching between time bases with different resolutions.
|
||||
@UnstableApi
|
||||
public static long scaleLargeTimestamp(long timestamp, long multiplier, long divisor) {
|
||||
return scaleLargeValue(timestamp, multiplier, divisor, RoundingMode.DOWN);
|
||||
|
|
|
|||
|
|
@ -1309,6 +1309,7 @@ import org.checkerframework.checker.nullness.qual.PolyNull;
|
|||
|
||||
/** Converts video units to microseconds, using the provided timebase. */
|
||||
private static long usFromVu(long timestampVu, long videoUnitTimebase) {
|
||||
// TODO: b/372204124 - Switch to scaleLargeTimestamp when it uses HALF_UP rounding.
|
||||
return Util.scaleLargeValue(
|
||||
timestampVu, C.MICROS_PER_SECOND, videoUnitTimebase, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
|
@ -1908,6 +1909,7 @@ import org.checkerframework.checker.nullness.qual.PolyNull;
|
|||
|
||||
/** Converts microseconds to video units, using the provided timebase. */
|
||||
private static long vuFromUs(long timestampUs, long videoUnitTimebase) {
|
||||
// TODO: b/372204124 - Switch to scaleLargeTimestamp when it uses HALF_UP rounding.
|
||||
return Util.scaleLargeValue(
|
||||
timestampUs, videoUnitTimebase, C.MICROS_PER_SECOND, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue