octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #50674] audiorecorder() crashes in getaudiodat


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #50674] audiorecorder() crashes in getaudiodata()
Date: Thu, 30 Mar 2017 09:42:03 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0

Follow-up Comment #2, bug #50674 (project octave):

Using the attached patch, I was able to avoid the crash.  So it seems that
portaudio_record_callback could be called while getaudiodata is active.  If
so, and if the callback function causes the left and right data vectors to be
resized/reallocated, then we are in trouble, and that would explain the double
free crash.

However, the implementation looks like trouble to me since it can resize and
possibly copy the left and right data buffers many times.  Maybe we should use
a list of buffers so that once once is created, its address can't change?  And
each buffer in the list should be allocated to have some predetermined size so
that it is not resized.  When a buffer fills, we just add another to the list.
 Then getting data out and into a contiguous array means concatenating all
these buffers.

Even with a scheme like that, locking might be necessary, but it would be good
to limit the time spent locked.  I admit I don't understand exactly how all
this works, but I imagine that locking could disrupt recording if copying a
large buffer (or list of buffers) requires too much time.

(file #40211)
    _______________________________________________________

Additional Item Attachment:

File name: diffs.txt                      Size:1 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?50674>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]