diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-11-09 13:00:05 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-11-09 13:00:05 +0100 |
| commit | bce90174eb9ac99029e11b44c2267ae245eee600 (patch) | |
| tree | 167456e7a9850253d238752914cc8bc1e63e40b6 /test/player_test.cc | |
| parent | 93dd1d53fd0f94a5856efdc97b90c57f5ddc2b8a (diff) | |
wip2882-hang
Diffstat (limited to 'test/player_test.cc')
| -rw-r--r-- | test/player_test.cc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/player_test.cc b/test/player_test.cc index a13b50352..c63266e34 100644 --- a/test/player_test.cc +++ b/test/player_test.cc @@ -729,3 +729,51 @@ BOOST_AUTO_TEST_CASE(unmapped_audio_does_not_raise_buffer_error) butler.rethrow(); } + +/* Test #2882: skipping back with a particular file would kill the butler because no video frames were decoded */ +BOOST_AUTO_TEST_CASE(no_video_on_seek) +{ + auto content = content_factory(TestPaths::private_data() / "00015-remux.ts")[0]; + auto film = new_test_film2("no_video_on_seek", { content }); + + Player player(film, Image::Alignment::COMPACT); + Butler butler(film, player, AudioMapping(), 2, bind(PlayerVideo::force, AV_PIX_FMT_RGB24), VideoRange::FULL, Image::Alignment::PADDED, true, false, Butler::Audio::ENABLED); + + auto get_until = [&butler](dcpomatic::DCPTime const& time) { + dcpomatic::DCPTime video_time; + dcpomatic::DCPTime audio_time; + + auto constexpr frames = 2000; + std::vector<float> audio_data(frames * 6); + + while (video_time < time) { + if (video_time <= audio_time) { + Butler::Error error; + auto video = butler.get_video(Butler::Behaviour::BLOCKING, &error); + if (!video.first && error.code == Butler::Error::Code::FINISHED) { + break; + } + video_time = video.second; + } else { + auto audio = butler.get_audio(Butler::Behaviour::BLOCKING, audio_data.data(), frames); + if (audio) { + audio_time = *audio; + } + } + } + }; + + /* Simulate playing to the end */ + get_until(dcpomatic::DCPTime::from_seconds(200)); + + /* Skip around a bit */ + butler.seek(dcpomatic::DCPTime(6696000), false); + // dcpomatic_sleep_seconds(20); + dcpomatic_sleep_seconds(60); + butler.seek(dcpomatic::DCPTime(8956000), false); + // dcpomatic_sleep_seconds(20); + dcpomatic_sleep_seconds(60); + + /* See if the butler died */ + butler.rethrow(); +} |
