summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-05-18 20:23:42 +0100
committerCarl Hetherington <cth@carlh.net>2017-05-18 20:23:42 +0100
commit86b7c0df8ddd747f250d63eeb58656219a4ad3f5 (patch)
tree779e82ecb35f8bc1c39cfab90642e3ca16d23d63 /src/lib
parentacfa8152b7bc4b55e1791d28b4c0999fe9781222 (diff)
Fix order of pass/fill; only round up at the end of the playlist, not on every fill.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/player.cc30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 0c9bcf363..1d78dbcdf 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -527,21 +527,10 @@ Player::pass ()
}
}
- if (earliest) {
- earliest->done = earliest->decoder->pass ();
- if (earliest->done && earliest->content->audio) {
- /* Flush the Player audio system for this piece */
- BOOST_FOREACH (AudioStreamPtr i, earliest->content->audio->streams()) {
- audio_flush (earliest, i);
- }
- }
- }
-
/* Fill towards the next thing that might happen (or the end of the playlist). This is to fill gaps between content,
NOT to fill gaps within content (the latter is done in ::video())
*/
- DCPTime fill_towards = earliest ? earliest_content : _playlist->length();
- fill_towards = fill_towards.ceil (_film->video_frame_rate ());
+ DCPTime fill_towards = earliest ? earliest_content : _playlist->length().ceil(_film->video_frame_rate());
/* Work out where to fill video from */
optional<DCPTime> video_fill_from;
@@ -572,19 +561,28 @@ Player::pass ()
audio_fill_from = _last_audio_time;
}
- /* XXX: _no_audio */
if (audio_fill_from && audio_fill_from < fill_towards) {
DCPTimePeriod period (*audio_fill_from, fill_towards);
if (period.duration() > one_video_frame()) {
period.to = period.from + one_video_frame();
}
- list<DCPTimePeriod> p = subtract(period, _no_video);
+ list<DCPTimePeriod> p = subtract(period, _no_audio);
if (!p.empty ()) {
fill_audio (p.front());
}
filled = true;
}
+ if (earliest) {
+ earliest->done = earliest->decoder->pass ();
+ if (earliest->done && earliest->content->audio) {
+ /* Flush the Player audio system for this piece */
+ BOOST_FOREACH (AudioStreamPtr i, earliest->content->audio->streams()) {
+ audio_flush (earliest, i);
+ }
+ }
+ }
+
/* Emit any audio that is ready */
DCPTime pull_to = _playlist->length ();
@@ -1019,6 +1017,10 @@ Player::emit_audio (shared_ptr<AudioBuffers> data, DCPTime time)
void
Player::fill_audio (DCPTimePeriod period)
{
+ if (period.from == period.to) {
+ return;
+ }
+
BOOST_FOREACH (DCPTimePeriod i, subtract(period, _no_audio)) {
DCPTime t = i.from;
while (t < i.to) {