[FFmpeg-devel] [PATCH 2/6] avradio: Fill in missing bandwidth values at 80% of frequency

Michael Niedermayer michael at niedermayer.cc
Wed Jul 5 01:22:58 EEST 2023


The previous of 100% was a unrealistic default

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

diff --git a/libavradio/sdrdemux.c b/libavradio/sdrdemux.c
index cb5e7afb2f..39e2e54ee7 100644
--- a/libavradio/sdrdemux.c
+++ b/libavradio/sdrdemux.c
@@ -1401,6 +1401,8 @@ static int sdrfile_initial_setup(AVFormatContext *s)
         sdr->bandwidth       = sdr->sdr_sample_rate;
         sdr->fileheader_size = 40;
     }
+    if (sdr->bandwidth >= sdr->sdr_sample_rate)
+        sdr->bandwidth = sdr->sdr_sample_rate * 4 / 5;
 
     //After reading the first packet header we return to the begin so the packet can be read whole
     avio_seek(s->pb, 0, SEEK_SET);
diff --git a/libavradio/sdrinradio.c b/libavradio/sdrinradio.c
index 3a0b7f8ab4..c6f5742436 100644
--- a/libavradio/sdrinradio.c
+++ b/libavradio/sdrinradio.c
@@ -320,7 +320,7 @@ static int sdrindev_initial_hw_setup(AVFormatContext *s)
 
     // rtlsdr doesnt return a valid value
     if (!sdr->bandwidth)
-        sdr->bandwidth = sdr->sdr_sample_rate;
+        sdr->bandwidth = sdr->sdr_sample_rate * 4 / 5;
     av_log(s, AV_LOG_INFO, "bandwidth %"PRId64"\n", sdr->bandwidth);
 
     SoapySDRDevice_activateStream(soapy, soapyRxStream, 0, 0, 0);
-- 
2.31.1



More information about the ffmpeg-devel mailing list