From: Carl Hetherington Date: Tue, 16 May 2017 10:25:45 +0000 (+0100) Subject: Fix failure to fill FFmpeg gaps at the start of films. X-Git-Tag: v2.11.6~37 X-Git-Url: https://main.carlh.net/gitweb/?a=commitdiff_plain;ds=sidebyside;h=d474df7f2f8c01ece7ded039fe4c926555677dc4;p=dcpomatic.git Fix failure to fill FFmpeg gaps at the start of films. --- diff --git a/src/lib/player.cc b/src/lib/player.cc index 2fc062bb5..ad21bb9f1 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -670,9 +670,16 @@ Player::video (weak_ptr wp, ContentVideo video) as in the problematic case we are about to emit a frame which is not contiguous with the previous. */ + optional fill_to; if (_last_video_time) { + fill_to = _last_video_time; + } else if (_last_seek_time && _last_seek_accurate) { + fill_to = _last_seek_time; + } + + if (fill_to) { /* XXX: this may not work for 3D */ - BOOST_FOREACH (DCPTimePeriod i, subtract(DCPTimePeriod (*_last_video_time, time), _no_video)) { + BOOST_FOREACH (DCPTimePeriod i, subtract(DCPTimePeriod (*fill_to, time), _no_video)) { for (DCPTime j = i.from; j < i.to; j += one_video_frame()) { if (_last_video) { emit_video (shared_ptr (new PlayerVideo (*_last_video)), j); diff --git a/test/ffmpeg_decoder_sequential_test.cc b/test/ffmpeg_decoder_sequential_test.cc index 6bda8f260..67a825418 100644 --- a/test/ffmpeg_decoder_sequential_test.cc +++ b/test/ffmpeg_decoder_sequential_test.cc @@ -50,7 +50,7 @@ static DCPTime frame; static void check (shared_ptr, DCPTime time) { - BOOST_CHECK (time == next); + BOOST_REQUIRE (time == next); next += frame; } @@ -76,12 +76,12 @@ ffmpeg_decoder_sequential_test_one (boost::filesystem::path file, float fps, int next = DCPTime (); frame = DCPTime::from_frames (1, film->video_frame_rate ()); while (!player->pass()) {} - BOOST_CHECK (next == DCPTime::from_frames (video_length, film->video_frame_rate())); + BOOST_REQUIRE (next == DCPTime::from_frames (video_length, film->video_frame_rate())); } BOOST_AUTO_TEST_CASE (ffmpeg_decoder_sequential_test) { - ffmpeg_decoder_sequential_test_one ("boon_telly.mkv", 29.97, 6911); + ffmpeg_decoder_sequential_test_one ("boon_telly.mkv", 29.97, 6912); ffmpeg_decoder_sequential_test_one ("Sintel_Trailer1.480p.DivX_Plus_HD.mkv", 24, 1253); ffmpeg_decoder_sequential_test_one ("prophet_clip.mkv", 23.976, 2879); }