From ffb3cf8bfe397c87d0e797eb8732aa6b1f6c5091 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 17 Jan 2020 22:34:58 +0000 Subject: [PATCH] Debug. --- src/lib/audio_buffers.cc | 8 ++++++++ src/lib/audio_merger.cc | 3 +++ src/lib/player.cc | 3 +++ src/lib/writer.cc | 2 ++ 4 files changed, 16 insertions(+) diff --git a/src/lib/audio_buffers.cc b/src/lib/audio_buffers.cc index 825c6c2f3..6183ff26e 100644 --- a/src/lib/audio_buffers.cc +++ b/src/lib/audio_buffers.cc @@ -20,6 +20,7 @@ #include "audio_buffers.h" #include "dcpomatic_assert.h" +#include "dcpomatic_log.h" #include #include #include @@ -43,12 +44,14 @@ AudioBuffers::AudioBuffers (int channels, int32_t frames) AudioBuffers::AudioBuffers (AudioBuffers const & other) { allocate (other._channels, other._frames); + LOG_GENERAL_NC("copy_from #5"); copy_from (&other, other._frames, 0, 0); } AudioBuffers::AudioBuffers (boost::shared_ptr other) { allocate (other->_channels, other->_frames); + LOG_GENERAL_NC("copy_from #6"); copy_from (other.get(), other->_frames, 0, 0); } @@ -61,6 +64,7 @@ AudioBuffers::operator= (AudioBuffers const & other) deallocate (); allocate (other._channels, other._frames); + LOG_GENERAL_NC("copy_from #7"); copy_from (&other, other._frames, 0, 0); return *this; @@ -186,6 +190,8 @@ AudioBuffers::copy_from (AudioBuffers const * from, int32_t frames_to_copy, int3 return; } + LOG_GENERAL("AudioBuffers::copy_from %1 %2 %3 %4", from->_allocated_frames, frames_to_copy, read_offset, write_offset); + DCPOMATIC_ASSERT (from->channels() == channels()); DCPOMATIC_ASSERT (from); @@ -340,6 +346,7 @@ shared_ptr AudioBuffers::clone () const { shared_ptr b (new AudioBuffers (channels (), frames ())); + LOG_GENERAL_NC("copy_from #3"); b->copy_from (this, frames (), 0, 0); return b; } @@ -350,6 +357,7 @@ AudioBuffers::append (shared_ptr other) { DCPOMATIC_ASSERT (channels() == other->channels()); ensure_size (_frames + other->frames()); + LOG_GENERAL_NC("copy_from #4"); copy_from (other.get(), other->frames(), 0, _frames); _frames += other->frames(); } diff --git a/src/lib/audio_merger.cc b/src/lib/audio_merger.cc index a16c378c6..a42258012 100644 --- a/src/lib/audio_merger.cc +++ b/src/lib/audio_merger.cc @@ -23,6 +23,7 @@ #include "audio_merger.h" #include "dcpomatic_time.h" +#include "dcpomatic_log.h" #include using std::pair; @@ -69,6 +70,7 @@ AudioMerger::pull (DCPTime time) shared_ptr audio (new AudioBuffers (i.audio->channels(), frames(DCPTime(time - i.time)))); /* Though time > i.time, audio->frames() could be 0 if the difference in time is less than one frame */ if (audio->frames() > 0) { + LOG_GENERAL("copy_from #1; pulling from %2", to_string(time)); audio->copy_from (i.audio.get(), audio->frames(), 0, 0); out.push_back (make_pair (audio, i.time)); i.audio->trim_start (audio->frames ()); @@ -134,6 +136,7 @@ AudioMerger::push (boost::shared_ptr audio, DCPTime time) /* Get the part of audio that we want to use */ shared_ptr part (new AudioBuffers (audio->channels(), frames(i.to) - frames(i.from))); + LOG_GENERAL_NC("copy_from #2"); part->copy_from (audio.get(), part->frames(), frames(DCPTime(i.from - time)), 0); if (before == _buffers.end() && after == _buffers.end()) { diff --git a/src/lib/player.cc b/src/lib/player.cc index fe08241ab..4cdeb7256 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -48,6 +48,7 @@ #include "image_decoder.h" #include "compose.hpp" #include "shuffler.h" +#include "dcpomatic_log.h" #include #include #include @@ -883,6 +884,7 @@ Player::audio (weak_ptr wp, AudioStreamPtr stream, ContentAudio content_a return; } shared_ptr cut (new AudioBuffers (content_audio.audio->channels(), remaining_frames)); + LOG_GENERAL_NC("copy_from #8"); cut->copy_from (content_audio.audio.get(), remaining_frames, 0, 0); content_audio.audio = cut; } @@ -1167,6 +1169,7 @@ Player::discard_audio (shared_ptr audio, DCPTime time, DCPTi return make_pair(shared_ptr(), DCPTime()); } shared_ptr cut (new AudioBuffers (audio->channels(), remaining_frames)); + LOG_GENERAL_NC("copy_from #9"); cut->copy_from (audio.get(), remaining_frames, discard_frames, 0); return make_pair(cut, time + discard_time); } diff --git a/src/lib/writer.cc b/src/lib/writer.cc index f9009be37..db9a67b20 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -285,12 +285,14 @@ Writer::write (shared_ptr audio, DCPTime const time) if (part_frames[0]) { shared_ptr part (new AudioBuffers (audio->channels(), part_frames[0])); + LOG_GENERAL_NC("copy from #10"); part->copy_from (audio.get(), part_frames[0], 0, 0); _audio_reel->write (part); } if (part_frames[1]) { shared_ptr part (new AudioBuffers (audio->channels(), part_frames[1])); + LOG_GENERAL_NC("copy from #11"); part->copy_from (audio.get(), part_frames[1], part_frames[0], 0); audio = part; } else { -- 2.30.2