From 7d0cd227fa8cf13b04504af22301521dc231c0c7 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 19 Nov 2022 17:16:38 +0100 Subject: 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. --- test/player_test.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/player_test.cc') 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_")); +} + -- cgit v1.2.3