]> git.sesse.net Git - nageru/commitdiff
Fix a problem where we could wait for a very long time for the first frame on FFmpeg...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 6 Jul 2017 22:25:48 +0000 (00:25 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 6 Jul 2017 22:25:48 +0000 (00:25 +0200)
ffmpeg_capture.cpp

index fb1b223c326f4e789193da4e078c65a48d729ec5..be27e6fb129a24c840837c0b85418bccc2c2f672 100644 (file)
@@ -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);