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 D02AA42B06 for ; Tue, 11 Jan 2022 20:48:50 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D5E8368AF78; Tue, 11 Jan 2022 22:47:40 +0200 (EET) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 19EC568AE87 for ; Tue, 11 Jan 2022 22:47:34 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id E088324056A for ; Tue, 11 Jan 2022 21:47:32 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id mvFidiFG6K-U for ; Tue, 11 Jan 2022 21:47:31 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 1F978240179 for ; Tue, 11 Jan 2022 21:47:26 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 2AE493A0B4A; Tue, 11 Jan 2022 21:47:25 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 11 Jan 2022 21:45:51 +0100 Message-Id: <20220111204610.14262-16-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220111204610.14262-1-anton@khirnov.net> References: <20220111204610.14262-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 16/35] lavc/libvorbisenc: switch to new FIFO API 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: --- libavcodec/libvorbisenc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/libvorbisenc.c b/libavcodec/libvorbisenc.c index fa0d5f4b42..8db782b188 100644 --- a/libavcodec/libvorbisenc.c +++ b/libavcodec/libvorbisenc.c @@ -271,7 +271,7 @@ static av_cold int libvorbis_encode_init(AVCodecContext *avctx) avctx->frame_size = LIBVORBIS_FRAME_SIZE; ff_af_queue_init(avctx, &s->afq); - s->pkt_fifo = av_fifo_alloc(BUFFER_SIZE); + s->pkt_fifo = av_fifo_alloc2(BUFFER_SIZE, 1, 0); if (!s->pkt_fifo) { ret = AVERROR(ENOMEM); goto error; @@ -327,12 +327,12 @@ static int libvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, /* add any available packets to the output packet buffer */ while ((ret = vorbis_bitrate_flushpacket(&s->vd, &op)) == 1) { - if (av_fifo_space(s->pkt_fifo) < sizeof(ogg_packet) + op.bytes) { + if (av_fifo_can_write(s->pkt_fifo) < sizeof(ogg_packet) + op.bytes) { av_log(avctx, AV_LOG_ERROR, "packet buffer is too small\n"); return AVERROR_BUG; } - av_fifo_generic_write(s->pkt_fifo, &op, sizeof(ogg_packet), NULL); - av_fifo_generic_write(s->pkt_fifo, op.packet, op.bytes, NULL); + av_fifo_write(s->pkt_fifo, &op, sizeof(ogg_packet)); + av_fifo_write(s->pkt_fifo, op.packet, op.bytes); } if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "error getting available packets\n"); @@ -345,14 +345,14 @@ static int libvorbis_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, } /* check for available packets */ - if (av_fifo_size(s->pkt_fifo) < sizeof(ogg_packet)) + if (av_fifo_can_read(s->pkt_fifo) < sizeof(ogg_packet)) return 0; - av_fifo_generic_read(s->pkt_fifo, &op, sizeof(ogg_packet), NULL); + av_fifo_read(s->pkt_fifo, &op, sizeof(ogg_packet)); if ((ret = ff_get_encode_buffer(avctx, avpkt, op.bytes, 0)) < 0) return ret; - av_fifo_generic_read(s->pkt_fifo, avpkt->data, op.bytes, NULL); + av_fifo_read(s->pkt_fifo, avpkt->data, op.bytes); avpkt->pts = ff_samples_to_time_base(avctx, op.granulepos); -- 2.33.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".