avoid buffer overflow #106

this is not a solution, but increases app stability beacuse we are going to a void a buffer overflow. Maybe we need to think about a mode preseelction before transmission starts
This commit is contained in:
dj2ls 2022-01-07 13:13:18 +01:00
parent e81795b45b
commit 306f202c5e

View file

@ -217,10 +217,17 @@ class RF():
x = np.frombuffer(data_in48k, dtype=np.int16)
x = self.resampler.resample48_to_8(x)
self.datac0_buffer.push(x)
self.datac1_buffer.push(x)
self.datac3_buffer.push(x)
self.fft_data += bytes(x)
# avoid buffer overflow
if not self.datac0_buffer.nbuffer+len(x) > self.datac0_buffer.size:
self.datac0_buffer.push(x)
# avoid buffer overflow
if not self.datac1_buffer.nbuffer+len(x) > self.datac1_buffer.size:
self.datac1_buffer.push(x)
# avoid buffer overflow
if not self.datac3_buffer.nbuffer+len(x) > self.datac3_buffer.size:
self.datac3_buffer.push(x)
self.fft_data = bytes(x)
if self.modoutqueue.empty():
data_out48k = bytes(self.AUDIO_FRAMES_PER_BUFFER_TX*2)