Fix writer assertion at the end of some 3D encodes; one too many fill frames were...
authorCarl Hetherington <cth@carlh.net>
Thu, 9 Aug 2018 21:28:27 +0000 (22:28 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 9 Aug 2018 21:31:11 +0000 (22:31 +0100)
src/lib/player.cc
test/threed_test.cc

index 2313e09e580326b6b0dd762f4c3da122b1f292f7..5e42d8e37d609d67786bacbbaac4609270055853 100644 (file)
@@ -793,12 +793,17 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
                DCPTime fill_from = max (*_last_video_time, piece->content->position());
                LastVideoMap::const_iterator last = _last_video.find (wp);
                if (_film->three_d()) {
+                       Eyes fill_to_eyes = video.eyes;
+                       if (fill_to == piece->content->end()) {
+                               /* Don't fill after the end of the content */
+                               fill_to_eyes = EYES_LEFT;
+                       }
                        DCPTime j = fill_from;
                        Eyes eyes = _last_video_eyes.get_value_or(EYES_LEFT);
                        if (eyes == EYES_BOTH) {
                                eyes = EYES_LEFT;
                        }
-                       while (j < fill_to || eyes != video.eyes) {
+                       while (j < fill_to || eyes != fill_to_eyes) {
                                if (last != _last_video.end()) {
                                        shared_ptr<PlayerVideo> copy = last->second->shallow_copy();
                                        copy->set_eyes (eyes);
index efa563966b87446f02da537347068b9dd5ac1e93..41d92bc2f9aa9b6e9f699d17ee131177eaa678a9 100644 (file)
@@ -119,3 +119,22 @@ BOOST_AUTO_TEST_CASE (threed_test4)
 
        BOOST_REQUIRE (!wait_for_jobs ());
 }
+
+BOOST_AUTO_TEST_CASE (threed_test5)
+{
+       shared_ptr<Film> film = new_test_film2 ("threed_test5");
+       shared_ptr<FFmpegContent> L (new FFmpegContent (film, private_data / "boon_telly.mkv"));
+       film->examine_and_add_content (L);
+       shared_ptr<FFmpegContent> R (new FFmpegContent (film, private_data / "boon_telly.mkv"));
+       film->examine_and_add_content (R);
+       wait_for_jobs ();
+
+       L->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT);
+       R->video->set_frame_type (VIDEO_FRAME_TYPE_3D_RIGHT);
+
+       film->set_three_d (true);
+       film->make_dcp ();
+       film->write_metadata ();
+
+       BOOST_REQUIRE (!wait_for_jobs ());
+}