From patchwork Sun Jul 30 22:11:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 43040 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:7927:b0:130:ccc6:6c4b with SMTP id b39csp2030869pzg; Sun, 30 Jul 2023 15:13:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlHIrTcVQYm4Fk9pSlDUcw3ebfe/BhDHe4pAmWohIoVXPfRBC8ezEQ5cV5wiPuoFuMzFM6ts X-Received: by 2002:a17:906:73d8:b0:992:48b7:99e3 with SMTP id n24-20020a17090673d800b0099248b799e3mr5272344ejl.63.1690755210054; Sun, 30 Jul 2023 15:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690755210; cv=none; d=google.com; s=arc-20160816; b=kZYbsAR24yMQ/RfMMp8GCJ/BIPJGgEgBbQKax2UB2fvzNxzAG4tggnJFKQY+8NjYme 4vEoIfUBxOYmNRVHFU0Ec7N2FMJijtVmbEBti7DJW2RoIqP5lnQOwTescBy0s4XbCoiu rdwxvDsTJ1XNzi+ulGd5o+Uii91o5PV2mhYSMRW0JtkJg+SQCDPFcRUEqNroQskzFgvj HEJzM11XNxfiqBkaK4EjQHknZ/ZYhb8cIU9CNaA8XqiM+hSnmsx5EbOOSuJWomYkNFV1 +JKWapG8Txbi99FERh26yyKmE0hcwOwb08XQPewi4HYSzPpuSb3Tx4OivQ6FNBB8q+p8 VaKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=KcTiADvQ6Z26+n0TTRNvtSUk2QquQDVs1OKaPazbXuU=; fh=YYwLYmpaV0Fpw/rxmSKNRLS2XzDkAlGbHATiKOPtZrY=; b=lmy4D/t4BJToxbN97Rc8ce8pJrSgDASPi8gmEQ0BBWxyGxW+l0qIhr6bg3mswTLR7D rhIFDxwaprA/fcKAhOWYRIK6h3JClsrugVk217cfVEpmddLvE5ssd6Dr2c7+9JCymfCP BTHFXEQfzjiRNEjVnOdHJbHZcP3Jp3J3GWqZC+QC6iD3J83tlFzicDVobsgvsxqKMLQm OiD3qmhXz5kEgtttb6sPv+V8KmqXo5//fSsii5fMaiy+klJTv1aBEEXCOdCps7yO/jby UJxDS98JiKhMjpr0/zbH1fsiSv170VJxCwF/KvJ8+KoNLZ9pAuUJLqK7tSOJ3pBgUSfL 6pSA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q24-20020a17090622d800b00997bd42d213si6154927eja.165.2023.07.30.15.13.29; Sun, 30 Jul 2023 15:13:30 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5F3DF68C540; Mon, 31 Jul 2023 01:11:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5453368C5A0 for ; Mon, 31 Jul 2023 01:11:44 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id A913E40004 for ; Sun, 30 Jul 2023 22:11:43 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 31 Jul 2023 00:11:27 +0200 Message-Id: <20230730221131.1205193-8-michael@niedermayer.cc> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230730221131.1205193-1-michael@niedermayer.cc> References: <20230730221131.1205193-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 08/12] avradio/avformat/sdrdemux: set wanted gain also when manually set X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: XEGlsqej9caH Signed-off-by: Michael Niedermayer --- 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);