Skip to content

Commit

Permalink
Add check that setPlaybackSpeed is sane
Browse files Browse the repository at this point in the history
This will ignore any values that are clearly incorrect i.e. <0.25.

This means the playback controller can still have a sentinel value of
-1.0 to ensure the model controlling speed is in-place correctly. Whilst
not breaking user playback by default if something goes wrong.

As this file directly interfaces with the video manager (which holds
surfaces) we can't easily make a test for it, so leave this block
untested
  • Loading branch information
DavidFair committed Jan 3, 2022
1 parent f35ba7d commit 13a289d
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,11 @@ public void setAudioTrack(int ndx, List<MediaStream> allStreams) {
}

public void setPlaybackSpeed(@NonNull Double speed) {
if (speed < 0.25) {
Timber.w("Invalid playback speed requested: %d", speed);
return;
}

if (nativeMode) {
mExoPlayer.setPlaybackSpeed(speed.floatValue());
} else {
Expand Down

0 comments on commit 13a289d

Please sign in to comment.