/*
- Copyright (C) 2014-2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2019 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
using boost::shared_ptr;
using boost::bind;
using boost::optional;
+using namespace dcpomatic;
static shared_ptr<AudioBuffers> accumulated;
film->set_audio_channels (6);
film->examine_and_add_content (c);
- wait_for_jobs ();
+ BOOST_REQUIRE (!wait_for_jobs());
accumulated.reset (new AudioBuffers (film->audio_channels(), 0));
film->examine_and_add_content (contentA);
film->examine_and_add_content (contentB);
- wait_for_jobs ();
+ BOOST_REQUIRE (!wait_for_jobs());
contentA->video->set_scale (VideoContentScale (Ratio::from_id ("185")));
contentA->video->set_length (3);
film->make_dcp ();
- wait_for_jobs ();
+ BOOST_REQUIRE (!wait_for_jobs());
boost::filesystem::path ref;
ref = "test";
for (int i = 0; i < 10; ++i) {
DCPTime t = DCPTime::from_frames (i, 24);
butler->seek (t, true);
- pair<shared_ptr<PlayerVideo>, DCPTime> video = butler->get_video();
+ pair<shared_ptr<PlayerVideo>, DCPTime> video = butler->get_video(true, 0);
BOOST_CHECK_EQUAL(video.second.get(), t.get());
write_image(video.first->image(bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true), String::compose("build/test/player_seek_test_%1.png", i), "RGB");
- /* This 0.011 is empirically chosen (hopefully) to accept changes in rendering between the reference and a test machine
+ /* This 0.055 is empirically chosen (hopefully) to accept changes in rendering between the reference and a test machine
(17.10 and 16.04 seem to anti-alias a little differently) but to reject gross errors e.g. missing fonts or missing
text altogether.
*/
- check_image(String::compose("test/data/player_seek_test_%1.png", i), String::compose("build/test/player_seek_test_%1.png", i), 0.011);
+ check_image(String::compose("test/data/player_seek_test_%1.png", i), String::compose("build/test/player_seek_test_%1.png", i), 0.055);
}
}
for (int i = 0; i < 10; ++i) {
DCPTime t = DCPTime::from_seconds(5) + DCPTime::from_frames (i, 24);
butler->seek (t, true);
- pair<shared_ptr<PlayerVideo>, DCPTime> video = butler->get_video();
+ pair<shared_ptr<PlayerVideo>, DCPTime> video = butler->get_video(true, 0);
BOOST_CHECK_EQUAL(video.second.get(), t.get());
write_image(video.first->image(bind(PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true), String::compose("build/test/player_seek_test2_%1.png", i), "RGB");
- check_image(String::compose("test/data/player_seek_test2_%1.png", i), String::compose("build/test/player_seek_test2_%1.png", i), 0.011);
+ check_image(String::compose("test/data/player_seek_test2_%1.png", i), String::compose("build/test/player_seek_test2_%1.png", i), 0.055);
}
}
shared_ptr<Butler> butler (new Butler(player, AudioMapping(), 6, bind(&PlayerVideo::force, _1, AV_PIX_FMT_RGB24), false, true));
/* Wait for the butler to fill */
- dcpomatic_sleep (5);
+ dcpomatic_sleep_seconds (5);
boon->set_trim_start (ContentTime::from_seconds(5));
butler->seek (DCPTime(), true);
/* Wait for the butler to refill */
- dcpomatic_sleep (5);
+ dcpomatic_sleep_seconds (5);
butler->rethrow ();
}
+
+/** Test a crash when the gap between the last audio and the start of a silent period is more than 1 sample */
+BOOST_AUTO_TEST_CASE (player_silence_crash)
+{
+ shared_ptr<Film> film = new_test_film2 ("player_silence_crash");
+ shared_ptr<Content> sine = content_factory("test/data/impulse_train.wav").front();
+ film->examine_and_add_content (sine);
+ BOOST_REQUIRE (!wait_for_jobs());
+
+ sine->set_video_frame_rate (23.976);
+ film->write_metadata ();
+ film->make_dcp ();
+ BOOST_REQUIRE (!wait_for_jobs());
+}
+
+/** Test a crash when processing a 3D DCP */
+BOOST_AUTO_TEST_CASE (player_3d_test_1)
+{
+ shared_ptr<Film> film = new_test_film2 ("player_3d_test_1a");
+ shared_ptr<Content> left = content_factory("test/data/flat_red.png").front();
+ film->examine_and_add_content (left);
+ shared_ptr<Content> right = content_factory("test/data/flat_blue.png").front();
+ film->examine_and_add_content (right);
+ BOOST_REQUIRE (!wait_for_jobs());
+
+ left->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT);
+ left->set_position (film, DCPTime());
+ right->video->set_frame_type (VIDEO_FRAME_TYPE_3D_RIGHT);
+ right->set_position (film, DCPTime());
+ film->set_three_d (true);
+
+ film->make_dcp ();
+ BOOST_REQUIRE (!wait_for_jobs());
+
+ shared_ptr<Film> film2 = new_test_film2 ("player_3d_test_1b");
+ shared_ptr<Content> dcp(new DCPContent(film->dir(film->dcp_name())));
+ film2->examine_and_add_content (dcp);
+ BOOST_REQUIRE (!wait_for_jobs());
+
+ film2->set_three_d (true);
+ film2->make_dcp ();
+ BOOST_REQUIRE (!wait_for_jobs());
+}
+
+/** Test a crash when processing a 3D DCP as content in a 2D project */
+BOOST_AUTO_TEST_CASE (player_3d_test_2)
+{
+ shared_ptr<Film> film = new_test_film2 ("player_3d_test_2a");
+ shared_ptr<Content> left = content_factory("test/data/flat_red.png").front();
+ film->examine_and_add_content (left);
+ shared_ptr<Content> right = content_factory("test/data/flat_blue.png").front();
+ film->examine_and_add_content (right);
+ BOOST_REQUIRE (!wait_for_jobs());
+
+ left->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT);
+ left->set_position (film, DCPTime());
+ right->video->set_frame_type (VIDEO_FRAME_TYPE_3D_RIGHT);
+ right->set_position (film, DCPTime());
+ film->set_three_d (true);
+
+ film->make_dcp ();
+ BOOST_REQUIRE (!wait_for_jobs());
+
+ shared_ptr<Film> film2 = new_test_film2 ("player_3d_test_2b");
+ shared_ptr<Content> dcp(new DCPContent(film->dir(film->dcp_name())));
+ film2->examine_and_add_content (dcp);
+ BOOST_REQUIRE (!wait_for_jobs());
+
+ film2->make_dcp ();
+ BOOST_REQUIRE (!wait_for_jobs());
+}
+