Commit 5aac1898 by olly Committed by Christos Tsilopoulos

Use longs to avoid intger overflow

PiperOrigin-RevId: 347351440
parent 4907cf87
...@@ -388,7 +388,7 @@ public class DefaultLivePlaybackSpeedControlTest { ...@@ -388,7 +388,7 @@ public class DefaultLivePlaybackSpeedControlTest {
for (int i = 0; i < 500; i++) { for (int i = 0; i < 500; i++) {
ShadowSystemClock.advanceBy(Duration.ofMillis(100)); ShadowSystemClock.advanceBy(Duration.ofMillis(100));
long noiseUs = ((i % 10) - 5) * 1_000; long noiseUs = ((i % 10) - 5L) * 1_000;
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed( defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
/* liveOffsetUs= */ 45_000_000, /* bufferedDurationUs= */ 1_000_000 + noiseUs); /* liveOffsetUs= */ 45_000_000, /* bufferedDurationUs= */ 1_000_000 + noiseUs);
} }
...@@ -419,7 +419,7 @@ public class DefaultLivePlaybackSpeedControlTest { ...@@ -419,7 +419,7 @@ public class DefaultLivePlaybackSpeedControlTest {
// Pretend to have a buffered duration at around the target duration with some artificial noise. // Pretend to have a buffered duration at around the target duration with some artificial noise.
for (int i = 0; i < 500; i++) { for (int i = 0; i < 500; i++) {
ShadowSystemClock.advanceBy(Duration.ofMillis(100)); ShadowSystemClock.advanceBy(Duration.ofMillis(100));
long noiseUs = ((i % 10) - 5) * 1_000; long noiseUs = ((i % 10) - 5L) * 1_000;
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed( defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
/* liveOffsetUs= */ 49_000_000, /* bufferedDurationUs= */ 7_000_000 + noiseUs); /* liveOffsetUs= */ 49_000_000, /* bufferedDurationUs= */ 7_000_000 + noiseUs);
} }
...@@ -451,7 +451,7 @@ public class DefaultLivePlaybackSpeedControlTest { ...@@ -451,7 +451,7 @@ public class DefaultLivePlaybackSpeedControlTest {
// Pretend to have a buffered duration at around the target duration with some artificial noise. // Pretend to have a buffered duration at around the target duration with some artificial noise.
for (int i = 0; i < 500; i++) { for (int i = 0; i < 500; i++) {
ShadowSystemClock.advanceBy(Duration.ofMillis(100)); ShadowSystemClock.advanceBy(Duration.ofMillis(100));
long noiseUs = ((i % 10) - 5) * 1_000; long noiseUs = ((i % 10) - 5L) * 1_000;
defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed( defaultLivePlaybackSpeedControl.getAdjustedPlaybackSpeed(
/* liveOffsetUs= */ 49_000_000, /* bufferedDurationUs= */ 7_000_000 + noiseUs); /* liveOffsetUs= */ 49_000_000, /* bufferedDurationUs= */ 7_000_000 + noiseUs);
} }
......
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