From 167ff6413dcc32680b2b778303f659656c2a51df Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 18 Feb 2024 23:36:10 +0100 Subject: Reset _next_video_time when deciding to emit black. Otherwise if we inaccurately seek into an area with no video there will never be any content coming into ::video() which could reset _next_video_time. Then when a black frame is emitted using emit_video_until we will emit black frames from time 0 to the time of the inaccurate seek. --- test/player_test.cc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test') diff --git a/test/player_test.cc b/test/player_test.cc index 5120c0180..530dfc770 100644 --- a/test/player_test.cc +++ b/test/player_test.cc @@ -54,6 +54,7 @@ using std::cout; using std::list; using std::shared_ptr; using std::make_shared; +using std::vector; using boost::bind; using boost::optional; #if BOOST_VERSION >= 106100 @@ -710,3 +711,31 @@ BOOST_AUTO_TEST_CASE(three_d_in_two_d_chooses_left) while (!player->pass()) {} } + +BOOST_AUTO_TEST_CASE(check_seek_with_no_video) +{ + auto content = content_factory(TestPaths::private_data() / "Fight.Club.1999.720p.BRRip.x264-x0r.srt")[0]; + auto film = new_test_film2("check_seek_with_no_video", { content }); + auto player = std::make_shared(film, film->playlist()); + + boost::signals2::signal, dcpomatic::DCPTime)> Video; + + optional earliest; + + player->Video.connect( + [&earliest](shared_ptr, dcpomatic::DCPTime time) { + if (!earliest || time < *earliest) { + earliest = time; + } + }); + + player->seek(dcpomatic::DCPTime::from_seconds(60 * 60), false); + + for (int i = 0; i < 10; ++i) { + player->pass(); + } + + BOOST_REQUIRE(earliest); + BOOST_CHECK(*earliest >= dcpomatic::DCPTime(60 * 60)); +} + -- cgit v1.2.3