summaryrefslogtreecommitdiff
path: root/test/player_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-11-19 17:16:38 +0100
committerCarl Hetherington <cth@carlh.net>2022-11-25 23:42:55 +0100
commit7d0cd227fa8cf13b04504af22301521dc231c0c7 (patch)
tree452317c14a2227aa80c67b8d06bb70b3a675b5bb /test/player_test.cc
parentc80cca033afbb73ae790dd94d506acbfb9fa7a57 (diff)
Fix sound corruption with multiple sound files (#2368).
last_push_end would be initialised to the position of the content, meaning that content at (for example) 60s into the project would be treated as the leader, and content much earlier would then be considered finished by the code which checks ignore_streams_behind (as its last push was more then 5s before the leader). This caused audio corruption, shown up by the test here.
Diffstat (limited to 'test/player_test.cc')
-rw-r--r--test/player_test.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/player_test.cc b/test/player_test.cc
index 6b29cbc30..1cab293f1 100644
--- a/test/player_test.cc
+++ b/test/player_test.cc
@@ -28,10 +28,12 @@
#include "lib/audio_buffers.h"
#include "lib/butler.h"
#include "lib/compose.hpp"
+#include "lib/config.h"
#include "lib/content_factory.h"
#include "lib/cross.h"
#include "lib/dcp_content.h"
#include "lib/dcp_content_type.h"
+#include "lib/dcpomatic_log.h"
#include "lib/ffmpeg_content.h"
#include "lib/film.h"
#include "lib/image_content.h"
@@ -538,3 +540,20 @@ BOOST_AUTO_TEST_CASE (interleaved_subtitle_are_emitted_correctly)
while (!player.pass()) {}
}
+
+BOOST_AUTO_TEST_CASE(multiple_sound_files_bug)
+{
+ Config::instance()->set_log_types(Config::instance()->log_types() | LogEntry::TYPE_DEBUG_PLAYER);
+
+ auto A = content_factory(TestPaths::private_data() / "kook" / "1.wav").front();
+ auto B = content_factory(TestPaths::private_data() / "kook" / "2.wav").front();
+ auto C = content_factory(TestPaths::private_data() / "kook" / "3.wav").front();
+
+ auto film = new_test_film2("multiple_sound_files_bug", { A, B, C });
+ C->set_position(film, DCPTime(3840000));
+
+ make_and_verify_dcp(film, { dcp::VerificationNote::Code::MISSING_CPL_METADATA });
+
+ check_mxf_audio_file(TestPaths::private_data() / "kook" / "reference.mxf", dcp_file(film, "pcm_"));
+}
+