summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-08-09 22:28:27 +0100
committerCarl Hetherington <cth@carlh.net>2018-08-09 22:31:11 +0100
commitfcab3e1bf6c6f05ca714eb9e337ff50f13fff6a6 (patch)
tree38039409022f46f19e85ae180129f17ff75ca71e
parente41677a322965fd964c15368de2f3e027229f361 (diff)
Fix writer assertion at the end of some 3D encodes; one too many fill frames were being emitted.
-rw-r--r--src/lib/player.cc7
-rw-r--r--test/threed_test.cc19
2 files changed, 25 insertions, 1 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 2313e09e5..5e42d8e37 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -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);
diff --git a/test/threed_test.cc b/test/threed_test.cc
index efa563966..41d92bc2f 100644
--- a/test/threed_test.cc
+++ b/test/threed_test.cc
@@ -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 ());
+}