summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-09-29 10:17:50 +0200
committerCarl Hetherington <cth@carlh.net>2023-09-14 22:27:41 +0200
commit6a7b01a6703ce2f19dd3a2bf104e0ccd39150dc9 (patch)
treee832aa772f86f626e03e75ac99968d3b72212b27 /test
parent856fd1dd53b6f4cdb1215847ad44b2a211a5b96f (diff)
Change how video timing is done.
This commit changes the approach with video timing. Previously, we would (more-or-less) try to use every video frame from the content in the output, hoping that they come at a constant frame rate. This is not always the case, however. Here we preserve the PTS of video frames, and then when one arrives we output whatever DCP video frames we can (at the regular DCP frame rate). Hopefully this will solve a range of sync problems, but it could also introduce new ones.
Diffstat (limited to 'test')
-rw-r--r--test/client_server_test.cc9
-rw-r--r--test/content_test.cc2
-rw-r--r--test/ffmpeg_decoder_seek_test.cc55
-rw-r--r--test/low_bitrate_test.cc3
-rw-r--r--test/shuffler_test.cc8
5 files changed, 57 insertions, 20 deletions
diff --git a/test/client_server_test.cc b/test/client_server_test.cc
index 596668aae..4f5015fc8 100644
--- a/test/client_server_test.cc
+++ b/test/client_server_test.cc
@@ -51,6 +51,7 @@ using std::weak_ptr;
using boost::thread;
using boost::optional;
using dcp::ArrayData;
+using namespace dcpomatic;
void
@@ -105,7 +106,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_rgb)
ColourConversion(),
VideoRange::FULL,
weak_ptr<Content>(),
- optional<Frame>(),
+ optional<ContentTime>(),
false
);
@@ -184,7 +185,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_yuv)
ColourConversion(),
VideoRange::FULL,
weak_ptr<Content>(),
- optional<Frame>(),
+ optional<ContentTime>(),
false
);
@@ -250,7 +251,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k)
ColourConversion(),
VideoRange::FULL,
weak_ptr<Content>(),
- optional<Frame>(),
+ optional<ContentTime>(),
false
);
@@ -275,7 +276,7 @@ BOOST_AUTO_TEST_CASE (client_server_test_j2k)
PresetColourConversion::all().front().conversion,
VideoRange::FULL,
weak_ptr<Content>(),
- optional<Frame>(),
+ optional<ContentTime>(),
false
);
diff --git a/test/content_test.cc b/test/content_test.cc
index 47099025e..7982f594e 100644
--- a/test/content_test.cc
+++ b/test/content_test.cc
@@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE (content_test6)
film->set_audio_channels(16);
make_and_verify_dcp (film);
- check_dcp (TestPaths::private_data() / "fha", film);
+ check_dcp (TestPaths::private_data() / "v2.18.x" / "fha", film);
cl.run ();
}
diff --git a/test/ffmpeg_decoder_seek_test.cc b/test/ffmpeg_decoder_seek_test.cc
index 4dceae86b..f38ef3564 100644
--- a/test/ffmpeg_decoder_seek_test.cc
+++ b/test/ffmpeg_decoder_seek_test.cc
@@ -64,18 +64,18 @@ store (ContentVideo v)
static void
-check (shared_ptr<FFmpegDecoder> decoder, int frame)
+check (shared_ptr<FFmpegDecoder> decoder, ContentTime time)
{
BOOST_REQUIRE (decoder->ffmpeg_content()->video_frame_rate ());
- decoder->seek (ContentTime::from_frames (frame, decoder->ffmpeg_content()->video_frame_rate().get()), true);
+ decoder->seek(time, true);
stored = optional<ContentVideo> ();
while (!decoder->pass() && !stored) {}
- BOOST_CHECK (stored->frame <= frame);
+ BOOST_CHECK(stored->time <= time);
}
static void
-test (boost::filesystem::path file, vector<int> frames)
+test (boost::filesystem::path file, vector<ContentTime> times)
{
auto path = TestPaths::private_data() / file;
BOOST_REQUIRE (boost::filesystem::exists (path));
@@ -87,7 +87,7 @@ test (boost::filesystem::path file, vector<int> frames)
auto decoder = make_shared<FFmpegDecoder>(film, content, false);
decoder->video->Data.connect (bind (&store, _1));
- for (auto i: frames) {
+ for (auto i: times) {
check (decoder, i);
}
}
@@ -95,10 +95,43 @@ test (boost::filesystem::path file, vector<int> frames)
BOOST_AUTO_TEST_CASE (ffmpeg_decoder_seek_test)
{
- vector<int> frames = { 0, 42, 999, 0 };
-
- test ("boon_telly.mkv", frames);
- test ("Sintel_Trailer1.480p.DivX_Plus_HD.mkv", frames);
- test ("prophet_long_clip.mkv", { 15, 42, 999, 15 });
- test ("dolby_aurora.vob", { 0, 125, 250, 41 });
+ test(
+ "boon_telly.mkv",
+ {
+ ContentTime::from_frames(0, 29.97),
+ ContentTime::from_frames(42, 29.97),
+ ContentTime::from_frames(999, 29.97),
+ ContentTime::from_frames(0, 29.97),
+ }
+ );
+
+ test(
+ "Sintel_Trailer1.480p.DivX_Plus_HD.mkv",
+ {
+ ContentTime::from_frames(0, 24),
+ ContentTime::from_frames(42, 24),
+ ContentTime::from_frames(999, 24),
+ ContentTime::from_frames(0, 24),
+ }
+ );
+
+ test(
+ "prophet_long_clip.mkv",
+ {
+ ContentTime::from_frames(15, 23.976),
+ ContentTime::from_frames(42, 23.976),
+ ContentTime::from_frames(999, 23.976),
+ ContentTime::from_frames(15, 23.976)
+ }
+ );
+
+ test(
+ "dolby_aurora.vob",
+ {
+ ContentTime::from_frames(0, 25),
+ ContentTime::from_frames(125, 25),
+ ContentTime::from_frames(250, 25),
+ ContentTime::from_frames(41, 25)
+ }
+ );
}
diff --git a/test/low_bitrate_test.cc b/test/low_bitrate_test.cc
index 7050dd771..52b8d54be 100644
--- a/test/low_bitrate_test.cc
+++ b/test/low_bitrate_test.cc
@@ -31,6 +31,7 @@ extern "C" {
using std::make_shared;
+using namespace dcpomatic;
BOOST_AUTO_TEST_CASE (low_bitrate_test)
@@ -51,7 +52,7 @@ BOOST_AUTO_TEST_CASE (low_bitrate_test)
boost::optional<ColourConversion>(),
VideoRange::FULL,
std::weak_ptr<Content>(),
- boost::optional<Frame>(),
+ boost::optional<ContentTime>(),
false
);
diff --git a/test/shuffler_test.cc b/test/shuffler_test.cc
index 2099a0923..37d6749c3 100644
--- a/test/shuffler_test.cc
+++ b/test/shuffler_test.cc
@@ -33,14 +33,15 @@ using boost::optional;
#if BOOST_VERSION >= 106100
using namespace boost::placeholders;
#endif
+using namespace dcpomatic;
static void
-push (Shuffler& s, int frame, Eyes eyes)
+push(Shuffler& s, int frame, Eyes eyes)
{
auto piece = make_shared<Piece>(shared_ptr<Content>(), shared_ptr<Decoder>(), FrameRateChange(24, 24));
ContentVideo cv;
- cv.frame = frame;
+ cv.time = ContentTime::from_frames(frame, 24);
cv.eyes = eyes;
s.video (piece, cv);
}
@@ -56,8 +57,9 @@ receive (weak_ptr<Piece>, ContentVideo cv)
static void
check (int frame, Eyes eyes, int line)
{
+ auto const time = ContentTime::from_frames(frame, 24);
BOOST_REQUIRE_MESSAGE (!pending_cv.empty(), "Check at " << line << " failed.");
- BOOST_CHECK_MESSAGE (pending_cv.front().frame == frame, "Check at " << line << " failed.");
+ BOOST_CHECK_MESSAGE (pending_cv.front().time == time, "Check at " << line << " failed.");
BOOST_CHECK_MESSAGE (pending_cv.front().eyes == eyes, "Check at " << line << " failed.");
pending_cv.pop_front();
}