summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-02-11 13:10:48 +0100
committerCarl Hetherington <cth@carlh.net>2024-02-11 22:55:27 +0100
commit527093fa643049d370f4daee8206349981edbf95 (patch)
treef2d8e39174c64a059545c109beadce44369d857b /test
parent4d49c6e02b5226147058ca8015acf0ad1f440e9b (diff)
Fix apparently ineffective processors when analysing audio (#2671).
A whole film ("DCP side") analysis would behave the same as a single piece of content analysis if the film only had one piece of content. Here we also clarify that audio analysis of the whole film is different to that for a single piece of content; for the whole film we use processors, and for single pieces of content we do not.
Diffstat (limited to 'test')
-rw-r--r--test/audio_analysis_test.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/audio_analysis_test.cc b/test/audio_analysis_test.cc
index 8bdca4c32..8ded9eda9 100644
--- a/test/audio_analysis_test.cc
+++ b/test/audio_analysis_test.cc
@@ -41,6 +41,7 @@
#include "lib/ratio.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
+#include <numeric>
using std::make_shared;
@@ -283,3 +284,27 @@ BOOST_AUTO_TEST_CASE(analyse_audio_with_more_channels_than_film)
BOOST_CHECK(!wait_for_jobs());
}
+
+BOOST_AUTO_TEST_CASE(analyse_audio_uses_processor_when_analysing_whole_film)
+{
+ auto sound = content_factory(TestPaths::private_data() / "betty_stereo.wav")[0];
+ auto film = new_test_film2("analyse_audio_uses_processor_when_analysing_whole_film", { sound });
+
+ auto job = make_shared<AnalyseAudioJob>(film, film->playlist(), true);
+ JobManager::instance()->add(job);
+ BOOST_REQUIRE(!wait_for_jobs());
+
+ AudioAnalysis analysis(job->path());
+
+ BOOST_REQUIRE(analysis.channels() > 2);
+ bool centre_non_zero = false;
+ /* Make sure there's something from the mid-side decoder on the centre channel */
+ for (auto point = 0; point < analysis.points(2); ++point) {
+ if (std::abs(analysis.get_point(2, point)[AudioPoint::Type::PEAK]) > 0) {
+ centre_non_zero = true;
+ }
+ }
+
+ BOOST_CHECK(centre_non_zero);
+}
+