summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-05-16 11:25:45 +0100
committerCarl Hetherington <cth@carlh.net>2017-05-16 11:25:45 +0100
commitd474df7f2f8c01ece7ded039fe4c926555677dc4 (patch)
tree671fef99690cdb169c10b1f1c8d0d5953d7cfe48
parent8142f2bc2e9cf757cb94753b1dda8f25b0ebaa22 (diff)
Fix failure to fill FFmpeg gaps at the start of films.
-rw-r--r--src/lib/player.cc9
-rw-r--r--test/ffmpeg_decoder_sequential_test.cc6
2 files changed, 11 insertions, 4 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 2fc062bb5..ad21bb9f1 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -670,9 +670,16 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
as in the problematic case we are about to emit a frame which is not contiguous with the previous.
*/
+ optional<DCPTime> fill_to;
if (_last_video_time) {
+ fill_to = _last_video_time;
+ } else if (_last_seek_time && _last_seek_accurate) {
+ fill_to = _last_seek_time;
+ }
+
+ if (fill_to) {
/* XXX: this may not work for 3D */
- BOOST_FOREACH (DCPTimePeriod i, subtract(DCPTimePeriod (*_last_video_time, time), _no_video)) {
+ BOOST_FOREACH (DCPTimePeriod i, subtract(DCPTimePeriod (*fill_to, time), _no_video)) {
for (DCPTime j = i.from; j < i.to; j += one_video_frame()) {
if (_last_video) {
emit_video (shared_ptr<PlayerVideo> (new PlayerVideo (*_last_video)), j);
diff --git a/test/ffmpeg_decoder_sequential_test.cc b/test/ffmpeg_decoder_sequential_test.cc
index 6bda8f260..67a825418 100644
--- a/test/ffmpeg_decoder_sequential_test.cc
+++ b/test/ffmpeg_decoder_sequential_test.cc
@@ -50,7 +50,7 @@ static DCPTime frame;
static void
check (shared_ptr<PlayerVideo>, DCPTime time)
{
- BOOST_CHECK (time == next);
+ BOOST_REQUIRE (time == next);
next += frame;
}
@@ -76,12 +76,12 @@ ffmpeg_decoder_sequential_test_one (boost::filesystem::path file, float fps, int
next = DCPTime ();
frame = DCPTime::from_frames (1, film->video_frame_rate ());
while (!player->pass()) {}
- BOOST_CHECK (next == DCPTime::from_frames (video_length, film->video_frame_rate()));
+ BOOST_REQUIRE (next == DCPTime::from_frames (video_length, film->video_frame_rate()));
}
BOOST_AUTO_TEST_CASE (ffmpeg_decoder_sequential_test)
{
- ffmpeg_decoder_sequential_test_one ("boon_telly.mkv", 29.97, 6911);
+ ffmpeg_decoder_sequential_test_one ("boon_telly.mkv", 29.97, 6912);
ffmpeg_decoder_sequential_test_one ("Sintel_Trailer1.480p.DivX_Plus_HD.mkv", 24, 1253);
ffmpeg_decoder_sequential_test_one ("prophet_clip.mkv", 23.976, 2879);
}