diff mbox series

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

Message ID 20230718214542.685375-2-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,01/14] avradio/sdrdemux: Add Mittelwelle / Mediumwave / Mediumfrequency band | expand

Checks

Context Check Description
andriy/configure_x86 warning Failed to apply patch
yinshiyou/configure_loongarch64 warning Failed to apply patch

Commit Message

Michael Niedermayer July 18, 2023, 9:45 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavradio/sdrdemux.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

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))