diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-01-30 12:57:58 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-06-29 14:18:13 -0400 |
commit | 682d8ae064303634a7cac747ab96fa1226cddd14 (patch) | |
tree | 3e94eceec57fada34f51acd2e8594413d85ff3eb /libs/ardour/audio_diskstream.cc | |
parent | 3a65005a75851c9a41b694babd51f5054972e5dc (diff) |
make sure we allocate large enough buffers when doing a non-butler context disk buffer refill.
The size of the buffer now needs to reflect that we calculate read
refills in bytes, and if we are not using 32 bit float sample format
on disk, that can translate into > 1M samples.
Diffstat (limited to 'libs/ardour/audio_diskstream.cc')
-rw-r--r-- | libs/ardour/audio_diskstream.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index e36f905d7c..ed7f21cc16 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -1079,8 +1079,14 @@ AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer, int AudioDiskstream::_do_refill_with_alloc (bool partial_fill) { - Sample* mix_buf = new Sample[1048576]; - float* gain_buf = new float[1048576]; + /* We limit disk reads to at most 4MB chunks, which with floating point + samples would be 1M samples. But we might use 16 or 14 bit samples, + in which case 4MB is more samples than that. Therefore size this for + the smallest sample value .. 4MB = 2M samples (16 bit). + */ + + Sample* mix_buf = new Sample[2*1048576]; + float* gain_buf = new float[2*1048576]; int ret = _do_refill (mix_buf, gain_buf, (partial_fill ? disk_read_chunk_frames : 0)); |