X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=futatabi%2Fplayer.cpp;h=a5d093ade2bba23422d092b382233f24f8cb9539;hb=5a1069f76339d67e0549091724b901468356fa2c;hp=e20a43cc26bf84fe920ac9dff3b2892d96ee6644;hpb=a64b7a670a29674aa4a6cb2abe2f5a29f6cc14bc;p=nageru diff --git a/futatabi/player.cpp b/futatabi/player.cpp index e20a43c..a5d093a 100644 --- a/futatabi/player.cpp +++ b/futatabi/player.cpp @@ -103,10 +103,7 @@ got_clip: lock_guard lock(frame_mu); // Find the first frame such that frame.pts <= in_pts. - auto it = lower_bound(frames[stream_idx].begin(), - frames[stream_idx].end(), - in_pts_origin, - [](const FrameOnDisk &frame, int64_t pts) { return frame.pts < pts; }); + auto it = find_last_frame_before(frames[stream_idx], in_pts_origin); if (it != frames[stream_idx].end()) { in_pts_origin = it->pts; } @@ -363,10 +360,7 @@ bool Player::find_surrounding_frames(int64_t pts, int stream_idx, FrameOnDisk *f lock_guard lock(frame_mu); // Find the first frame such that frame.pts >= pts. - auto it = lower_bound(frames[stream_idx].begin(), - frames[stream_idx].end(), - pts, - [](const FrameOnDisk &frame, int64_t pts) { return frame.pts < pts; }); + auto it = find_last_frame_before(frames[stream_idx], pts); if (it == frames[stream_idx].end()) { return false; } @@ -451,8 +445,7 @@ void Player::override_angle(unsigned stream_idx) } lock_guard lock(frame_mu); - auto it = upper_bound(frames[stream_idx].begin(), frames[stream_idx].end(), pts_out, - [](int64_t pts, const FrameOnDisk &frame) { return pts < frame.pts; }); + auto it = find_first_frame_at_or_after(frames[stream_idx], pts_out); if (it == frames[stream_idx].end()) { return; }