diff mbox series

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

Message ID 20230704222302.1129450-2-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/6] avradio/sdrdemux: end on EOF dont wraparound | expand

Checks

Context Check Description
yinshiyou/configure_loongarch64 warning Failed to apply patch
andriy/configure_x86 warning Failed to apply patch

Commit Message

Michael Niedermayer July 4, 2023, 10:22 p.m. UTC
The previous of 100% was a unrealistic default

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

Patch

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);