From patchwork Sun Jan 5 13:14:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17199 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id A442D44B762 for ; Sun, 5 Jan 2020 15:14:33 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9508C68AE67; Sun, 5 Jan 2020 15:14:33 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 793FE68AE58 for ; Sun, 5 Jan 2020 15:14:27 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 4EE44E3775; Sun, 5 Jan 2020 14:14:27 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a5Qfa8T3FN3e; Sun, 5 Jan 2020 14:14:25 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 61A92E377B; Sun, 5 Jan 2020 14:14:25 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 5 Jan 2020 14:14:11 +0100 Message-Id: <20200105131413.22707-4-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200105131413.22707-1-cus@passwd.hu> References: <20200105131413.22707-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 4/6] avformat: remove avio_flush() calls from the end of write_packet functions X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Removing explicit avio_flush() calls helps us to buffer more data and avoid flushing the IO context too often which causes reduced IO throughput for non-streamed file output. The user can control flushing behaviour at the end of every packet using the -flush_packets option, the default typically means to flush unless a non-streamed file output is used. Therefore this change should have no adverse effect on streaming, even if it is assumed that a new packet has a clean buffer so small seekbacks within the output buffer work even when the IO context is not seekable. Signed-off-by: Marton Balint --- libavformat/hashenc.c | 1 - libavformat/img2enc.c | 1 - libavformat/mxfenc.c | 3 --- 3 files changed, 5 deletions(-) diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c index ddc67f53b5..ce609f6efa 100644 --- a/libavformat/hashenc.c +++ b/libavformat/hashenc.c @@ -324,7 +324,6 @@ static int framehash_write_packet(struct AVFormatContext *s, AVPacket *pkt) } avio_printf(s->pb, "\n"); - avio_flush(s->pb); return 0; } diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c index 39398f37a3..5ee99890ce 100644 --- a/libavformat/img2enc.c +++ b/libavformat/img2enc.c @@ -118,7 +118,6 @@ static int write_packet_pipe(AVFormatContext *s, AVPacket *pkt) return ret; } else { avio_write(s->pb, pkt->data, pkt->size); - avio_flush(s->pb); } img->img_number++; return 0; diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index e187b3845d..396768d51f 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2799,7 +2799,6 @@ static int mxf_write_opatom_packet(AVFormatContext *s, AVPacket *pkt, MXFIndexEn mxf->edit_units_count++; avio_write(pb, pkt->data, pkt->size); mxf->body_offset += pkt->size; - avio_flush(pb); return 0; } @@ -2937,8 +2936,6 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt) mxf->body_offset += 16+4+pkt->size + klv_fill_size(16+4+pkt->size); } - avio_flush(pb); - return 0; }