[FFmpeg-cvslog] [ffmpeg-radio] 08/13: avradio/avformat/sdrdemux: set wanted gain also when manually set

Michael Niedermayer ffmpeg-git at ffmpeg.org
Sat Sep 16 21:38:24 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 cc5886c075ea663534796ee7d2b31e9782aba8db
Author:     Michael Niedermayer <michael at niedermayer.cc>
AuthorDate: Sat Jul 29 23:15:58 2023 +0200
Commit:     Michael Niedermayer <michael at niedermayer.cc>
CommitDate: Sun Jul 30 23:11:49 2023 +0200

    avradio/avformat/sdrdemux: set wanted gain also when manually set
    
    Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/sdrdemux.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/sdrdemux.c b/libavformat/sdrdemux.c
index 8f0f4657f3..3f3390049c 100644
--- a/libavformat/sdrdemux.c
+++ b/libavformat/sdrdemux.c
@@ -1476,7 +1476,7 @@ static void *soapy_needs_bigger_buffers_worker(SDRContext *sdr)
     unsigned block_counter = 0;
     int64_t local_wanted_freq = 0;
     int64_t last_wanted_freq = 0;
-    float wanted_gain = (sdr->min_gain + sdr->max_gain) / 2;
+    float wanted_gain = sdr->sdr_gain < 0 ? (sdr->min_gain + sdr->max_gain) / 2 : sdr->sdr_gain;
     float agc_gain = 0;
 
     sdr->remaining_file_block_size = 0;
@@ -1530,7 +1530,8 @@ static void *soapy_needs_bigger_buffers_worker(SDRContext *sdr)
             //And theres not much else we can do, an error message was already printed by ff_sdr_set_freq() in that case
             block_counter = 0; // we just changed the frequency, do not trust the next blocks content
         }
-        if (sdr->sdr_gain == GAIN_SW_AGC &&
+        if (sdr->sdr_gain != GAIN_SDR_AGC &&
+            sdr->sdr_gain != GAIN_DEFAULT &&
             fabs(wanted_gain - agc_gain) > 0.001 &&
             sdr->set_gain_callback
         ) {
@@ -1539,6 +1540,7 @@ static void *soapy_needs_bigger_buffers_worker(SDRContext *sdr)
                 agc_gain = wanted_gain;
                 if (block_counter)
                     block_counter = 1;
+                av_log(avfmt, AV_LOG_DEBUG, "GAIN changed %f\n", wanted_gain);
             }
         }
         pthread_mutex_unlock(&sdr->mutex);



More information about the ffmpeg-cvslog mailing list