Skip to content

Commit

Permalink
Merge pull request #712 from Stremio/fix/player-underflow
Browse files Browse the repository at this point in the history
fix: Player underflow
  • Loading branch information
elpiel authored Jul 31, 2024
2 parents 4cb5708 + caf1712 commit 928f185
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/models/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ fn intro_outro_update<E: Env + 'static>(
);

closest_duration.and_then(|(closest_duration, skip_gaps)| {
let duration_diff_in_secs = (library_item.state.duration - closest_duration).div(1000 * 10) / 10;
let duration_diff_in_secs = (library_item.state.duration.abs_diff(*closest_duration)).div(1000 * 10) / 10;
tracing::trace!("Player: Intro match by duration with difference of {duration_diff_in_secs} seconds");

let duration_ration = Ratio::new(library_item.state.duration, *closest_duration);
Expand All @@ -1233,7 +1233,7 @@ fn intro_outro_update<E: Env + 'static>(
IntroData {
from: (duration_ration * seek_event.from).to_integer(),
to: (duration_ration * seek_event.to).to_integer(),
duration: if duration_diff_in_secs > 0 { Some(seek_event.to - seek_event.from) } else { None }
duration: if duration_diff_in_secs > 0 { Some(seek_event.to.abs_diff(seek_event.from)) } else { None }
}
})
})
Expand Down

0 comments on commit 928f185

Please sign in to comment.