[FFmpeg-devel] [PATCH 02/14] avradio/sdrdemux: Fix corner case in snap2band

Michael Niedermayer michael at niedermayer.cc
Wed Jul 19 00:45:30 EEST 2023


Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavradio/sdrdemux.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c
index 318b5465da..6b1553b130 100644
--- a/libavradio/sdrdemux.c
+++ b/libavradio/sdrdemux.c
@@ -1368,6 +1368,8 @@ static int64_t snap2band(SDRContext *sdr, int64_t wanted_freq, int64_t delta) {
             min_center_freq += sdr->bandwidth / 2;
             max_center_freq -= sdr->bandwidth / 2;
         }
+        min_center_freq = av_clip64(min_center_freq, sdr->min_center_freq, sdr->max_center_freq);
+        max_center_freq = av_clip64(max_center_freq, sdr->min_center_freq, sdr->max_center_freq);
 
         // Is the band in the direction we want to seek to ?
         if (FFSIGN(min_center_freq - wanted_freq) == FFSIGN(max_center_freq - wanted_freq))
-- 
2.31.1



More information about the ffmpeg-devel mailing list