tentative fix for a crash that occurs when switching backends. 5.0-pre1
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 21 Jul 2016 03:26:50 +0000 (23:26 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 21 Jul 2016 03:26:50 +0000 (23:26 -0400)
Session::process() returns early with Session::_silent set to true. AudioBuffer::set_data()
was never set for (at least) the LTC output port. PortManager::cycle_end() calls
AudioBuffer::silence() which used to assume that get_buffer() must have been called. But it
was not, because that should have happened in Session::process().

So check AudioBuffer::data() and call get_buffer() if required.

libs/ardour/ardour/audio_buffer.h
libs/ardour/audio_port.cc

index 051b75ab4bf4b1821557f20f31f19c2ebfe9ec78..9a9653b2c99620690317d98a2bff309af84bd6b7 100644 (file)
@@ -220,7 +220,13 @@ public:
         */
        bool check_silence (pframes_t nframes, pframes_t& n) const;
 
-       void prepare () { _written = false; _silent = false; }
+       void prepare () {
+               if (!_owns_data) {
+                       _data = 0;
+               }
+               _written = false;
+               _silent = false;
+       }
        bool written() const { return _written; }
        void set_written(bool w) { _written = w; }
 
index e2bb20dbe958c20753422e202e0d74cf8a911fa8..33e41c10ad49cc309615af9d4778e0d5d426b610 100644 (file)
@@ -59,8 +59,11 @@ void
 AudioPort::cycle_end (pframes_t nframes)
 {
         if (sends_output() && !_buffer->written()) {
-               if (_buffer->capacity() >= nframes) {
-                       _buffer->silence (nframes);
+               if (!_buffer->data (0)) {
+                       get_audio_buffer (nframes);
+               }
+               if (_buffer->capacity() >= nframes) {
+                       _buffer->silence (nframes);
                }
        }
 }