diff mbox series

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

Message ID 20230730221131.1205193-4-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,01/12] avradio/avformat/sdrdemux: Move agc_gain into local variable | expand

Checks

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

Commit Message

Michael Niedermayer July 30, 2023, 10:11 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/sdrdemux.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

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