diff mbox series

[FFmpeg-devel,01/12] avradio/avformat/sdrdemux: Move agc_gain into local variable

Message ID 20230730221131.1205193-1-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/sdr.h      | 1 -
 libavformat/sdrdemux.c | 7 ++++---
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Michael Niedermayer Aug. 10, 2023, 9:03 p.m. UTC | #1
Hi Paul

also CC-ing jb as he seemed interrested in teh subject

On Mon, Jul 31, 2023 at 12:26:50AM +0200, Paul B Mahol wrote:
> NAK to whole set.

I suggest you lift that NAK.
If you do i would apply this set of bugfixes and after that
look into, if its possible to factorize the SDR code out.
I first would do so within the same lib but once its more
seperated, maybe we can seperate the SDR code and move it
into a seperate libavradio leaving the input device/demuxer
as a user of that lib.
That would be a seperate lib and API used by a module
in libavdevice/libavformat as it was suggestes by jb

I dont know how well that refactorization would work out. I may
have looked at this from the wrong side
but as long as you block this patchset the code is stuck in
libavformat and libavdevice

thx

[...]
Paul B Mahol Aug. 10, 2023, 11:03 p.m. UTC | #2
On Thu, Aug 10, 2023 at 11:03 PM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> Hi Paul
>
> also CC-ing jb as he seemed interrested in teh subject
>
> On Mon, Jul 31, 2023 at 12:26:50AM +0200, Paul B Mahol wrote:
> > NAK to whole set.
>
> I suggest you lift that NAK.
>

NAK is here to stay forever, until:

All SDR related work/patches/files/posts are moved out FFmpeg's
FATE/mailing lists/Twitter.



> If you do i would apply this set of bugfixes and after that
> look into, if its possible to factorize the SDR code out.
> I first would do so within the same lib but once its more
> seperated, maybe we can seperate the SDR code and move it
> into a seperate libavradio leaving the input device/demuxer
> as a user of that lib.
> That would be a seperate lib and API used by a module
> in libavdevice/libavformat as it was suggestes by jb
>
> I dont know how well that refactorization would work out. I may
> have looked at this from the wrong side
> but as long as you block this patchset the code is stuck in
> libavformat and libavdevice
>
> thx
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Into a blind darkness they enter who follow after the Ignorance,
> they as if into a greater darkness enter who devote themselves
> to the Knowledge alone. -- Isha Upanishad
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
Michael Niedermayer Sept. 8, 2023, 1:24 p.m. UTC | #3
On Mon, Jul 31, 2023 at 12:11:20AM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/sdr.h      | 1 -
>  libavformat/sdrdemux.c | 7 ++++---
>  2 files changed, 4 insertions(+), 4 deletions(-)

I will apply this patchset (of mostly bugfixes) in a few days unless there are
technical objections


[...]
Paul B Mahol Sept. 9, 2023, 10:34 a.m. UTC | #4
Why is this SPAM still on this Mailing List?
diff mbox series

Patch

diff --git a/libavformat/sdr.h b/libavformat/sdr.h
index 77278ada67..1f2d3a49ab 100644
--- a/libavformat/sdr.h
+++ b/libavformat/sdr.h
@@ -161,7 +161,6 @@  typedef struct SDRContext {
     float agc_max_headroom;
     float agc_max_headroom_time;
     int agc_low_time;
-    float agc_gain;                         ///< current gain, should be accessed only by buffer thread after init
     atomic_int wanted_gain;
     int sdr_adcc;
     int64_t bandwidth;
diff --git a/libavformat/sdrdemux.c b/libavformat/sdrdemux.c
index 0dc89041c5..4bde431e17 100644
--- a/libavformat/sdrdemux.c
+++ b/libavformat/sdrdemux.c
@@ -1475,6 +1475,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 agc_gain = 0;
 
     sdr->remaining_file_block_size = 0;
 
@@ -1529,16 +1530,16 @@  static void *soapy_needs_bigger_buffers_worker(SDRContext *sdr)
             block_counter = 0; // we just changed the frequency, do not trust the next blocks content
         }
         if (sdr->sdr_gain == GAIN_SW_AGC &&
-            fabs(wanted_gain - sdr->agc_gain) > 0.001 &&
+            fabs(wanted_gain - agc_gain) > 0.001 &&
             sdr->set_gain_callback
         ) {
             sdr->set_gain_callback(sdr, wanted_gain);
-            sdr->agc_gain = wanted_gain;
+            agc_gain = wanted_gain;
         }
         pthread_mutex_unlock(&sdr->mutex);
 
         fifo_element.center_frequency = block_counter > 0 ? sdr->freq : 0;
-        fifo_element.gain             = sdr->agc_gain; //we make only small changes so slightly mixing should be ok
+        fifo_element.gain             = agc_gain; //we make only small changes so slightly mixing should be ok
 
         remaining = sdr->block_size;
         while (remaining && !atomic_load(&sdr->close_requested)) {