summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-04-23 23:11:48 +0100
committerCarl Hetherington <cth@carlh.net>2017-04-23 23:11:48 +0100
commit1bb2e84e9a0037b95bd938abf0955176058a5977 (patch)
tree1668d45210f3bade40e0b702edba0b71d8c9d08e /src/lib
parentd24479e588b88e32bb4cd077d1648b7d043b5e07 (diff)
Tidy up _last_video_time to make it more like _last_audio_time.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/player.cc12
-rw-r--r--src/lib/player.h5
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<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> ();
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<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: