summaryrefslogtreecommitdiff
path: root/test/ffmpeg_decoder_seek_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-09-29 10:17:50 +0200
committerCarl Hetherington <cth@carlh.net>2022-10-04 23:20:11 +0200
commit0303a96b66eaf85060ce02d85cc36067f34b1051 (patch)
treecae8f9a013d18c3da77a9cc42655680613273b8a /test/ffmpeg_decoder_seek_test.cc
parent32294829b99fcbfa67e2b6b13b7a60d7244ff0ac (diff)
Change how video timing is done.v2.17.2
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/ffmpeg_decoder_seek_test.cc')
-rw-r--r--test/ffmpeg_decoder_seek_test.cc55
1 files changed, 44 insertions, 11 deletions
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)
+ }
+ );
}