From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 1E7BC4954F for ; Wed, 12 Jun 2024 10:10:33 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6BF9F68D742; Wed, 12 Jun 2024 13:10:30 +0300 (EEST) Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E4F1768D7E2 for ; Wed, 12 Jun 2024 13:10:23 +0300 (EEST) Received: by mail-oo1-f46.google.com with SMTP id 006d021491bc7-5bad217c51aso2311575eaf.1 for ; Wed, 12 Jun 2024 03:10:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718187021; x=1718791821; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nJ9CEj+rgTn8+u9em/VSgpZ9txi6VGwYzV25Nsu05Hg=; b=RuWLK03agldxuys5zRlTZbQPkElNCryjZuDmEGj0N6lxThZ6XOVfBm8E5HPqRaeZLG nqIGtJcMpTKCzqltvi74TknsWBLNvVlbnZfqUIsaQh48HUmHT5fs41kzsVE2/yWAEZeL kff1TYDwd6TrdmtlKfp2dG2621PJnh3ZX277ce4aWdtPssmkKE/ZtxjNHL/K7M6cyNkg 4PrbCVqT5EygHMH34qgxPwQmaosca3j7RK/ADccWtYjSzo4LNUpKEyJLB/88lQagjChv PkkV4ouNx15h5loUq24UU/b54QDMhdJL98PfM02LrIQFW4WqBf/sH+KhIwhbXRJ4lFTn MK0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718187021; x=1718791821; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nJ9CEj+rgTn8+u9em/VSgpZ9txi6VGwYzV25Nsu05Hg=; b=b8gOIpLwN99Jvw/fnK4VDLs8gmIBaw2TDQ8Ho+nu0MAFWrx+eYN2o/0wRSC2m6Z3RW v9OQDOzoH+0jvl9I1Zl/PbcfTHzZVT3bMEIqJnQhtirPjCy5uA8PAi8nvZxJtF2tLU3T OquSt/xcKRqdtC4rQzK0FocSK1Lc9edFgBe+cCxed4dtHmFnCdfuEmC74TV+uDu0GlbP Lr66xpzgqDDU3sWHnw4deW+TpONY8Y4s1ha/VqGcXtbSca9IyOFoUZZ2kJg4BAZ3znEl VB4GMVZA09pPY9jmeTsLNfO6l6ieV1w96I2R6UWBAdxIOtjNYJaQKCUccXp9uoD7HTyA L4OA== X-Gm-Message-State: AOJu0Yx3kZfWysECgNmVCZzG6Std97YBEmb4ewlXvwOevPymnRS8A1An 3NLCxZCnutaUU6IEthHa61qgaVjOuoYUdJQcf7RdrRH+Viydri2QAInutg== X-Google-Smtp-Source: AGHT+IE8RvvYIIYIbW9fgXCZ/vvavLEnCyX3iahq7YB/lO0CeEDaO6GoTEkMy6bnzcPdznThqOFPOA== X-Received: by 2002:a05:6359:6d8f:b0:19f:6a64:83bd with SMTP id e5c5f4694b2df-19f6a648633mr95316755d.0.1718187021279; Wed, 12 Jun 2024 03:10:21 -0700 (PDT) Received: from PC.mioffice.cn ([43.224.245.231]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6de264ae01bsm8867568a12.66.2024.06.12.03.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 03:10:20 -0700 (PDT) From: Shiqi Zhu To: ffmpeg-devel@ffmpeg.org Date: Wed, 12 Jun 2024 18:10:16 +0800 Message-Id: <20240612101016.2023960-1-hiccupzhu@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avfilter/af_amix: fix amix decreased sound output 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 Cc: Shiqi Zhu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: fix he issue of decreased sound output when one or more input of the amix settings is set to EOF. Signed-off-by: Shiqi Zhu --- libavfilter/af_amix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c index ade4ef76a8..3ff85650a7 100644 --- a/libavfilter/af_amix.c +++ b/libavfilter/af_amix.c @@ -216,11 +216,11 @@ static void calculate_scales(MixContext *s, int nb_samples) int i; for (i = 0; i < s->nb_inputs; i++) - if (s->input_state[i] & INPUT_ON) + if ((s->input_state[i] & INPUT_ON) && av_audio_fifo_size(s->fifos[i]) > 0) weight_sum += FFABS(s->weights[i]); for (i = 0; i < s->nb_inputs; i++) { - if (s->input_state[i] & INPUT_ON) { + if ((s->input_state[i] & INPUT_ON) && av_audio_fifo_size(s->fifos[i]) > 0) { if (s->scale_norm[i] > weight_sum / FFABS(s->weights[i])) { s->scale_norm[i] -= ((s->weight_sum / FFABS(s->weights[i])) / s->nb_inputs) * nb_samples / (s->dropout_transition * s->sample_rate); @@ -230,7 +230,7 @@ static void calculate_scales(MixContext *s, int nb_samples) } for (i = 0; i < s->nb_inputs; i++) { - if (s->input_state[i] & INPUT_ON) { + if ((s->input_state[i] & INPUT_ON) && av_audio_fifo_size(s->fifos[i]) > 0) { if (!s->normalize) s->input_scale[i] = FFABS(s->weights[i]); else -- 2.34.1 _______________________________________________ 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".