diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-05-21 22:16:55 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-05-21 22:16:55 +0200 |
| commit | 60817309adf931b0e76b52e0ba35190a21cb6d9e (patch) | |
| tree | 3b2509dc9569efde6da5bb7dca664af03279eb44 | |
| parent | 96107588e0ddf383d21ff00b4d3febb313e43794 (diff) | |
Fix error when loading encrypted DCPs (#2257).
In d1b4dbb793e2850d032ce3c91f0c91d045ae19dc I changed have_video()
to look at can_be_played() but forgot to also change have_audio().
| -rw-r--r-- | src/lib/player.cc | 2 | ||||
| -rw-r--r-- | test/player_test.cc | 31 |
2 files changed, 32 insertions, 1 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc index f3d78ab32..0f72ed858 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -154,7 +154,7 @@ have_video (shared_ptr<const Content> content) bool have_audio (shared_ptr<const Content> content) { - return static_cast<bool>(content->audio); + return static_cast<bool>(content->audio) && content->can_be_played(); } diff --git a/test/player_test.cc b/test/player_test.cc index 3fb8691a5..03f2eb6e6 100644 --- a/test/player_test.cc +++ b/test/player_test.cc @@ -466,3 +466,34 @@ BOOST_AUTO_TEST_CASE (player_silence_at_end_crash) film2->set_video_frame_rate (24); make_and_verify_dcp (film2); } + + +/** #2257 */ +BOOST_AUTO_TEST_CASE (encrypted_dcp_with_no_kdm_gives_no_butler_error) +{ + auto content = content_factory("test/data/flat_red.png").front(); + auto film = new_test_film2 ("encrypted_dcp_with_no_kdm_gives_no_butler_error", { content }); + int constexpr length = 24 * 25; + content->video->set_length(length); + film->set_encrypted (true); + make_and_verify_dcp ( + film, + { + dcp::VerificationNote::Code::MISSING_CPL_METADATA, + }); + + auto content2 = std::make_shared<DCPContent>(film->dir(film->dcp_name())); + auto film2 = new_test_film2 ("encrypted_dcp_with_no_kdm_gives_no_butler_error2", { content2 }); + + auto player = std::make_shared<Player>(film2, Image::Alignment::COMPACT); + Butler butler(film2, player, AudioMapping(), 2, bind(PlayerVideo::force, AV_PIX_FMT_RGB24), VideoRange::FULL, Image::Alignment::PADDED, true, false); + + float buffer[2000 * 6]; + for (int i = 0; i < length; ++i) { + butler.get_video(Butler::Behaviour::BLOCKING, 0); + butler.get_audio(Butler::Behaviour::BLOCKING, buffer, 2000); + } + + BOOST_CHECK_NO_THROW(butler.rethrow()); +} + |
