summaryrefslogtreecommitdiff
path: root/src/lib/player.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-05-27 23:17:34 +0100
committerCarl Hetherington <cth@carlh.net>2013-05-27 23:17:34 +0100
commit90933dc804de225df47897ddd3a19c5a60ec67e0 (patch)
tree4ab78073ea1899b7bd7934b7c592e5f8e01c7c87 /src/lib/player.cc
parentf49d66270bff2577d39474a0c1c18a7a1b1f14f6 (diff)
Fix some DCP generation bugs and update some tests.
Diffstat (limited to 'src/lib/player.cc')
-rw-r--r--src/lib/player.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/player.cc b/src/lib/player.cc
index 34894ff0e..2926796ef 100644
--- a/src/lib/player.cc
+++ b/src/lib/player.cc
@@ -172,8 +172,8 @@ Player::process_audio (weak_ptr<Content> weak_content, shared_ptr<const AudioBuf
if (time > _next_audio) {
/* We can emit some audio from our buffers */
- assert (_film->time_to_audio_frames (time - _next_audio) <= _audio_buffers.frames());
OutputAudioFrame const N = _film->time_to_audio_frames (time - _next_audio);
+ assert (N <= _audio_buffers.frames());
shared_ptr<AudioBuffers> emit (new AudioBuffers (_audio_buffers.channels(), N));
emit->copy_from (&_audio_buffers, N, 0, 0);
Audio (emit, _next_audio);
@@ -189,6 +189,7 @@ Player::process_audio (weak_ptr<Content> weak_content, shared_ptr<const AudioBuf
/* Now accumulate the new audio into our buffers */
_audio_buffers.ensure_size (_audio_buffers.frames() + audio->frames());
_audio_buffers.accumulate_frames (audio.get(), 0, 0, audio->frames ());
+ _audio_buffers.set_frames (_audio_buffers.frames() + audio->frames());
}
/** @return true on error */
@@ -324,9 +325,11 @@ Player::setup_pieces ()
if (diff > 0) {
add_black_piece (video_pos, diff);
}
-
video_pos = (*i)->content->end();
- } else {
+ }
+
+ shared_ptr<AudioContent> ac = dynamic_pointer_cast<AudioContent> ((*i)->content);
+ if (ac && ac->audio_channels()) {
Time const diff = (*i)->content->start() - audio_pos;
if (diff > 0) {
add_silent_piece (video_pos, diff);