Skip to content

Commit

Permalink
Fix potential soft-lock in test video player.
Browse files Browse the repository at this point in the history
  • Loading branch information
Themaister committed Oct 15, 2023
1 parent 4e0739f commit 43309d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/video_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ struct VideoTextureRenderable : AbstractRenderable
// If we have two candidates, shift out frame if next_frame PTS is closer.
double d_current = std::abs(frame.pts - target_pts);
double d_next = std::abs(next_frame.pts - target_pts);
if (d_next < d_current || !frame.view)

// In case we get two frames with same PTS for whatever reason, ensure forward progress.
// The less-equal check is load-bearing.
if (d_next <= d_current || !frame.view)
{
shift_frame();

Expand Down

0 comments on commit 43309d7

Please sign in to comment.