[FFmpeg-devel] [PATCH 8/9] avradio/sdrdemux: increase the FM station frequency tolerance

Michael Niedermayer michael at niedermayer.cc
Fri Jul 7 20:22:23 EEST 2023


The current FM station probing code is quite inaccurate with the
detected frequency.
Doing better requires some extra computations, maybe this is good
enough

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

diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c
index 1fc528317c..4c1ec7b51c 100644
--- a/libavradio/sdrdemux.c
+++ b/libavradio/sdrdemux.c
@@ -248,7 +248,7 @@ static int create_station(SDRContext *sdr, Station *candidate_station) {
 
     nb_candidate_match += candidate_station->nb_frequency - 1;
     for (i=0; i<nb_stations; i++) {
-        int freq_precission = modulation == AM ? 5 : 50;
+        int freq_precission = modulation == AM ? 5 : 500;
         Station *s = station_list[i];
         double delta = fabs(s->frequency - freq);
 
@@ -383,7 +383,7 @@ static int create_candidate_station(SDRContext *sdr, enum Modulation modulation,
     void *tmp;
     struct AVTreeNode *next = NULL;
     Station *station_list[1000];
-    double snapdistance = modulation == AM ? 5 : 50;
+    double snapdistance = modulation == AM ? 5 : 500;
     int nb_stations = find_stations(sdr, freq, snapdistance, station_list, FF_ARRAY_ELEMS(station_list));
 
     if (nb_stations) {
-- 
2.31.1



More information about the ffmpeg-devel mailing list