summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-05-19 22:51:46 +0200
committerCarl Hetherington <cth@carlh.net>2024-05-19 22:51:46 +0200
commit60fd98772b64dfc1195a34e5be7782675a150538 (patch)
tree451fa5cf44cd5f44d896a88a20008ffaa6c3050a
parentcb83b1ebba5d3eb9085a1b07beff2700606d8df0 (diff)
parent7f6cc5c6e151c32fce94181689cf740a011feafb (diff)
Merge remote-tracking branch 'origin/main' into v2.17.x
-rw-r--r--src/lib/dcp_decoder.cc2
-rw-r--r--src/lib/player.cc2
-rw-r--r--test/player_test.cc19
3 files changed, 21 insertions, 2 deletions
diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc
index e471a237f..84b51cae8 100644
--- a/src/lib/dcp_decoder.cc
+++ b/src/lib/dcp_decoder.cc
@@ -81,7 +81,7 @@ DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent
if (content->video) {
video = make_shared<VideoDecoder>(this, content);
}
- if (content->audio) {
+ if (content->audio && !content->audio->mapping().mapped_output_channels().empty()) {
audio = make_shared<AudioDecoder>(this, content->audio, fast);
}
for (auto i: content->text) {
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 9ba2f1cb0..98f0b027a 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -249,7 +249,7 @@ have_video (shared_ptr<const Content> content)
bool
have_audio (shared_ptr<const Content> content)
{
- return static_cast<bool>(content->audio) && content->can_be_played();
+ return static_cast<bool>(content->audio) && !content->audio->mapping().mapped_output_channels().empty() && content->can_be_played();
}
diff --git a/test/player_test.cc b/test/player_test.cc
index 530dfc770..5c6ef2617 100644
--- a/test/player_test.cc
+++ b/test/player_test.cc
@@ -30,6 +30,7 @@
#include "lib/butler.h"
#include "lib/compose.hpp"
#include "lib/config.h"
+#include "lib/constants.h"
#include "lib/content_factory.h"
#include "lib/cross.h"
#include "lib/dcp_content.h"
@@ -739,3 +740,21 @@ BOOST_AUTO_TEST_CASE(check_seek_with_no_video)
BOOST_CHECK(*earliest >= dcpomatic::DCPTime(60 * 60));
}
+
+BOOST_AUTO_TEST_CASE(unmapped_audio_does_not_raise_buffer_error)
+{
+ auto content = content_factory(TestPaths::private_data() / "arrietty_JP-EN.mkv")[0];
+ auto film = new_test_film2("unmapped_audio_does_not_raise_buffer_error", { content });
+
+ content->audio->set_mapping(AudioMapping(6 * 2, MAX_DCP_AUDIO_CHANNELS));
+
+ 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);
+
+ /* Wait for the butler thread to run for a while; in the case under test it will throw an exception because
+ * the video buffers are filled but no audio comes.
+ */
+ dcpomatic_sleep_seconds(10);
+ butler.rethrow();
+}
+