Add some tolerance when checking audio references.
authorCarl Hetherington <cth@carlh.net>
Tue, 13 Feb 2018 10:47:22 +0000 (10:47 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 13 Feb 2018 10:47:22 +0000 (10:47 +0000)
test/ffmpeg_encoder_test.cc
test/test.cc
test/test.h

index df64a2c486dce626c95006206753b48b427f30a3..c847619d976e1835a9de6cb508980004e1a59593 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2017-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -221,8 +221,5 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_basic_test_mixdown)
        FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_basic_test_mixdown.mp4", FFmpegEncoder::FORMAT_H264, true);
        encoder.go ();
 
-       /* Skip the first video packet when checking as it contains x264 options which can vary between machines
-          (e.g. number of threads used for encoding).
-       */
-       check_ffmpeg ("build/test/ffmpeg_encoder_basic_test_mixdown.mp4", "test/data/ffmpeg_encoder_basic_test_mixdown.mp4");
+       check_ffmpeg ("build/test/ffmpeg_encoder_basic_test_mixdown.mp4", "test/data/ffmpeg_encoder_basic_test_mixdown.mp4", 1);
 }
index 551f64dbde9bd74755e6672a6af4ce7724922cb7..f829a86f6892b5c441ba130b8e91ad6aedd08a2c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -34,6 +34,8 @@
 #include "lib/ratio.h"
 #include "lib/dcp_content_type.h"
 #include "lib/log_entry.h"
+#include "lib/compose.hpp"
+#include "test.h"
 #include <dcp/dcp.h>
 #include <dcp/cpl.h>
 #include <dcp/reel.h>
@@ -436,9 +438,9 @@ write_image (shared_ptr<const Image> image, boost::filesystem::path file, string
 }
 
 void
-check_ffmpeg (boost::filesystem::path ref, boost::filesystem::path check)
+check_ffmpeg (boost::filesystem::path ref, boost::filesystem::path check, int audio_tolerance)
 {
-       int const r = system (string("ffcmp " + ref.string() + " " + check.string()).c_str());
+       int const r = system (String::compose("ffcmp -t %1 %2 %3", audio_tolerance, ref.string(), check.string()).c_str());
        BOOST_REQUIRE_EQUAL (WEXITSTATUS(r), 0);
 }
 
index ff5a2a34ed66d693be94970f849955abc98f68cf..78fa26b4361497f39f34dab478f2bff6cdfa8042 100644 (file)
@@ -35,7 +35,7 @@ extern void check_wav_file (boost::filesystem::path ref, boost::filesystem::path
 extern void check_mxf_audio_file (boost::filesystem::path ref, boost::filesystem::path check);
 extern void check_xml (boost::filesystem::path, boost::filesystem::path, std::list<std::string>);
 extern void check_file (boost::filesystem::path, boost::filesystem::path);
-extern void check_ffmpeg (boost::filesystem::path, boost::filesystem::path);
+extern void check_ffmpeg (boost::filesystem::path, boost::filesystem::path, int audio_tolerance);
 extern void check_image (boost::filesystem::path, boost::filesystem::path);
 extern boost::filesystem::path test_film_dir (std::string);
 extern void write_image (boost::shared_ptr<const Image> image, boost::filesystem::path file, std::string format);