/*
- 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;
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.
*/
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());
+}