Supporters update.
[dcpomatic.git] / test / player_test.cc
index 6db90f2dd8f6f6301961aba605254e88de633def..a13b50352733ffc15d485e46011a5929079d8f70 100644 (file)
@@ -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"
@@ -142,7 +143,11 @@ BOOST_AUTO_TEST_CASE (player_black_fill_test)
        check /= "black_fill_test";
        check /= film->dcp_name();
 
-       check_dcp (ref.string(), check.string());
+       /* This test is concerned with the image, so we'll ignore any
+        * differences in sound between the DCP and the reference to avoid test
+        * failures for unrelated reasons.
+        */
+       check_dcp(ref.string(), check.string(), true);
 }
 
 
@@ -545,18 +550,23 @@ BOOST_AUTO_TEST_CASE (interleaved_subtitle_are_emitted_correctly)
 
 BOOST_AUTO_TEST_CASE(multiple_sound_files_bug)
 {
+       Cleanup cl;
+
        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 });
+       auto film = new_test_film2("multiple_sound_files_bug", { A, B, C }, &cl);
+       film->set_audio_channels(16);
        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_"));
+
+       cl.run();
 }
 
 
@@ -565,6 +575,7 @@ BOOST_AUTO_TEST_CASE(trimmed_sound_mix_bug_13)
        auto A = content_factory("test/data/sine_16_48_440_10.wav").front();
        auto B = content_factory("test/data/sine_16_44.1_440_10.wav").front();
        auto film = new_test_film2("trimmed_sound_mix_bug_13", { A, B });
+       film->set_audio_channels(16);
 
        A->set_position(film, DCPTime());
        A->audio->set_gain(-12);
@@ -592,6 +603,7 @@ BOOST_AUTO_TEST_CASE(trimmed_sound_mix_bug_13_frame_rate_change)
        A->set_video_frame_rate(film, 24);
        B->set_video_frame_rate(film, 24);
        film->set_video_frame_rate(25);
+       film->set_audio_channels(16);
 
        make_and_verify_dcp(film, { dcp::VerificationNote::Code::MISSING_CPL_METADATA });
        check_mxf_audio_file("test/data/trimmed_sound_mix_bug_13_frame_rate_change.mxf", dcp_file(film, "pcm_"));
@@ -699,3 +711,21 @@ BOOST_AUTO_TEST_CASE(three_d_in_two_d_chooses_left)
        while (!player->pass()) {}
 }
 
+
+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();
+}
+