diff options
| author | Carl Hetherington <cth@carlh.net> | 2026-04-21 22:26:25 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2026-04-21 22:26:25 +0200 |
| commit | 824350b6e66ce7ef8a5449b60ce1abb2e4f462a5 (patch) | |
| tree | 59ea72b921132ba29407508d0868d98b95ca2167 /test | |
| parent | 194561797b00e07e61db611123a7f320819cdb19 (diff) | |
Fix bug causing mangled audio analyses in some cases (#3155).
The duplicate ID detection was broken due to using the video stream
index rather than its ID for checks.
Diffstat (limited to 'test')
| -rw-r--r-- | test/audio_analysis_test.cc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/audio_analysis_test.cc b/test/audio_analysis_test.cc index 8e04945ac..578250b2c 100644 --- a/test/audio_analysis_test.cc +++ b/test/audio_analysis_test.cc @@ -40,6 +40,7 @@ #include "lib/playlist.h" #include "lib/ratio.h" #include "test.h" +#include <dcp/scope_guard.h> #include <boost/test/unit_test.hpp> #include <numeric> @@ -315,3 +316,38 @@ BOOST_AUTO_TEST_CASE(ebur128_test) } #endif + +static bool saw_ffmpeg_error = false; + +static +void +test_log_callback(void*, int level, const char*, va_list) +{ + if (level <= AV_LOG_WARNING) { + saw_ffmpeg_error = true; + } +} + + +/* The file in this test has the audio stream as index 0, video as 1, + * with both streams having the same ID. This triggered a bug where + * on analysis (with video disabled) the video packets would be fed + * to the audio decoder, causing chaos manifesting as many audio decoder + * errors. + */ +BOOST_AUTO_TEST_CASE(analysis_stream_confusion_test) +{ + auto sound = content_factory(TestPaths::private_data() / "ge.mkv")[0]; + auto film = new_test_film("analysis_stream_confusion_test", { sound }); + + av_log_set_callback(test_log_callback); + dcp::ScopeGuard sg = []() { + capture_ffmpeg_logs(); + }; + + auto job = make_shared<AnalyseAudioJob>(film, film->playlist(), true); + JobManager::instance()->add(job); + BOOST_REQUIRE(!wait_for_jobs()); + + BOOST_CHECK(!saw_ffmpeg_error); +} |
