From: Steinar H. Gunderson Date: Thu, 6 Jul 2017 22:25:48 +0000 (+0200) Subject: Fix a problem where we could wait for a very long time for the first frame on FFmpeg... X-Git-Tag: 1.6.1~7 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=30a7d1923b360f993209426aff4d2ea76da794bc Fix a problem where we could wait for a very long time for the first frame on FFmpeg inputs. --- 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);