Put audio-gap padding in the right place (after the forthcoming audio has been checke...
authorCarl Hetherington <cth@carlh.net>
Wed, 17 May 2017 10:39:11 +0000 (11:39 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 17 May 2017 10:39:11 +0000 (11:39 +0100)
src/lib/player.cc

index f5a9d7b17a8ab8e68dd685573e37d3d79e9fa715..569806d8368085c69c97d6f765a8826d89c143c5 100644 (file)
@@ -767,6 +767,12 @@ Player::audio_transform (shared_ptr<AudioContent> content, AudioStreamPtr stream
                content_audio.audio = _audio_processor->run (content_audio.audio, _film->audio_channels ());
        }
 
+       /* Pad any gap which may be caused by audio delay */
+
+       if (_last_audio_time) {
+               fill_audio (DCPTimePeriod (*_last_audio_time, time));
+       }
+
        /* Push */
 
        _audio_merger.push (content_audio.audio, time);
@@ -803,11 +809,6 @@ 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));
-       }
-
        /* 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());