diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-04-23 23:08:37 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-04-23 23:08:37 +0100 |
| commit | d24479e588b88e32bb4cd077d1648b7d043b5e07 (patch) | |
| tree | ca078669edefb42159a0f087d7cb84ca352849e2 /src | |
| parent | 43d540854fe75e01292891a299f852407ff54d65 (diff) | |
Fix seeking; seek all decoders even if they have no content at the
seek position, and make Player cope with the FFmpegDecoder emitting
pre-roll data. This seems nicer than making FFmpegDecoder do it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/player.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc index e59451abe..28c8fc7f7 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -623,8 +623,8 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video) DCPTime const time = content_video_to_dcp (piece, video.frame); DCPTimePeriod const period (time, time + one_video_frame()); - /* Discard if it's outside the content's period */ - if (time < piece->content->position() || time >= piece->content->end()) { + /* 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)) { return; } @@ -915,9 +915,8 @@ Player::seek (DCPTime time, bool accurate) BOOST_FOREACH (shared_ptr<Piece> i, _pieces) { i->done = false; - if (i->content->position() <= time && time < i->content->end()) { - i->decoder->seek (dcp_to_content_time (i, time), accurate); - } + DCPTime const t = min(max(time, i->content->position()), i->content->end()); + i->decoder->seek (dcp_to_content_time (i, t), accurate); } if (accurate) { |
