diff mbox series

[FFmpeg-devel,07/14] avradio/sdrdemux: snap2station consider more distant stations

Message ID 20230718214542.685375-7-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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c
index c284f7d8d8..b22d3fed13 100644
--- a/libavradio/sdrdemux.c
+++ b/libavradio/sdrdemux.c
@@ -1321,7 +1321,10 @@  static int snap2station(SDRContext *sdr, int *seek_direction) {
     } else
         current_view = sdr->station_freq;
 
-    nb_stations = ff_sdr_find_stations(sdr, current_view, sdr->sdr_sample_rate*0.5, station_list, FF_ARRAY_ELEMS(station_list));
+    //We accept up to a a bandwidth steps minus a bit more than a typical FM channel distance. That ensures we will not have unscanned
+    //areas between the currently vissible and the vissible with the new station
+    //alternatively we could use half sdr->sample_rate or half sdr->bandwidth to be more conservative
+    nb_stations = ff_sdr_find_stations(sdr, current_view, sdr->bandwidth - 250*1000, station_list, FF_ARRAY_ELEMS(station_list));
 
     for(int i = 0; i<nb_stations; i++) {
         Station *station = station_list[i];