[FFmpeg-devel] [PATCH 4/6] avradio/sdrdemux: adjust frequency precission in probing depending on modulation

Michael Niedermayer michael at niedermayer.cc
Wed Jul 5 01:23:00 EEST 2023


for AM we can find the frequency very precissely, for FM currently not so
much

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

diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c
index 90f6805c3b..92b1e2b170 100644
--- a/libavradio/sdrdemux.c
+++ b/libavradio/sdrdemux.c
@@ -166,9 +166,10 @@ static int create_station(SDRContext *sdr, Station *candidate_station) {
         return best_station_index;
     }
     for (i=0; i<sdr->nb_candidate_stations; i++) {
+        int freq_precission = modulation == AM ? 5 : 50;
         double delta = fabs(sdr->candidate_station[i]->frequency - freq);
         // Station already added, or we have 2 rather close stations
-        if (modulation == sdr->candidate_station[i]->modulation && delta < 10 && sdr->candidate_station[i] != candidate_station) {
+        if (modulation == sdr->candidate_station[i]->modulation && delta < freq_precission && sdr->candidate_station[i] != candidate_station) {
             nb_candidate_match++;
         }
         if (modulation != sdr->candidate_station[i]->modulation && delta < (bandwidth + sdr->candidate_station[i]->bandwidth)/2.1)
-- 
2.31.1



More information about the ffmpeg-devel mailing list