From c20b1952c9a3187b91ce49423fa8093fcf9661bc Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 22 Feb 2017 14:09:50 +0000 Subject: [PATCH] More fixes to when to pull from the audio merger. --- src/lib/player.cc | 17 ++++++++++++----- src/lib/transcoder.cc | 1 - 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/lib/player.cc b/src/lib/player.cc index eeeef2cb3..0011f7ab2 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -146,6 +146,14 @@ Player::setup_pieces () } } + BOOST_FOREACH (shared_ptr i, _pieces) { + if (i->content->audio) { + BOOST_FOREACH (AudioStreamPtr j, i->content->audio->streams()) { + _stream_states[j] = StreamState (i, i->content->position ()); + } + } + } + _have_valid_pieces = true; } @@ -555,6 +563,7 @@ Player::pass () } } +// cout << "PULL " << to_string(pull_from) << "\n"; pair, DCPTime> audio = _audio_merger.pull (pull_from); if (audio.first->frames() > 0) { DCPOMATIC_ASSERT (audio.second >= _last_audio_time); @@ -740,13 +749,11 @@ Player::audio (weak_ptr wp, AudioStreamPtr stream, ContentAudio content_a content_audio.audio = _audio_processor->run (content_audio.audio, _film->audio_channels ()); } +// cout << "PUSH " << content_audio.audio->frames() << " @ " << to_string(time) << "\n"; _audio_merger.push (content_audio.audio, time); - if (_stream_states.find (stream) == _stream_states.end ()) { - _stream_states[stream] = StreamState (piece, time); - } else { - _stream_states[stream].last_push_end = time + DCPTime::from_frames (content_audio.audio->frames(), _film->audio_frame_rate()); - } + DCPOMATIC_ASSERT (_stream_states.find (stream) != _stream_states.end ()); + _stream_states[stream].last_push_end = time + DCPTime::from_frames (content_audio.audio->frames(), _film->audio_frame_rate()); } void diff --git a/src/lib/transcoder.cc b/src/lib/transcoder.cc index e2bbca98e..de2fb1d33 100644 --- a/src/lib/transcoder.cc +++ b/src/lib/transcoder.cc @@ -115,7 +115,6 @@ Transcoder::video (shared_ptr data, DCPTime time) void Transcoder::audio (shared_ptr data, DCPTime time) { - cout << "tx receives " << data->frames() << " @ " << to_string(time) << "\n"; _writer->write (data); shared_ptr job = _job.lock (); -- 2.30.2