Merge master.
[dcpomatic.git] / src / lib / audio_buffers.cc
index 8d00fa8ba5a2bec7d0d5894cc1ea730d4beedb21..4ada94db867b59d4fe7425fc6b048e0a251ae721 100644 (file)
@@ -175,6 +175,11 @@ AudioBuffers::make_silent (int from, int frames)
 void
 AudioBuffers::copy_from (AudioBuffers const * from, int frames_to_copy, int read_offset, int write_offset)
 {
+       if (frames_to_copy == 0) {
+               /* Prevent the asserts from firing if there is nothing to do */
+               return;
+       }
+       
        assert (from->channels() == channels());
 
        assert (from);
@@ -258,6 +263,8 @@ void
 AudioBuffers::accumulate_frames (AudioBuffers const * from, int read_offset, int write_offset, int frames)
 {
        assert (_channels == from->channels ());
+       assert (read_offset >= 0);
+       assert (write_offset >= 0);
 
        for (int i = 0; i < _channels; ++i) {
                for (int j = 0; j < frames; ++j) {