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<double>(time_behind).count()));
+ continue;
+ }
+
int64_t in_pts_lower, in_pts_upper;
// Find the frame immediately before and after this point.
}
}
+ if (progress_callback != nullptr) {
+ // NOTE: None of this will take into account any snapping done below.
+ double played_this_clip = double(in_pts - clip.pts_in) / TIMEBASE / speed;
+ double total_length = double(clip.pts_out - clip.pts_in) / TIMEBASE / speed;
+ progress_callback(played_this_clip, total_length);
+ }
+
if (in_pts_lower == in_pts_upper) {
destination->setFrame(stream_idx, in_pts_lower, /*interpolated=*/false);
if (video_stream != nullptr) {
continue;
}
+ if (time_behind >= milliseconds(100)) {
+ fprintf(stderr, "WARNING: %ld ms behind, dropping an interpolated frame.\n",
+ lrint(1e3 * duration<double>(time_behind).count()));
+ continue;
+ }
+
double alpha = double(in_pts - in_pts_lower) / (in_pts_upper - in_pts_lower);
if (video_stream == nullptr) {