Speed up hints tests by not running a pointless audio analysis.
authorCarl Hetherington <cth@carlh.net>
Sun, 9 Jan 2022 22:44:00 +0000 (23:44 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 11 Jan 2022 08:15:51 +0000 (09:15 +0100)
src/lib/hints.cc
src/lib/hints.h
test/hints_test.cc

index 46704ebf817ae8d19118efc0baba1c90837c8421..40b51e81791544e70a6bdba7d7466dcfc605d4da 100644 (file)
@@ -407,7 +407,7 @@ try
 
        auto player = make_shared<Player>(film, Image::Alignment::COMPACT);
        player->set_ignore_video ();
 
        auto player = make_shared<Player>(film, Image::Alignment::COMPACT);
        player->set_ignore_video ();
-       if (check_loudness_done) {
+       if (check_loudness_done || _disable_audio_analysis) {
                /* We don't need to analyse audio because we already loaded a suitable analysis */
                player->set_ignore_audio ();
        }
                /* We don't need to analyse audio because we already loaded a suitable analysis */
                player->set_ignore_audio ();
        }
index 2a5e8d4a024f4ba28148c7a42a80b2bcd61d3c2e..6553593a06e761da7b908ce1949f5dc3fc06fa58 100644 (file)
@@ -51,6 +51,9 @@ public:
 
        /* For tests only */
        void join ();
 
        /* For tests only */
        void join ();
+       void disable_audio_analysis () {
+               _disable_audio_analysis = true;
+       }
 
 private:
        friend struct hint_subtitle_too_early;
 
 private:
        friend struct hint_subtitle_too_early;
@@ -103,4 +106,6 @@ private:
        boost::optional<dcpomatic::DCPTimePeriod> _last_subtitle;
 
        boost::atomic<bool> _stop;
        boost::optional<dcpomatic::DCPTimePeriod> _last_subtitle;
 
        boost::atomic<bool> _stop;
+
+       bool _disable_audio_analysis = false;
 };
 };
index 263f02435a70a4a419718aea3209b93ec84ef6c7..c228cd07af4c6b38089c259dd9242a0b0785b20f 100644 (file)
@@ -56,6 +56,8 @@ get_hints (shared_ptr<Film> film)
 {
        current_hints.clear ();
        Hints hints (film);
 {
        current_hints.clear ();
        Hints hints (film);
+       /* None of our tests need the audio analysis, and it is quite time-consuming */
+       hints.disable_audio_analysis ();
        hints.Hint.connect (collect_hint);
        hints.start ();
        hints.join ();
        hints.Hint.connect (collect_hint);
        hints.start ();
        hints.join ();