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 A6FB742B4F for ; Sat, 25 Jun 2022 09:59:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7CED668B850; Sat, 25 Jun 2022 12:58:20 +0300 (EEST) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C687B68B3D1 for ; Sat, 25 Jun 2022 12:58:15 +0300 (EEST) Received: by mail-pj1-f52.google.com with SMTP id cv13so4875993pjb.4 for ; Sat, 25 Jun 2022 02:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:message-id:in-reply-to:references:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=HvaSrUNkdYU7ZKtqQZac5tap7Ome60MMPRJc94yc6OY=; b=QdmF5rJmD/vSjecr+pBdFnhO+/MrdpffGMJquvzPr7li/5aROkh8BcMV3RhcHIXh3n sxAKYQ5Z/6TKQEs51yQW5LSu6eWxtJG2ODKBY5XxTxBZ/crEXHPhMsaUERVh4snhBlat VFaSaRtOY9SnpEu5Zn834+b5EpwyE/+/E51LlZLKahulnR887NLbREbsh7Nl3+X4NJu0 Nk2IRKGbgzPt54nbJ6sRTxYCvyMrfVp5QBP1WAWnqmK9HRczYMXlHWvrw8AhoKHFrnkF ZFU2xkHbcUihvksIU9Oi1F36C9eeFOHHUdHMarvIHtVOfIOgSAAEiQkg3xcsNNluCq8K NuWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:in-reply-to:references:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=HvaSrUNkdYU7ZKtqQZac5tap7Ome60MMPRJc94yc6OY=; b=eRZE/Aj0PhFGtW8NGequ0UaRKqWBreOYC2Ix6a7M4JLe7PAihBbg1FTh7GFmPOV16Z 5uj3IYI2SQQihJ3Nij5rtAPo4QoVP8V5f5z+ro/4IB4LMdlWvJ89RTjcf9CWwBqHoukk ZrBmmdXmTqFPVQhA6EINETooiv810dx2z5jUJYRzhq6ikrwMmBbpew+xjsHep4Ws+8Eh BMsPpQIvwWtxzUj1nVE/qcOxyg6FR6tqH7rzQserQGuDncxgExqlazy7lHv6zs7ehiMY VO++MmTA2auxpPTU6QpSeWQuOa8/+cMD0ySW+ogaQs/uyQgWUMVF+3cxWxWkGZh7uMLf oFyA== X-Gm-Message-State: AJIora8VFaPYICrxka8v2iFfHrYvJYXO54FMkcXBZjwlss8RpKmOC92k r7T+2mgP1cPqW07y8Nsrma+1F3+9MfVRMw== X-Google-Smtp-Source: AGRyM1vhdaXy4pOGW2UakF9I2bD5+TinO1fxn/29GRJbaX1m9eJS/AY0/C50PpNOICR8ckySwJFSYg== X-Received: by 2002:a17:90b:c82:b0:1ec:b80a:676 with SMTP id o2-20020a17090b0c8200b001ecb80a0676mr9049954pjz.45.1656151094210; Sat, 25 Jun 2022 02:58:14 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id h9-20020a170902f70900b001663cf001besm3268890plo.174.2022.06.25.02.58.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Jun 2022 02:58:13 -0700 (PDT) From: softworkz X-Google-Original-From: softworkz Message-Id: <36cab55ff2da9a7c3d801f2c0198a1c02804ed7a.1656151077.git.ffmpegagent@gmail.com> In-Reply-To: References: Date: Sat, 25 Jun 2022 09:57:43 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v5 11/25] 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 , Andriy Gelman , 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 30745f41cb..6cbfc54a85 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -443,7 +443,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; @@ -452,8 +452,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)); @@ -1153,6 +1153,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) { @@ -1162,7 +1170,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; } @@ -1199,7 +1207,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".