From 819790cbc8b9849ee7c567b5e751f5c9bf02a8ec Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Mon, 15 Feb 2021 18:03:16 +0100 Subject: [PATCH] prevent an endless loop when client has problematic audio --- csdr/csdr.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/csdr/csdr.py b/csdr/csdr.py index 0902364..80ff9e3 100644 --- a/csdr/csdr.py +++ b/csdr/csdr.py @@ -530,6 +530,8 @@ class dsp(object): (self.decimation, self.last_decimation) = self.get_decimation(self.samp_rate, self.get_audio_rate()) def get_decimation(self, input_rate, output_rate): + if output_rate <= 0: + raise ValueError("invalid output rate: {rate}".format(rate=output_rate)) decimation = 1 target_rate = output_rate # wideband fm has a much higher frequency deviation (75kHz).