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 0510A4045C for ; Thu, 20 Jan 2022 02:49:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E810768B212; Thu, 20 Jan 2022 04:48:54 +0200 (EET) Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8FC1368B1D9 for ; Thu, 20 Jan 2022 04:48:50 +0200 (EET) Received: by mail-pg1-f175.google.com with SMTP id c5so4374314pgk.12 for ; Wed, 19 Jan 2022 18:48:50 -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=CxkCS4BpO7DZoltN7w5Vr40ICd109R0vVyrXDxxmhJF6EtOcvPCidBVCVQa3EIWyDh 8MR+Sr/p7MvvmZChxTedh/ZCii3Erv+wkzYaDpCSuMycqnJW+sv02ePzhfbkCufydEYI egLMBUzzwCfh4skVXwF1srEEgKoBuacxu4EqZkpO9cVzGWhR+B81z1ElEWzf4846Htsi YCoGTKPVxd7VqQT+8VAmFptw/rbAq/h2yjkHNb00OwwHv4MZBM1S8le9wpP1LRZdPoXa q3CEghMUL8u/PZw1uK1iGBrL3WYQaE2a+0BCTLbnFvGSMeE28Ogh4sSoWTXFPDsb5Lw5 8udQ== 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=TkUfkqqMA261v7mWDMBoGmSssvSG0g3Lf6rE8PNFMOeoMGb+HB961hGJ2qGAD6RCim YjDTFchEB3EaYQRCE7tkkKopGIv+3AFfQ8IzeyJ9pT7qTI1cGTaNs10cxnsyMtc3YuT6 6us24d39Lj31UWwjMBQPzehaHcd34kwZac6o3sspVvQ+rtPFwZpqDfS03M7vR5AzpZfz DMDNBcWSkYXMnam4MJQLHVDRpcX7n7FzWwsQjCq4mETyooB2hyMlrfPbNwadoP8iIhAH jG0O5PcVhpII/yxmEpxieOwUojvTwd5DZJdDiGUuqHPZn3f5rvEvIDFbrd54b60ev0Da Ib4w== X-Gm-Message-State: AOAM53370iwcyL2g2K0jrT4A2yauBFvIqQGb6EdT/k+ydT8sWRU7RS5h eTb7xaKzOtjCft7XDEBUN5l2NArdrcY= X-Google-Smtp-Source: ABdhPJy2qVMxXKNr3ek/8uZHJhfqdv0pMON24WJCvXMF0xV/tJ2st7UPw0GYYt74N03IqvhFobpbmA== X-Received: by 2002:a63:8ac4:: with SMTP id y187mr1178047pgd.261.1642646928703; Wed, 19 Jan 2022 18:48:48 -0800 (PST) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id t9sm6687985pjg.44.2022.01.19.18.48.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jan 2022 18:48:48 -0800 (PST) Message-Id: <50bf6c36bedbcd4631f4828fcdd503079e7e2f99.1642646916.git.ffmpegagent@gmail.com> In-Reply-To: References: From: ffmpegagent Date: Thu, 20 Jan 2022 02:48:20 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v2 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".