[FFmpeg-devel] [PATCH 04/12] avradio/avformat/sdrdemux: only update agc_gain on success

Michael Niedermayer michael at niedermayer.cc
Mon Jul 31 01:11:23 EEST 2023


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 e5ee4e80f5..fa45d30a3d 100644
--- a/libavformat/sdrdemux.c
+++ b/libavformat/sdrdemux.c
@@ -1533,8 +1533,10 @@ static void *soapy_needs_bigger_buffers_worker(SDRContext *sdr)
             fabs(wanted_gain - agc_gain) > 0.001 &&
             sdr->set_gain_callback
         ) {
-            sdr->set_gain_callback(sdr, wanted_gain);
-            agc_gain = wanted_gain;
+            int ret = sdr->set_gain_callback(sdr, wanted_gain);
+            if (ret >= 0) {
+                agc_gain = wanted_gain;
+            }
         }
         pthread_mutex_unlock(&sdr->mutex);
 
-- 
2.31.1



More information about the ffmpeg-devel mailing list