Tidy up _last_video_time to make it more like _last_audio_time.
authorCarl Hetherington <cth@carlh.net>
Sun, 23 Apr 2017 22:11:48 +0000 (23:11 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 23 Apr 2017 22:11:48 +0000 (23:11 +0100)
src/lib/player.cc
src/lib/player.h

index 28c8fc7f7ab78230ac4ab24e1af46590ac285765..a090b7c26f6e0d536537ab1f6a23cefa51b00bc4 100644 (file)
@@ -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<Piece> 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<Piece> 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<Piece> 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<DCPTime> ();
index dec4529ba823beaabafb4f658cd6b11a2faf348c..684de53f5b46d56290a64615e0eb488e9966fe77 100644 (file)
@@ -140,11 +140,12 @@ private:
 
        /** Last PlayerVideo that was emitted */
        boost::shared_ptr<PlayerVideo> _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<DCPTime> _last_video_time;
+       /** Time just after the last audio frame we emitted, or the last seek time */
+       boost::optional<DCPTime> _last_audio_time;
 
        AudioMerger _audio_merger;
-       boost::optional<DCPTime> _last_audio_time;
 
        class StreamState {
        public: