Don't emit black to fill up to a frame that we're not going to emit.
authorCarl Hetherington <cth@carlh.net>
Wed, 12 Jul 2017 22:21:25 +0000 (23:21 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 12 Jul 2017 22:21:25 +0000 (23:21 +0100)
src/lib/player.cc
test/reels_test.cc
test/wscript

index 3ed0e4f..5e888f1 100644 (file)
@@ -620,6 +620,14 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
        DCPTime const time = content_video_to_dcp (piece, video.frame);
        DCPTimePeriod const period (time, time + one_video_frame());
 
+       /* Discard if it's outside the content's period or if it's before the last accurate seek */
+       if (
+               time < piece->content->position() ||
+               time >= piece->content->end() ||
+               (_last_video_time && time < *_last_video_time)) {
+               return;
+       }
+
        /* Fill gaps that we discover now that we have some video which needs to be emitted */
 
        if (_last_video_time) {
@@ -635,14 +643,6 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
                }
        }
 
-       /* Discard if it's outside the content's period or if it's before the last accurate seek */
-       if (
-               time < piece->content->position() ||
-               time >= piece->content->end() ||
-               (_last_video_time && time < *_last_video_time)) {
-               return;
-       }
-
        _last_video[wp].reset (
                new PlayerVideo (
                        video.image,
index 72a3fe7..79b4c5a 100644 (file)
@@ -326,3 +326,20 @@ BOOST_AUTO_TEST_CASE (reels_test7)
        film->make_dcp ();
        BOOST_REQUIRE (!wait_for_jobs ());
 }
+
+/** Check a reels-related error; make_dcp() would raise a ProgrammingError */
+BOOST_AUTO_TEST_CASE (reels_test8)
+{
+       shared_ptr<Film> film = new_test_film ("reels_test8");
+       film->set_name ("reels_test8");
+       film->set_container (Ratio::from_id ("185"));
+       film->set_dcp_content_type (DCPContentType::from_isdcf_name ("TST"));
+       shared_ptr<FFmpegContent> A (new FFmpegContent (film, "test/data/test2.mp4"));
+       film->examine_and_add_content (A);
+       BOOST_REQUIRE (!wait_for_jobs ());
+
+       A->set_trim_end (ContentTime::from_seconds (1));
+       cout << to_string(A->length_after_trim()) << "\n";
+       film->make_dcp ();
+       BOOST_REQUIRE (!wait_for_jobs ());
+}
index 7dcd6a9..e4a391f 100644 (file)
@@ -49,6 +49,7 @@ def build(bld):
                  audio_processor_test.cc
                  audio_processor_delay_test.cc
                  audio_ring_buffers_test.cc
+                 butler_test.cc
                  client_server_test.cc
                  colour_conversion_test.cc
                  content_test.cc