1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

FileSink plugin: fixed possible segfault

This commit is contained in:
f4exb 2017-01-03 23:22:06 +01:00
parent cb207e26c7
commit 9b72a3c064

View File

@ -17,6 +17,7 @@
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <algorithm>
#include <QDebug>
#include "dsp/samplesourcefifo.h"
@ -195,25 +196,27 @@ void FileSinkThread::tick()
}
else
{
int chunkSize = std::min((int) m_samplesChunkSize, m_samplerate);
switch (m_log2Interpolation)
{
case 1:
m_interpolators.interpolate2_cen(&beginRead, m_buf, m_samplesChunkSize*(1<<m_log2Interpolation)*2);
m_interpolators.interpolate2_cen(&beginRead, m_buf, chunkSize*(1<<m_log2Interpolation)*2);
break;
case 2:
m_interpolators.interpolate4_cen(&beginRead, m_buf, m_samplesChunkSize*(1<<m_log2Interpolation)*2);
m_interpolators.interpolate4_cen(&beginRead, m_buf, chunkSize*(1<<m_log2Interpolation)*2);
break;
case 3:
m_interpolators.interpolate8_cen(&beginRead, m_buf, m_samplesChunkSize*(1<<m_log2Interpolation)*2);
m_interpolators.interpolate8_cen(&beginRead, m_buf, chunkSize*(1<<m_log2Interpolation)*2);
break;
case 4:
m_interpolators.interpolate16_cen(&beginRead, m_buf, m_samplesChunkSize*(1<<m_log2Interpolation)*2);
m_interpolators.interpolate16_cen(&beginRead, m_buf, chunkSize*(1<<m_log2Interpolation)*2);
break;
case 5:
m_interpolators.interpolate32_cen(&beginRead, m_buf, m_samplesChunkSize*(1<<m_log2Interpolation)*2);
m_interpolators.interpolate32_cen(&beginRead, m_buf, chunkSize*(1<<m_log2Interpolation)*2);
break;
case 6:
m_interpolators.interpolate64_cen(&beginRead, m_buf, m_samplesChunkSize*(1<<m_log2Interpolation)*2);
m_interpolators.interpolate64_cen(&beginRead, m_buf, chunkSize*(1<<m_log2Interpolation)*2);
break;
default:
break;