From 1bb2e84e9a0037b95bd938abf0955176058a5977 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 23 Apr 2017 23:11:48 +0100 Subject: [PATCH] Tidy up _last_video_time to make it more like _last_audio_time. --- src/lib/player.cc | 12 ++++++------ src/lib/player.h | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/lib/player.cc b/src/lib/player.cc index 28c8fc7f7..a090b7c26 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -554,7 +554,7 @@ Player::pass () /* No more content; fill up with silent black */ DCPTimePeriod remaining_video (DCPTime(), _playlist->length()); if (_last_video_time) { - remaining_video.from = _last_video_time.get() + one_video_frame(); + remaining_video.from = _last_video_time.get(); } fill_video (remaining_video); DCPTimePeriod remaining_audio (DCPTime(), _playlist->length()); @@ -624,7 +624,7 @@ Player::video (weak_ptr wp, ContentVideo video) DCPTimePeriod const period (time, time + one_video_frame()); /* Discard if it's outside the content's period or if it's before the last accurate seek */ - if (time < piece->content->position() || time >= piece->content->end() || (_last_video_time && time <= _last_video_time)) { + if (time < piece->content->position() || time >= piece->content->end() || (_last_video_time && time < _last_video_time)) { return; } @@ -658,7 +658,7 @@ Player::video (weak_ptr wp, ContentVideo video) /* Fill gaps */ if (_last_video_time) { - fill_video (DCPTimePeriod (_last_video_time.get() + one_video_frame(), time)); + fill_video (DCPTimePeriod (_last_video_time.get(), time)); } _last_video.reset ( @@ -680,9 +680,9 @@ Player::video (weak_ptr wp, ContentVideo video) _last_video->set_subtitle (subtitles.get ()); } - _last_video_time = time; + Video (_last_video, time); - Video (_last_video, *_last_video_time); + _last_video_time = time + one_video_frame (); /* Discard any subtitles we no longer need */ @@ -920,7 +920,7 @@ Player::seek (DCPTime time, bool accurate) } if (accurate) { - _last_video_time = time - one_video_frame (); + _last_video_time = time; _last_audio_time = time; } else { _last_video_time = optional (); diff --git a/src/lib/player.h b/src/lib/player.h index dec4529ba..684de53f5 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -140,11 +140,12 @@ private: /** Last PlayerVideo that was emitted */ boost::shared_ptr _last_video; - /** Time of the last video we emitted, or the last seek time */ + /** Time just after the last video frame we emitted, or the last seek time */ boost::optional _last_video_time; + /** Time just after the last audio frame we emitted, or the last seek time */ + boost::optional _last_audio_time; AudioMerger _audio_merger; - boost::optional _last_audio_time; class StreamState { public: -- 2.30.2