X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=player.cpp;h=1e57ded102df14eff8fbd69f7a544fed77e9a5bf;hb=1aab0848ee4807a0369656edd9eb42ce5adb56ae;hp=1eea8d706c883d07a6d0592131cc8e7e6a8e15ab;hpb=b278660b3e68a23d39c9783ac64675b44675016c;p=nageru diff --git a/player.cpp b/player.cpp index 1eea8d7..1e57ded 100644 --- a/player.cpp +++ b/player.cpp @@ -97,6 +97,13 @@ void Player::thread_func(bool also_output_to_stream) int64_t in_pts = lrint(in_pts_origin + TIMEBASE * frameno * speed / output_framerate); pts = lrint(out_pts); + steady_clock::duration time_behind = steady_clock::now() - next_frame_start; + if (time_behind >= milliseconds(200)) { + fprintf(stderr, "WARNING: %ld ms behind, dropping a frame (no matter the type).\n", + lrint(1e3 * duration(time_behind).count())); + continue; + } + int64_t in_pts_lower, in_pts_upper; // Find the frame immediately before and after this point. @@ -171,6 +178,12 @@ void Player::thread_func(bool also_output_to_stream) continue; } + if (time_behind >= milliseconds(100)) { + fprintf(stderr, "WARNING: %ld ms behind, dropping an interpolated frame.\n", + lrint(1e3 * duration(time_behind).count())); + continue; + } + double alpha = double(in_pts - in_pts_lower) / (in_pts_upper - in_pts_lower); if (video_stream == nullptr) {