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 46439460A8 for ; Tue, 4 Jul 2023 05:08:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A7DCC68C449; Tue, 4 Jul 2023 08:08:51 +0300 (EEST) Received: from MTA-07-3.privateemail.com (mta-07-3.privateemail.com [198.54.118.214]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B720E68C366 for ; Tue, 4 Jul 2023 08:08:44 +0300 (EEST) Received: from mta-07.privateemail.com (localhost [127.0.0.1]) by mta-07.privateemail.com (Postfix) with ESMTP id D88D618000BA for ; Tue, 4 Jul 2023 01:08:40 -0400 (EDT) Received: from EAS-10 (unknown [10.50.14.248]) by mta-07.privateemail.com (Postfix) with ESMTPA id B3C7E18000A1 for ; Tue, 4 Jul 2023 01:08:40 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lemler.family; s=default; t=1688447320; bh=sHRnnDop2xdCb1VIXCjTaNKJsLHtSVzxXH5FaOKPJjA=; h=From:To:Subject:Date:From; b=BsBcbEB6WER7kBGoLiNLouD1Jr6fDLuwpUb0IlY75dlBpFgbNVIFgWuFbYpF+pVEA BANBsS9cVOQE6ey9nd21+Aj0YK/AebJE9HIxki9n00oXA8JJigq8XcUW7ezh1LPnva XXiPgrUr8EyzvzKCTvsuehQpPL2I81lpAWfprSPdzrl0xxhCTy0NKQ0JUQlRE6ROV5 HH9F/4ZaRBxmKyagag/AzyTzYAckqfEoF7DfNDQrdJb9Opaxz9rKvs1C1+z4aGlmCb NbNv9qEBp545muq7t12O9FkIf5+FLOEsF1fV0fCw7MSXNjSXuxdf+/JgqwEhQgFzDQ /8PbqPzq1rj0Q== X-Header: Open-Xchange USM Mailer (USM Version: 7.10.6-4, EAS Version: 7.10.6-6, Build e35e63b749ebb3437d8208dad0793e43aace07d1) From: David Lemler To: ffmpeg-devel@ffmpeg.org Date: Tue, 4 Jul 2023 00:08:39 -0500 Message-ID: <1970349688.12787.1688447320689@localhost> MIME-Version: 1.0 X-Mailer: Open-Xchange Mailer v7.10.6-Rev47 Thread-Index: AdmuMfdQd6r7Fx/aQlGmy8+xsX1zKA== Content-Language: en-us X-Originating-Client: USM-EAS X-Virus-Scanned: ClamAV using ClamSMTP Subject: [FFmpeg-devel] [PATCH] lavc/libvpxenc: prevent fifo from filling up 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 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: Prevent the fifo used in encoding VPx videos from filling up and stopping encode when it reaches 21845 items, which happens when the video has more than that number of frames. This problem occurs when performing the first pass of a 2-pass encode, as otherwise, the fifo is properly drained, preventing it from overflowing. Problem is fixed by manually draining the fifo when performing the first pass of a 2-pass encode. Fixes the regression originally introduced in 5bda4ec6c3cb6f286bb40dee4457c3c26e0f78cb Signed-off-by: David Lemler --- libavcodec/libvpxenc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 8833df2d68..e4ab13e6ab 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -1452,6 +1452,12 @@ static int queue_frames(AVCodecContext *avctx, struct vpx_codec_ctx *encoder, memcpy((uint8_t*)stats->buf + stats->sz, pkt->data.twopass_stats.buf, pkt->data.twopass_stats.sz); stats->sz += pkt->data.twopass_stats.sz; + /* Drain the fifo if it has any items in it to prevent it from + filling up when performing the first pass of a 2-pass encode if + the video has more than 21845 frames. */ + if (av_fifo_can_read(ctx->fifo) > 0) { + av_fifo_drain2(ctx->fifo, 1); + } break; } case VPX_CODEC_PSNR_PKT: -- 2.41.0.windows.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".