diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-05-16 09:58:58 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-05-16 09:58:58 +0100 |
| commit | 04f704a03de9641ae60aca6c5bf0637db270a170 (patch) | |
| tree | b31035329a0fbc1224c5161288ea2e9769f5af17 /src/lib | |
| parent | 27d63cb95a5cbe2c58f45717e9482f3395a896fb (diff) | |
Fix missing pad of gaps caused by delays in audio content at the start of a Film. Rename pull_from -> pull_to.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/player.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc index a711c80c0..8ebeb236d 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -584,20 +584,16 @@ Player::pass () filled = true; } - if (!earliest && !filled) { - return true; - } - /* Emit any audio that is ready */ - DCPTime pull_from = _playlist->length (); + DCPTime pull_to = _playlist->length (); for (map<AudioStreamPtr, StreamState>::const_iterator i = _stream_states.begin(); i != _stream_states.end(); ++i) { - if (!i->second.piece->done && i->second.last_push_end < pull_from) { - pull_from = i->second.last_push_end; + if (!i->second.piece->done && i->second.last_push_end < pull_to) { + pull_to = i->second.last_push_end; } } - list<pair<shared_ptr<AudioBuffers>, DCPTime> > audio = _audio_merger.pull (pull_from); + list<pair<shared_ptr<AudioBuffers>, DCPTime> > audio = _audio_merger.pull (pull_to); for (list<pair<shared_ptr<AudioBuffers>, DCPTime> >::iterator i = audio.begin(); i != audio.end(); ++i) { if (_last_audio_time && i->second < *_last_audio_time) { /* There has been an accurate seek and we have received some audio before the seek time; @@ -617,7 +613,7 @@ Player::pass () emit_audio (i->first, i->second); } - return false; + return !earliest && !filled; } optional<PositionImage> @@ -808,6 +804,13 @@ Player::audio (weak_ptr<Piece> wp, AudioStreamPtr stream, ContentAudio content_a /* And the end of this block in the DCP */ DCPTime end = time + DCPTime::from_frames(content_audio.audio->frames(), content->resampled_frame_rate()); + /* Pad any gap which may be caused by audio delay */ + if (_last_audio_time) { + fill_audio (DCPTimePeriod (*_last_audio_time, time)); + } else if (_last_seek_time && _last_seek_accurate) { + fill_audio (DCPTimePeriod (*_last_seek_time, time)); + } + /* Remove anything that comes before the start or after the end of the content */ if (time < piece->content->position()) { pair<shared_ptr<AudioBuffers>, DCPTime> cut = discard_audio (content_audio.audio, time, piece->content->position()); |
