mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-29 19:28:47 -05:00
Revert "Rx channel demods: prevent possible reading past audio buffer end. For #1661"
This reverts commit 91f4844452
.
This commit is contained in:
parent
0f583806ad
commit
59e664c028
@ -203,15 +203,11 @@ void AMDemodSink::processOneSample(Complex &ci)
|
||||
|
||||
if (m_audioBufferFill >= m_audioBuffer.size())
|
||||
{
|
||||
if (m_audioBufferFill > m_audioBuffer.size()) {
|
||||
qDebug("AMDemodSink::processOneSample: dropping %d samples", (int) m_audioBufferFill - (int) m_audioBuffer.size());
|
||||
}
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill);
|
||||
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBuffer.size());
|
||||
|
||||
if (res != m_audioBuffer.size())
|
||||
if (res != m_audioBufferFill)
|
||||
{
|
||||
qDebug("AMDemodSink::processOneSample: %u/%lu audio samples written", res, m_audioBuffer.size());
|
||||
qDebug("AMDemodSink::processOneSample: %u/%u audio samples written", res, m_audioBufferFill);
|
||||
m_audioFifo.clear();
|
||||
}
|
||||
|
||||
|
@ -225,14 +225,10 @@ void BFMDemodSink::feed(const SampleVector::const_iterator& begin, const SampleV
|
||||
|
||||
if (m_audioBufferFill >= m_audioBuffer.size())
|
||||
{
|
||||
if (m_audioBufferFill > m_audioBuffer.size()) {
|
||||
qDebug("BFMDemodSink::processOneSample: dropping %d samples", (int) m_audioBufferFill - (int) m_audioBuffer.size());
|
||||
}
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill);
|
||||
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBuffer.size());
|
||||
|
||||
if(res != m_audioBuffer.size()) {
|
||||
qDebug("BFMDemodSink::feed: %u/%lu audio samples written", res, m_audioBuffer.size());
|
||||
if(res != m_audioBufferFill) {
|
||||
qDebug("BFMDemodSink::feed: %u/%u audio samples written", res, m_audioBufferFill);
|
||||
}
|
||||
|
||||
m_audioBufferFill = 0;
|
||||
|
@ -446,15 +446,11 @@ void DABDemodSink::processOneAudioSample(Complex &ci)
|
||||
|
||||
if (m_audioBufferFill >= m_audioBuffer.size())
|
||||
{
|
||||
if (m_audioBufferFill > m_audioBuffer.size()) {
|
||||
qDebug("DABDemodSink::processOneAudioSample: dropping %d samples", (int) m_audioBufferFill - (int) m_audioBuffer.size());
|
||||
}
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill);
|
||||
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBuffer.size());
|
||||
|
||||
if (res != m_audioBuffer.size())
|
||||
if (res != m_audioBufferFill)
|
||||
{
|
||||
qDebug("DABDemodSink::processOneAudioSample: %u/%lu audio samples written", res, m_audioBuffer.size());
|
||||
qDebug("DABDemodSink::audio: %u/%u audio samples written", res, m_audioBufferFill);
|
||||
m_audioFifo.clear();
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,7 @@ DSDDemodSink::DSDDemodSink() :
|
||||
m_dsdDecoder(),
|
||||
m_signalFormat(signalFormatNone)
|
||||
{
|
||||
m_audioBuffer.resize(1<<14);
|
||||
m_audioBufferFill = 0;
|
||||
m_demodBuffer.resize(1<<12);
|
||||
m_demodBufferFill = 0;
|
||||
|
@ -140,6 +140,7 @@ private:
|
||||
MagSqLevelsStore m_magSqLevelStore;
|
||||
|
||||
SampleVector m_scopeSampleBuffer;
|
||||
AudioVector m_audioBuffer;
|
||||
uint m_audioBufferFill;
|
||||
FixReal *m_sampleBuffer; //!< samples ring buffer
|
||||
int m_sampleBufferIndex;
|
||||
|
@ -330,14 +330,10 @@ void FreeDVDemodSink::pushSampleToAudio(int16_t sample)
|
||||
|
||||
if (m_audioBufferFill >= m_audioBuffer.size())
|
||||
{
|
||||
if (m_audioBufferFill > m_audioBuffer.size()) {
|
||||
qDebug("FreeDVDemodSink::pushSampleToAudio: dropping %d samples", (int) m_audioBufferFill - (int) m_audioBuffer.size());
|
||||
}
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill);
|
||||
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBuffer.size());
|
||||
|
||||
if (res != m_audioBuffer.size()) {
|
||||
qDebug("FreeDVDemodSink::pushSampleToAudio: %u/%lu samples written", res, m_audioBuffer.size());
|
||||
if (res != m_audioBufferFill) {
|
||||
qDebug("FreeDVDemodSink::pushSampleToAudio: %u/%u samples written", res, m_audioBufferFill);
|
||||
}
|
||||
|
||||
m_audioBufferFill = 0;
|
||||
|
@ -316,15 +316,11 @@ void ILSDemodSink::processOneAudioSample(Complex &ci)
|
||||
|
||||
if (m_audioBufferFill >= m_audioBuffer.size())
|
||||
{
|
||||
if (m_audioBufferFill > m_audioBuffer.size()) {
|
||||
qDebug("ILSDemodSink::processOneAudioSample: dropping %d samples", (int) m_audioBufferFill - (int) m_audioBuffer.size());
|
||||
}
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill);
|
||||
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBuffer.size());
|
||||
|
||||
if (res != m_audioBuffer.size())
|
||||
if (res != m_audioBufferFill)
|
||||
{
|
||||
qDebug("ILSDemodSink::processOneAudioSample: %u/%lu audio samples written", res, m_audioBuffer.size());
|
||||
qDebug("ILSDemodSink::processOneAudioSample: %u/%u audio samples written", res, m_audioBufferFill);
|
||||
m_audioFifo.clear();
|
||||
}
|
||||
|
||||
|
@ -520,14 +520,10 @@ void M17DemodProcessor::processAudio(const std::array<int16_t, 160>& in)
|
||||
|
||||
if (m_audioBufferFill >= m_audioBuffer.size() - 960)
|
||||
{
|
||||
if (m_audioBufferFill > m_audioBuffer.size()) {
|
||||
qDebug("M17DemodProcessor::processAudio: dropping %d samples", (int) m_audioBufferFill - (int) m_audioBuffer.size());
|
||||
}
|
||||
uint res = m_audioFifo->write((const quint8*)&m_audioBuffer[0], m_audioBufferFill);
|
||||
|
||||
uint res = m_audioFifo->write((const quint8*)&m_audioBuffer[0], m_audioBuffer.size());
|
||||
|
||||
if (res != m_audioBuffer.size()) {
|
||||
qDebug("M17DemodProcessor::processAudio: %u/%lu audio samples written", res, m_audioBuffer.size());
|
||||
if (res != m_audioBufferFill) {
|
||||
qDebug("M17DemodProcessor::processAudio: %u/%u audio samples written", res, m_audioBufferFill);
|
||||
}
|
||||
|
||||
m_audioBufferFill = 0;
|
||||
|
@ -59,6 +59,7 @@ M17DemodSink::M17DemodSink() :
|
||||
m_scopeXY(nullptr),
|
||||
m_scopeEnabled(true)
|
||||
{
|
||||
m_audioBuffer.resize(1<<14);
|
||||
m_audioBufferFill = 0;
|
||||
m_demodBuffer.resize(1<<12);
|
||||
m_demodBufferFill = 0;
|
||||
|
@ -166,6 +166,7 @@ private:
|
||||
MagSqLevelsStore m_magSqLevelStore;
|
||||
|
||||
SampleVector m_scopeSampleBuffer;
|
||||
AudioVector m_audioBuffer;
|
||||
uint m_audioBufferFill;
|
||||
FixReal *m_sampleBuffer; //!< samples ring buffer
|
||||
int m_sampleBufferIndex;
|
||||
|
@ -244,16 +244,12 @@ void NFMDemodSink::processOneSample(Complex &ci)
|
||||
|
||||
if (m_audioBufferFill >= m_audioBuffer.size())
|
||||
{
|
||||
if (m_audioBufferFill > m_audioBuffer.size()) {
|
||||
qDebug("NFMDemodSink::processOneSample: dropping %d samples", (int) m_audioBufferFill - (int) m_audioBuffer.size());
|
||||
}
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill);
|
||||
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBuffer.size());
|
||||
|
||||
if (res != m_audioBuffer.size())
|
||||
if (res != m_audioBufferFill)
|
||||
{
|
||||
qDebug("NFMDemodSink::processOneSample: %u/%lu audio samples written m_audioSampleRate: %u m_channelSampleRate: %d",
|
||||
res, m_audioBuffer.size(), m_audioSampleRate, m_channelSampleRate);
|
||||
qDebug("NFMDemodSink::processOneSample: %u/%u audio samples written m_audioSampleRate: %u m_channelSampleRate: %d",
|
||||
res, m_audioBufferFill, m_audioSampleRate, m_channelSampleRate);
|
||||
}
|
||||
|
||||
m_audioBufferFill = 0;
|
||||
|
@ -241,14 +241,10 @@ void SSBDemodSink::processOneSample(Complex &ci)
|
||||
|
||||
if (m_audioBufferFill >= m_audioBuffer.size())
|
||||
{
|
||||
if (m_audioBufferFill > m_audioBuffer.size()) {
|
||||
qDebug("SSBDemodSink::processOneSample: dropping %d samples", (int) m_audioBufferFill - (int) m_audioBuffer.size());
|
||||
}
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill);
|
||||
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBuffer.size());
|
||||
|
||||
if (res != m_audioBuffer.size()) {
|
||||
qDebug("SSBDemodSink::processOneSample: %u/%lu samples written", res, m_audioBuffer.size());
|
||||
if (res != m_audioBufferFill) {
|
||||
qDebug("SSBDemodSink::processOneSample: %u/%u samples written", res, m_audioBufferFill);
|
||||
}
|
||||
|
||||
m_audioBufferFill = 0;
|
||||
|
@ -149,15 +149,11 @@ void VORDemodSCSink::processOneAudioSample(Complex &ci)
|
||||
|
||||
if (m_audioBufferFill >= m_audioBuffer.size())
|
||||
{
|
||||
if (m_audioBufferFill > m_audioBuffer.size()) {
|
||||
qDebug("VORDemodSCSink::processOneAudioSample: dropping %d samples", (int) m_audioBufferFill - (int) m_audioBuffer.size());
|
||||
}
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill);
|
||||
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBuffer.size());
|
||||
|
||||
if (res != m_audioBuffer.size())
|
||||
if (res != m_audioBufferFill)
|
||||
{
|
||||
qDebug("VORDemodSCSink::processOneAudioSample: %u/%lu audio samples written", res, m_audioBuffer.size());
|
||||
qDebug("VORDemodSCSink::processOneAudioSample: %u/%u audio samples written", res, m_audioBufferFill);
|
||||
m_audioFifo.clear();
|
||||
}
|
||||
|
||||
|
@ -126,14 +126,10 @@ void WFMDemodSink::feed(const SampleVector::const_iterator& begin, const SampleV
|
||||
|
||||
if(m_audioBufferFill >= m_audioBuffer.size())
|
||||
{
|
||||
if (m_audioBufferFill > m_audioBuffer.size()) {
|
||||
qDebug("WFMDemodSink::feed: dropping %d samples", (int) m_audioBufferFill - (int) m_audioBuffer.size());
|
||||
}
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill);
|
||||
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBuffer.size());
|
||||
|
||||
if (res != m_audioBuffer.size()) {
|
||||
qDebug("WFMDemodSink::feed: %u/%lu audio samples written", res, m_audioBuffer.size());
|
||||
if (res != m_audioBufferFill) {
|
||||
qDebug("WFMDemodSink::feed: %u/%u audio samples written", res, m_audioBufferFill);
|
||||
}
|
||||
|
||||
m_audioBufferFill = 0;
|
||||
|
@ -314,14 +314,10 @@ void UDPSinkSink::audioReadyRead()
|
||||
|
||||
if (m_audioBufferFill >= m_audioBuffer.size())
|
||||
{
|
||||
if (m_audioBufferFill > m_audioBuffer.size()) {
|
||||
qDebug("UDPSinkSink::audioReadyRead: dropping %d samples", (int) m_audioBufferFill - (int) m_audioBuffer.size());
|
||||
}
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBufferFill);
|
||||
|
||||
uint res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], m_audioBuffer.size());
|
||||
|
||||
if (res != m_audioBuffer.size()) {
|
||||
qDebug("UDPSinkSink::audioReadyRead: %u/%lu audio samples written", res, m_audioBuffer.size());
|
||||
if (res != m_audioBufferFill) {
|
||||
qDebug("UDPSinkSink::audioReadyRead: (stereo) lost %u samples", m_audioBufferFill - res);
|
||||
}
|
||||
|
||||
m_audioBufferFill = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user