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 5AA3845AD9 for ; Fri, 16 Jun 2023 09:31:18 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0373468C5D3; Fri, 16 Jun 2023 12:30:32 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B197568C597 for ; Fri, 16 Jun 2023 12:30:27 +0300 (EEST) Received: from localhost (217-74-0-168.hsi.r-kom.net [217.74.0.168]) by haasn.dev (Postfix) with ESMTPSA id 58A5D424F2; Fri, 16 Jun 2023 11:30:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1686907827; bh=6sbsxwKPGn1jHabq8v1fJ72/ssvyDWP5vqO8aBJdwTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qfcM479Fyui4/9ozTobH+IirDjr3oAotqxqTBXbCdbcgPS9lo6Oe1cNAPruFBl0RI s71JSVUromvu/DhjbDucP8bXskQsNyYQLz3u32Lv3Q+Br0z/eeBHtdNk429UKMU2RF wYds5C+VW+Et4IWvvAp8c1HJ2BObuBKFH4IoXnXg= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Fri, 16 Jun 2023 11:29:51 +0200 Message-ID: <20230616092959.5247-14-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230616092959.5247-1-ffmpeg@haasn.xyz> References: <20230616092959.5247-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 14/22] lavfi/vf_libplacebo: only drain actually used PTS 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: Niklas Haas 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: Niklas Haas When combining multiple inputs, the output PTS may be less than the PTS of the input. In this case, the current's code assumption of always draining one value from the FIFO is incorrect. Replace by a smarter function which drains only those PTS values that were actually consumed. --- libavfilter/vf_libplacebo.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c index 5903bd5a01..896bdb4eb8 100644 --- a/libavfilter/vf_libplacebo.c +++ b/libavfilter/vf_libplacebo.c @@ -969,6 +969,13 @@ static int handle_input(AVFilterContext *ctx, LibplaceboInput *input) return 0; } +static void drain_input_pts(LibplaceboInput *in, int64_t until) +{ + int64_t pts; + while (av_fifo_peek(in->out_pts, &pts, 1, 0) >= 0 && pts <= until) + av_fifo_drain2(in->out_pts, 1); +} + static int libplacebo_activate(AVFilterContext *ctx) { int ret, retry = 0; @@ -1021,8 +1028,7 @@ static int libplacebo_activate(AVFilterContext *ctx) ff_inlink_request_frame(in->link); return 0; case PL_QUEUE_OK: - if (!s->fps.num) - av_fifo_drain2(in->out_pts, 1); + drain_input_pts(in, out_pts); return output_frame(ctx, out_pts); case PL_QUEUE_ERR: return AVERROR_EXTERNAL; -- 2.41.0 _______________________________________________ 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".