Increase fudge factor at the boundary between audio signal and silence.
[dcpomatic.git] / test / player_test.cc
index af40002deb06191af6cae40311395f68498de9a3..30b1a56dde93083ce6488f79e838142af2e953dc 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    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.
 
@@ -333,14 +333,28 @@ BOOST_AUTO_TEST_CASE (player_trim_crash)
        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());
+}