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 8710E400C5 for ; Thu, 20 Jan 2022 03:26:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 58DC068B1C4; Thu, 20 Jan 2022 05:25:53 +0200 (EET) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B1F3F68B26C for ; Thu, 20 Jan 2022 05:25:47 +0200 (EET) Received: by mail-pj1-f53.google.com with SMTP id s61-20020a17090a69c300b001b4d0427ea2so8362847pjj.4 for ; Wed, 19 Jan 2022 19:25:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=QPt1g4d++6eqMGF272qoYSTMz7/wEE7bKAIBuuhcHL8=; b=njXKQ8DCobkmPReqzvLJJXdnKiwzLepIm0c/GzCm5MwBhb4wpdqGdfgz9+Ktttrqbm OMtrxJoKh5FAx+lUYF15xNSABFZ27bK30pIG+aryt+Ahdz0oORG6wFPhxo3g3IegGjPe Cks3aiApAZ96Cpad9m4M5R1PAdBw9/b+W04/A42yp3wPKJ6CVp3Qvr7/YBYCKe4aA5b3 hLbILqhUSliIXaMXr5mxSsHds/alqm3EfJrtTRk8M/WMyNGbJDOx3Va6z5GJ5VFqq9SL HZKCKGXlXnoWO3bsU+N/D16yVUzuq7rSPM4gWhagIhizX06JXu3TBspVlexjpICyL/lw nxXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=QPt1g4d++6eqMGF272qoYSTMz7/wEE7bKAIBuuhcHL8=; b=B7XPDjn++FSjLGUz8owsQCDCed8OsCNAVg/D4mxQjDJaRVvv1vuyM3WkkQ/c3iQpVG Ag7OxlbC2yt4k3YAb06aTKN+288dAvosRtNZKdvfFs7SjYQ5AnNsxkkzRU/OR1xb6FrS 3/rd+ETlg6HZP32HPI0Ct+BNq/BueRPOTDZuPCGy2MvPpRyebwoPvvx5l+O4pjFqxJBX tw/m8OZdUp+veQymhinvbLPDV7KPFyft2u7Cj1i5Wh3GSeD3smLTr9bTJ860V+rD3k28 30fyeUtYpfV5yt8LGMltDtGGtKoOiEgZ62jxQPKKvYcK88zvB0M1h1l4SjrCO6HysDGF nt9g== X-Gm-Message-State: AOAM5327FtnquOmQAVpKkuUTGJE4Ph4MsXuTKKxpRhfbG1C4sRe/JPgO +QjpWMhsjcFkKl6eK9i+VmIYSPgC8qM= X-Google-Smtp-Source: ABdhPJzXpXAZqWuo830lTqHA0VS+9oO7NaIANYP5KX8BN4j0TGJoIDu9QCtEl7CnfEVKLKqD3UuWDQ== X-Received: by 2002:a17:90b:1a91:: with SMTP id ng17mr8229330pjb.55.1642649145952; Wed, 19 Jan 2022 19:25:45 -0800 (PST) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id p12sm6851350pjj.55.2022.01.19.19.25.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jan 2022 19:25:45 -0800 (PST) Message-Id: In-Reply-To: References: From: ffmpegagent Date: Thu, 20 Jan 2022 03:25:18 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v3 10/26] avfilter/avfilter: Fix hardcoded input index 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: Michael Niedermayer , softworkz , Andreas Rheinhardt 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: From: softworkz This fix targets (rare) cases where multiple input pads have a .filter_frame function. ff_request_frame_to_filter needs to call ff_request_frame with the correct input pad instead of the hardcoded first one. Signed-off-by: softworkz --- libavfilter/avfilter.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 75d5e86539..aa9aa71f53 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -463,7 +463,7 @@ static int64_t guess_status_pts(AVFilterContext *ctx, int status, AVRational lin return AV_NOPTS_VALUE; } -static int ff_request_frame_to_filter(AVFilterLink *link) +static int ff_request_frame_to_filter(AVFilterLink *link, int input_index) { int ret = -1; @@ -472,8 +472,8 @@ static int ff_request_frame_to_filter(AVFilterLink *link) link->frame_blocked_in = 1; if (link->srcpad->request_frame) ret = link->srcpad->request_frame(link); - else if (link->src->inputs[0]) - ret = ff_request_frame(link->src->inputs[0]); + else if (link->src->inputs[input_index]) + ret = ff_request_frame(link->src->inputs[input_index]); if (ret < 0) { if (ret != AVERROR(EAGAIN) && ret != link->status_in) ff_avfilter_link_set_in_status(link, ret, guess_status_pts(link->src, ret, link->time_base)); @@ -1172,6 +1172,14 @@ static int forward_status_change(AVFilterContext *filter, AVFilterLink *in) { unsigned out = 0, progress = 0; int ret; + int input_index = 0; + + for (int i = 0; i < in->dst->nb_inputs; i++) { + if (&in->dst->input_pads[i] == in->dstpad) { + input_index = i; + break; + } + } av_assert0(!in->status_out); if (!filter->nb_outputs) { @@ -1181,7 +1189,7 @@ static int forward_status_change(AVFilterContext *filter, AVFilterLink *in) while (!in->status_out) { if (!filter->outputs[out]->status_in) { progress++; - ret = ff_request_frame_to_filter(filter->outputs[out]); + ret = ff_request_frame_to_filter(filter->outputs[out], input_index); if (ret < 0) return ret; } @@ -1218,7 +1226,7 @@ static int ff_filter_activate_default(AVFilterContext *filter) for (i = 0; i < filter->nb_outputs; i++) { if (filter->outputs[i]->frame_wanted_out && !filter->outputs[i]->frame_blocked_in) { - return ff_request_frame_to_filter(filter->outputs[i]); + return ff_request_frame_to_filter(filter->outputs[i], 0); } } return FFERROR_NOT_READY; -- ffmpeg-codebot _______________________________________________ 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".