boost exception test.
[dcpomatic.git] / src / lib / audio_buffers.cc
index 82df9d6f6984dfc19f36dcc5dd71932df15eae91..f426c2b98af01748746bf1ae12fae85e37c5f32a 100644 (file)
@@ -125,7 +125,9 @@ AudioBuffers::set_frames (int32_t f)
 {
        DCPOMATIC_ASSERT (f <= _allocated_frames);
 
-       make_silent (f, _frames - f);
+       if (f < _frames) {
+               make_silent (f, _frames - f);
+       }
        _frames = f;
 }
 
@@ -183,10 +185,14 @@ AudioBuffers::copy_from (AudioBuffers const * from, int32_t frames_to_copy, int3
                return;
        }
 
-       DCPOMATIC_ASSERT (from->channels() == channels());
-
+       read_offset = -1; // XXX
        DCPOMATIC_ASSERT (from);
-       DCPOMATIC_ASSERT (read_offset >= 0 && (read_offset + frames_to_copy) <= from->_allocated_frames);
+       DCPOMATIC_ASSERT (from->channels() == channels());
+       DCPOMATIC_ASSERT_MESSAGE (
+                       read_offset >= 0 && (read_offset + frames_to_copy) <= from->_allocated_frames,
+                       "(read_offset=%1, frames_to_copy=%2, _allocated_frames=%3)",
+                       read_offset, read_offset + frames_to_copy, from->_allocated_frames
+                       );
        DCPOMATIC_ASSERT (write_offset >= 0 && (write_offset + frames_to_copy) <= _allocated_frames);
 
        for (int i = 0; i < _channels; ++i) {