Debug. debug/shane
authorCarl Hetherington <cth@carlh.net>
Fri, 17 Jan 2020 22:34:58 +0000 (22:34 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 17 Jan 2020 22:34:58 +0000 (22:34 +0000)
src/lib/audio_buffers.cc
src/lib/audio_merger.cc
src/lib/player.cc
src/lib/writer.cc

index 825c6c2f3219fa8bd6347d7aeddfc97fc005a29b..6183ff26e89dfbf6b8face61c12892d9d9b2ba2c 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "audio_buffers.h"
 #include "dcpomatic_assert.h"
+#include "dcpomatic_log.h"
 #include <cassert>
 #include <cstring>
 #include <cmath>
@@ -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<const AudioBuffers> 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>
 AudioBuffers::clone () const
 {
        shared_ptr<AudioBuffers> 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<const AudioBuffers> 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();
 }
index a16c378c67309dac758c90abd27fc275ef7db769..a422580124ff5ac8b2736e3732b142088ea11e66 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "audio_merger.h"
 #include "dcpomatic_time.h"
+#include "dcpomatic_log.h"
 #include <iostream>
 
 using std::pair;
@@ -69,6 +70,7 @@ AudioMerger::pull (DCPTime time)
                        shared_ptr<AudioBuffers> 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<const AudioBuffers> audio, DCPTime time)
 
                /* Get the part of audio that we want to use */
                shared_ptr<AudioBuffers> 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()) {
index fe08241ab8258bca5ec05cf8865472ef584cc941..4cdeb7256ef731975693a5cf088b2cf2ba0c0253 100644 (file)
@@ -48,6 +48,7 @@
 #include "image_decoder.h"
 #include "compose.hpp"
 #include "shuffler.h"
+#include "dcpomatic_log.h"
 #include <dcp/reel.h>
 #include <dcp/reel_sound_asset.h>
 #include <dcp/reel_subtitle_asset.h>
@@ -883,6 +884,7 @@ Player::audio (weak_ptr<Piece> wp, AudioStreamPtr stream, ContentAudio content_a
                        return;
                }
                shared_ptr<AudioBuffers> 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<const AudioBuffers> audio, DCPTime time, DCPTi
                return make_pair(shared_ptr<AudioBuffers>(), DCPTime());
        }
        shared_ptr<AudioBuffers> 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);
 }
index f9009be37f9779964edc988f184610208d2b0586..db9a67b20e1c77aaaf5b88442d33e06548353aef 100644 (file)
@@ -285,12 +285,14 @@ Writer::write (shared_ptr<const AudioBuffers> audio, DCPTime const time)
 
                        if (part_frames[0]) {
                                shared_ptr<AudioBuffers> 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<AudioBuffers> 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 {