summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-12-07 02:17:34 +0100
committerCarl Hetherington <cth@carlh.net>2025-12-08 20:50:53 +0100
commit9bd8b3304f35f0b27bf18f2167302f1fd5d3f92b (patch)
treea500ed5d7a7247d10a25fdc26f130f3382756183 /test
parentdeacb9bae6893f4d40c7b68a098b72549176df7b (diff)
Try AVSEEK_FLAG_ANY if _BACKWARD fails.
We usually want to do _BACKWARD as this should seek to the keyframe before the seek position. On some files this fails, and then it seems that _ANY is a good next thing to try.
Diffstat (limited to 'test')
-rw-r--r--test/ffmpeg_decoder_seek_test.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ffmpeg_decoder_seek_test.cc b/test/ffmpeg_decoder_seek_test.cc
index 43967e458..ee0da99da 100644
--- a/test/ffmpeg_decoder_seek_test.cc
+++ b/test/ffmpeg_decoder_seek_test.cc
@@ -133,3 +133,22 @@ BOOST_AUTO_TEST_CASE(ffmpeg_decoder_seek_test)
}
);
}
+
+
+BOOST_AUTO_TEST_CASE(seek_when_backward_fails)
+{
+ auto content = make_shared<FFmpegContent>(TestPaths::private_data() / "strange_keyframes.mp4");
+ auto film = new_test_film("seek_when_backward_fails", { content });
+ auto decoder = make_shared<FFmpegDecoder>(film, content, false);
+ decoder->video->Data.connect(bind(&store, _1));
+
+ /* Due to a bug this seek would fail silently, giving us different frame each time */
+ for (auto i = 0; i < 3; ++i) {
+ decoder->seek(dcpomatic::ContentTime(), true);
+ stored = {};
+ while (!decoder->pass() && !stored) {}
+ BOOST_REQUIRE(static_cast<bool>(stored));
+ BOOST_CHECK(stored->time == dcpomatic::ContentTime());
+ }
+}
+