[FFmpeg-cvslog] [ffmpeg-radio] 04/14: avradio/sdrdemux: snap2station() should look only at the vissible window

Michael Niedermayer ffmpeg-git at ffmpeg.org
Sat Jul 22 16:55:50 EEST 2023


This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository libavradio.

commit e06dd1e69c308fdc4a0fa19cee00c77433a8add0
Author:     Michael Niedermayer <michael at niedermayer.cc>
AuthorDate: Mon Jul 17 20:30:53 2023 +0200
Commit:     Michael Niedermayer <michael at niedermayer.cc>
CommitDate: Tue Jul 18 18:46:14 2023 +0200

    avradio/sdrdemux: snap2station() should look only at the vissible window
    
    Otherwise we can skip over areas not leaving time to scan them
    
    Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavradio/sdrdemux.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c
index ca0a9c5cf9..f189c85a0d 100644
--- a/libavradio/sdrdemux.c
+++ b/libavradio/sdrdemux.c
@@ -1291,11 +1291,11 @@ static int snap2station(SDRContext *sdr, int *seek_direction) {
     AVFormatContext *avfmt = sdr->avfmt;
     AVStream *st = avfmt->streams[sdr->single_ch_audio_st_index];
     SDRStream *sst = st->priv_data;
-    double current_freq;
+    double current_freq, current_view;
     double best_distance = INT64_MAX;
     Station *best_station = NULL;
     Station *station_list[MAX_STATIONS];
-    int nb_stations = ff_sdr_find_stations(sdr, sdr->block_center_freq, sdr->sdr_sample_rate*0.5, station_list, FF_ARRAY_ELEMS(station_list));
+    int nb_stations;
 
     if (sst->station) {
         current_freq = sst->station->frequency;
@@ -1304,6 +1304,15 @@ static int snap2station(SDRContext *sdr, int *seek_direction) {
     } else
         current_freq = sdr->block_center_freq;
 
+    if (sdr->block_center_freq) {
+        current_view = sdr->block_center_freq;
+    } else if (sst->station) {
+        current_view = sst->station->frequency;
+    } 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));
+
     for(int i = 0; i<nb_stations; i++) {
         Station *station = station_list[i];
         double distance = station->frequency - current_freq;



More information about the ffmpeg-cvslog mailing list