X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffmpeg_capture.cpp;h=be27e6fb129a24c840837c0b85418bccc2c2f672;hb=30a7d1923b360f993209426aff4d2ea76da794bc;hp=fb1b223c326f4e789193da4e078c65a48d729ec5;hpb=957e689b3100f5f54dc56e1234c9b85ecc0c9528;p=nageru diff --git a/ffmpeg_capture.cpp b/ffmpeg_capture.cpp index fb1b223..be27e6f 100644 --- a/ffmpeg_capture.cpp +++ b/ffmpeg_capture.cpp @@ -411,6 +411,9 @@ bool FFmpegCapture::play_video(const string &pathname) audio_format.num_channels = 8; for ( ;; ) { + if (last_pts == 0 && pts_origin == 0) { + pts_origin = frame->pts; + } next_frame_start = compute_frame_start(frame->pts, pts_origin, video_timebase, start, rate); video_frame.received_timestamp = next_frame_start; bool finished_wakeup = producer_thread_should_quit.sleep_until(next_frame_start);