From patchwork Sun Jan 5 13:14:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17196 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 5B57744B762 for ; Sun, 5 Jan 2020 15:14:26 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 37DBD68ADE3; Sun, 5 Jan 2020 15:14:26 +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 BBDF968ADD9 for ; Sun, 5 Jan 2020 15:14:20 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 61302E3769; Sun, 5 Jan 2020 14:14:20 +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 EgV1CaGYMdTA; Sun, 5 Jan 2020 14:14:18 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 1DCCCE3756; Sun, 5 Jan 2020 14:14:18 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 5 Jan 2020 14:14:08 +0100 Message-Id: <20200105131413.22707-1-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: References: Subject: [FFmpeg-devel] [PATCH 1/6] avformat: remove unneded avio_flush() calls before calling avio_close_dyn_buf() 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" avio_close_dyn_buf() also does avio_flush(). Signed-off-by: Marton Balint --- libavformat/hlsenc.c | 2 -- libavformat/oggenc.c | 1 - libavformat/rtpdec.c | 2 -- 3 files changed, 5 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 561e3ff736..d130f03ea6 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -459,7 +459,6 @@ static int flush_dynbuf(VariantStream *vs, int *range_length) // flush av_write_frame(ctx, NULL); - avio_flush(ctx->pb); // write out to file *range_length = avio_close_dyn_buf(ctx->pb, &vs->temp_buffer); @@ -2548,7 +2547,6 @@ static int hls_write_trailer(struct AVFormatContext *s) if (!vs->init_range_length) { uint8_t *buffer = NULL; av_write_frame(oc, NULL); /* Flush any buffered data */ - avio_flush(oc->pb); range_length = avio_close_dyn_buf(oc->pb, &buffer); avio_write(vs->out, buffer, range_length); diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index d3ae07351d..04f7813083 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -133,7 +133,6 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) avio_write(pb, page->data, page->size); ogg_update_checksum(s, pb, crc_offset); - avio_flush(pb); size = avio_close_dyn_buf(pb, &buf); if (size < 0) diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c index e75a34cb93..3d5b200099 100644 --- a/libavformat/rtpdec.c +++ b/libavformat/rtpdec.c @@ -415,7 +415,6 @@ void ff_rtp_send_punch_packets(URLContext *rtp_handle) avio_wb32(pb, 0); /* Timestamp */ avio_wb32(pb, 0); /* SSRC */ - avio_flush(pb); len = avio_close_dyn_buf(pb, &buf); if ((len > 0) && buf) ffurl_write(rtp_handle, buf, len); @@ -430,7 +429,6 @@ void ff_rtp_send_punch_packets(URLContext *rtp_handle) avio_wb16(pb, 1); /* length in words - 1 */ avio_wb32(pb, 0); /* our own SSRC */ - avio_flush(pb); len = avio_close_dyn_buf(pb, &buf); if ((len > 0) && buf) ffurl_write(rtp_handle, buf, len); From patchwork Sun Jan 5 13:14:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17197 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 B3AF544B762 for ; Sun, 5 Jan 2020 15:14:29 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9B44168AE41; Sun, 5 Jan 2020 15:14:29 +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 A568E68AD3D for ; Sun, 5 Jan 2020 15:14:23 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 65D10E3756; Sun, 5 Jan 2020 14:14:23 +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 zBi26oxkKlny; Sun, 5 Jan 2020 14:14:20 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 2CFF1E3774; Sun, 5 Jan 2020 14:14:20 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 5 Jan 2020 14:14:09 +0100 Message-Id: <20200105131413.22707-2-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 2/6] avformat: remove uneeded avio_flush() calls from the end of write_header 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" The IO context is flushed by libavformat/mux.c after writing the header by calling avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_UNKNOWN), so this change should have no effect at all. Signed-off-by: Marton Balint --- libavformat/aiffenc.c | 3 --- libavformat/amr.c | 1 - libavformat/asfenc.c | 2 -- libavformat/assenc.c | 1 - libavformat/astenc.c | 2 -- libavformat/au.c | 1 - libavformat/avienc.c | 2 -- libavformat/cafenc.c | 1 - libavformat/ffmetaenc.c | 1 - libavformat/framehash.c | 1 - libavformat/gxfenc.c | 1 - libavformat/icoenc.c | 2 -- libavformat/idroqenc.c | 1 - libavformat/ilbc.c | 1 - libavformat/jacosubenc.c | 1 - libavformat/matroskaenc.c | 2 -- libavformat/microdvdenc.c | 1 - libavformat/mmf.c | 2 -- libavformat/movenc.c | 1 - libavformat/mpjpeg.c | 1 - libavformat/nutenc.c | 2 -- libavformat/rmenc.c | 1 - libavformat/rsoenc.c | 2 -- libavformat/smjpegenc.c | 1 - libavformat/soxenc.c | 2 -- libavformat/swfenc.c | 1 - libavformat/wavenc.c | 2 -- libavformat/webvttenc.c | 1 - 28 files changed, 40 deletions(-) diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index e25794d185..ec2c7db09a 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -199,9 +199,6 @@ static int aiff_write_header(AVFormatContext *s) avpriv_set_pts_info(s->streams[aiff->audio_stream_idx], 64, 1, s->streams[aiff->audio_stream_idx]->codecpar->sample_rate); - /* Data is starting here */ - avio_flush(pb); - return 0; } diff --git a/libavformat/amr.c b/libavformat/amr.c index 42840a50a3..650b565b1b 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -60,7 +60,6 @@ static int amr_write_header(AVFormatContext *s) } else { return -1; } - avio_flush(pb); return 0; } diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index 44e11fc763..d03cff91c0 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -801,8 +801,6 @@ static int asf_write_header(AVFormatContext *s) return -1; } - avio_flush(s->pb); - asf->packet_nb_payloads = 0; asf->packet_timestamp_start = -1; asf->packet_timestamp_end = -1; diff --git a/libavformat/assenc.c b/libavformat/assenc.c index 12aadca171..68c3396e5a 100644 --- a/libavformat/assenc.c +++ b/libavformat/assenc.c @@ -77,7 +77,6 @@ static int write_header(AVFormatContext *s) avio_printf(s->pb, "[Events]\r\nFormat: %s, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n", ass->ssa_mode ? "Marked" : "Layer"); } - avio_flush(s->pb); return 0; } diff --git a/libavformat/astenc.c b/libavformat/astenc.c index 578e658891..d38a3aab38 100644 --- a/libavformat/astenc.c +++ b/libavformat/astenc.c @@ -101,8 +101,6 @@ static int ast_write_header(AVFormatContext *s) avio_wb64(pb, 0); avio_wb32(pb, 0); - avio_flush(pb); - return 0; } diff --git a/libavformat/au.c b/libavformat/au.c index cb48e67feb..19a0f56963 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -311,7 +311,6 @@ static int au_write_header(AVFormatContext *s) } else { avio_wb64(pb, 0); /* annotation field */ } - avio_flush(pb); return 0; } diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 940ea33510..23cc58ea76 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -580,8 +580,6 @@ static int avi_write_header(AVFormatContext *s) avi->movi_list = ff_start_tag(pb, "LIST"); ffio_wfourcc(pb, "movi"); - avio_flush(pb); - return 0; } diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c index 0f7c4ebbb3..8fe1dcef19 100644 --- a/libavformat/cafenc.c +++ b/libavformat/cafenc.c @@ -203,7 +203,6 @@ static int caf_write_header(AVFormatContext *s) avio_wb64(pb, -1); //< mChunkSize avio_wb32(pb, 0); //< mEditCount - avio_flush(pb); return 0; } diff --git a/libavformat/ffmetaenc.c b/libavformat/ffmetaenc.c index a9adbb1d19..800fb1887c 100644 --- a/libavformat/ffmetaenc.c +++ b/libavformat/ffmetaenc.c @@ -54,7 +54,6 @@ static int write_header(AVFormatContext *s) avio_write(s->pb, ID_STRING, sizeof(ID_STRING) - 1); avio_w8(s->pb, '1'); // version avio_w8(s->pb, '\n'); - avio_flush(s->pb); return 0; } diff --git a/libavformat/framehash.c b/libavformat/framehash.c index 3ae9092c61..8d90793d7c 100644 --- a/libavformat/framehash.c +++ b/libavformat/framehash.c @@ -45,7 +45,6 @@ int ff_framehash_write_header(AVFormatContext *s) avio_printf(s->pb, "#sar %d: %d/%d\n", i, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); break; } - avio_flush(s->pb); } return 0; } diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index ad9ddea887..c9fb0dcd91 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -834,7 +834,6 @@ static int gxf_write_header(AVFormatContext *s) gxf->packet_count = 3; - avio_flush(pb); return 0; } diff --git a/libavformat/icoenc.c b/libavformat/icoenc.c index 975c3466bf..a7df8b72bc 100644 --- a/libavformat/icoenc.c +++ b/libavformat/icoenc.c @@ -106,8 +106,6 @@ static int ico_write_header(AVFormatContext *s) if (!ico->images) return AVERROR(ENOMEM); - avio_flush(pb); - return 0; } diff --git a/libavformat/idroqenc.c b/libavformat/idroqenc.c index 8122efef83..261f21939c 100644 --- a/libavformat/idroqenc.c +++ b/libavformat/idroqenc.c @@ -55,7 +55,6 @@ static int roq_write_header(struct AVFormatContext *s) } avio_write(s->pb, header, 8); - avio_flush(s->pb); return 0; } diff --git a/libavformat/ilbc.c b/libavformat/ilbc.c index ba11953b59..01c7112ad1 100644 --- a/libavformat/ilbc.c +++ b/libavformat/ilbc.c @@ -49,7 +49,6 @@ static int ilbc_write_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "Unsupported mode\n"); return AVERROR(EINVAL); } - avio_flush(pb); return 0; } diff --git a/libavformat/jacosubenc.c b/libavformat/jacosubenc.c index 0954f5f058..77575c6b3c 100644 --- a/libavformat/jacosubenc.c +++ b/libavformat/jacosubenc.c @@ -25,7 +25,6 @@ static int jacosub_write_header(AVFormatContext *s) if (par->extradata_size) { avio_write(s->pb, par->extradata, par->extradata_size - 1); - avio_flush(s->pb); } return 0; } diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 9dcd1946e8..4b6d14b435 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -2000,8 +2000,6 @@ static int mkv_write_header(AVFormatContext *s) mkv->cur_audio_pkt.size = 0; mkv->cluster_pos = -1; - avio_flush(pb); - // start a new cluster every 5 MB or 5 sec, or 32k / 1 sec for streaming or // after 4k and on a keyframe if (pb->seekable & AVIO_SEEKABLE_NORMAL) { diff --git a/libavformat/microdvdenc.c b/libavformat/microdvdenc.c index 80e6fa8674..1cd215d8de 100644 --- a/libavformat/microdvdenc.c +++ b/libavformat/microdvdenc.c @@ -37,7 +37,6 @@ static int microdvd_write_header(struct AVFormatContext *s) avio_write(s->pb, "{DEFAULT}{}", 11); avio_write(s->pb, par->extradata, par->extradata_size); avio_w8(s->pb, '\n'); - avio_flush(s->pb); } avpriv_set_pts_info(s->streams[0], 64, framerate.num, framerate.den); diff --git a/libavformat/mmf.c b/libavformat/mmf.c index 917113066a..4e087fc920 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -123,8 +123,6 @@ static int mmf_write_header(AVFormatContext *s) avpriv_set_pts_info(s->streams[0], 64, 1, s->streams[0]->codecpar->sample_rate); - avio_flush(pb); - return 0; } diff --git a/libavformat/movenc.c b/libavformat/movenc.c index e422bdd071..e20eea7571 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6579,7 +6579,6 @@ static int mov_write_header(AVFormatContext *s) !(mov->flags & FF_MOV_FLAG_DELAY_MOOV)) { if ((ret = mov_write_moov_tag(pb, mov, s)) < 0) return ret; - avio_flush(pb); mov->moov_written = 1; if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX) mov->reserved_header_pos = avio_tell(pb); diff --git a/libavformat/mpjpeg.c b/libavformat/mpjpeg.c index 80f83c5871..e410e84801 100644 --- a/libavformat/mpjpeg.c +++ b/libavformat/mpjpeg.c @@ -34,7 +34,6 @@ static int mpjpeg_write_header(AVFormatContext *s) { MPJPEGContext *mpj = s->priv_data; avio_printf(s->pb, "--%s\r\n", mpj->boundary_tag); - avio_flush(s->pb); return 0; } diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 46dce7722d..44773924dd 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -768,8 +768,6 @@ static int nut_write_header(AVFormatContext *s) if (s->avoid_negative_ts < 0) s->avoid_negative_ts = 1; - avio_flush(bc); - return 0; } diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c index 3bff4daf0a..e137dbc44f 100644 --- a/libavformat/rmenc.c +++ b/libavformat/rmenc.c @@ -360,7 +360,6 @@ static int rm_write_header(AVFormatContext *s) if (rv10_write_header(s, 0, 0)) return AVERROR_INVALIDDATA; - avio_flush(s->pb); return 0; } diff --git a/libavformat/rsoenc.c b/libavformat/rsoenc.c index e34e2c64e2..3159f0c427 100644 --- a/libavformat/rsoenc.c +++ b/libavformat/rsoenc.c @@ -60,8 +60,6 @@ static int rso_write_header(AVFormatContext *s) avio_wb16(pb, par->sample_rate); avio_wb16(pb, 0x0000); /* play mode ? (0x0000 = don't loop) */ - avio_flush(pb); - return 0; } diff --git a/libavformat/smjpegenc.c b/libavformat/smjpegenc.c index 68a128647e..c3c1a6346c 100644 --- a/libavformat/smjpegenc.c +++ b/libavformat/smjpegenc.c @@ -88,7 +88,6 @@ static int smjpeg_write_header(AVFormatContext *s) } avio_wl32(pb, SMJPEG_HEND); - avio_flush(pb); return 0; } diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c index 7b37bd4848..7259131b03 100644 --- a/libavformat/soxenc.c +++ b/libavformat/soxenc.c @@ -80,8 +80,6 @@ static int sox_write_header(AVFormatContext *s) ffio_fill(pb, 0, comment_size - comment_len); - avio_flush(pb); - return 0; } diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index f53db0fb2b..84f924eda5 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -337,7 +337,6 @@ static int swf_write_header(AVFormatContext *s) put_swf_end_tag(s); } - avio_flush(s->pb); return 0; } diff --git a/libavformat/wavenc.c b/libavformat/wavenc.c index 2b28149056..c44d6d26e9 100644 --- a/libavformat/wavenc.c +++ b/libavformat/wavenc.c @@ -361,8 +361,6 @@ static int wav_write_header(AVFormatContext *s) wav->data = ff_start_tag(pb, "data"); } - avio_flush(pb); - return 0; } diff --git a/libavformat/webvttenc.c b/libavformat/webvttenc.c index 61b7f54622..cbd989dcb6 100644 --- a/libavformat/webvttenc.c +++ b/libavformat/webvttenc.c @@ -57,7 +57,6 @@ static int webvtt_write_header(AVFormatContext *ctx) avpriv_set_pts_info(s, 64, 1, 1000); avio_printf(pb, "WEBVTT\n"); - avio_flush(pb); return 0; } From patchwork Sun Jan 5 13:14:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17198 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 A44F844B762 for ; Sun, 5 Jan 2020 15:14:31 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 80F8B68AE5E; Sun, 5 Jan 2020 15:14:31 +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 ACF8D68ADE4 for ; Sun, 5 Jan 2020 15:14:25 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 7128CE3770; Sun, 5 Jan 2020 14:14:25 +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 YNaUulMY0KO2; Sun, 5 Jan 2020 14:14:23 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 1F604E377F; Sun, 5 Jan 2020 14:14:22 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 5 Jan 2020 14:14:10 +0100 Message-Id: <20200105131413.22707-3-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 3/6] avformat: remove uneeded avio_flush() calls from the end of write_trailer 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" The IO context is always flushed by libavformat/mux.c after write_trailer is called, so this change should have no effect at all. --- libavformat/aiffenc.c | 2 -- libavformat/astenc.c | 1 - libavformat/au.c | 1 - libavformat/cafenc.c | 1 - libavformat/flacenc.c | 1 - libavformat/hashenc.c | 1 - libavformat/mmf.c | 2 -- libavformat/mpegenc.c | 1 - libavformat/soxenc.c | 2 -- libavformat/ttaenc.c | 1 - libavformat/vc1testenc.c | 1 - libavformat/wavenc.c | 2 -- libavformat/wtvenc.c | 2 -- 13 files changed, 18 deletions(-) diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index ec2c7db09a..0145596bec 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -263,8 +263,6 @@ static int aiff_write_trailer(AVFormatContext *s) file_size = avio_tell(pb); avio_seek(pb, aiff->form, SEEK_SET); avio_wb32(pb, file_size - aiff->form - 4); - - avio_flush(pb); } return ret; diff --git a/libavformat/astenc.c b/libavformat/astenc.c index d38a3aab38..e0b94b8b63 100644 --- a/libavformat/astenc.c +++ b/libavformat/astenc.c @@ -178,7 +178,6 @@ static int ast_write_trailer(AVFormatContext *s) } avio_seek(pb, file_size, SEEK_SET); - avio_flush(pb); } return 0; } diff --git a/libavformat/au.c b/libavformat/au.c index 19a0f56963..4afee85a94 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -326,7 +326,6 @@ static int au_write_trailer(AVFormatContext *s) avio_seek(pb, 8, SEEK_SET); avio_wb32(pb, (uint32_t)(file_size - au->header_size)); avio_seek(pb, file_size, SEEK_SET); - avio_flush(pb); } return 0; diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c index 8fe1dcef19..98d4d9212f 100644 --- a/libavformat/cafenc.c +++ b/libavformat/cafenc.c @@ -258,7 +258,6 @@ static int caf_write_trailer(AVFormatContext *s) avio_write(pb, caf->pkt_sizes, caf->size_entries_used); caf->size_buffer_size = 0; } - avio_flush(pb); } av_freep(&caf->pkt_sizes); return 0; diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index abbed38f89..1aae0c97e0 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -349,7 +349,6 @@ static int flac_write_trailer(struct AVFormatContext *s) avio_seek(pb, 8, SEEK_SET); avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE); avio_seek(pb, file_size, SEEK_SET); - avio_flush(pb); } else { av_log(s, AV_LOG_WARNING, "unable to rewrite FLAC header.\n"); } diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c index 34a8fd1f50..ddc67f53b5 100644 --- a/libavformat/hashenc.c +++ b/libavformat/hashenc.c @@ -152,7 +152,6 @@ static int hash_write_trailer(struct AVFormatContext *s) av_hash_final_hex(c->hashes[i], buf + strlen(buf), sizeof(buf) - strlen(buf)); av_strlcatf(buf, sizeof(buf), "\n"); avio_write(s->pb, buf, strlen(buf)); - avio_flush(s->pb); } return 0; diff --git a/libavformat/mmf.c b/libavformat/mmf.c index 4e087fc920..e4768db064 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -171,8 +171,6 @@ static int mmf_write_trailer(AVFormatContext *s) avio_write(pb, "\x00\x00\x00\x00", 4); avio_seek(pb, pos, SEEK_SET); - - avio_flush(pb); } return 0; } diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index f6980231a2..f8039a42c0 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -1244,7 +1244,6 @@ static int mpeg_mux_end(AVFormatContext *ctx) * it as it is usually not needed by decoders and because it * complicates MPEG stream concatenation. */ // avio_wb32(ctx->pb, ISO_11172_END_CODE); - // avio_flush(ctx->pb); for (i = 0; i < ctx->nb_streams; i++) { stream = ctx->streams[i]->priv_data; diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c index 7259131b03..ce276f88b5 100644 --- a/libavformat/soxenc.c +++ b/libavformat/soxenc.c @@ -99,8 +99,6 @@ static int sox_write_trailer(AVFormatContext *s) } else avio_wb64(pb, num_samples); avio_seek(pb, file_size, SEEK_SET); - - avio_flush(pb); } return 0; diff --git a/libavformat/ttaenc.c b/libavformat/ttaenc.c index 73c29ae936..4860aab4c1 100644 --- a/libavformat/ttaenc.c +++ b/libavformat/ttaenc.c @@ -154,7 +154,6 @@ static int tta_write_trailer(AVFormatContext *s) tta_queue_flush(s); ff_ape_write_tag(s); - avio_flush(s->pb); return 0; } diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c index cf95d1d80d..1365bdd660 100644 --- a/libavformat/vc1testenc.c +++ b/libavformat/vc1testenc.c @@ -76,7 +76,6 @@ static int vc1test_write_trailer(AVFormatContext *s) if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) { avio_seek(pb, 0, SEEK_SET); avio_wl24(pb, ctx->frames); - avio_flush(pb); } return 0; } diff --git a/libavformat/wavenc.c b/libavformat/wavenc.c index c44d6d26e9..ea7573139c 100644 --- a/libavformat/wavenc.c +++ b/libavformat/wavenc.c @@ -478,7 +478,6 @@ static int wav_write_trailer(AVFormatContext *s) avio_wl32(pb, -1); avio_seek(pb, file_size, SEEK_SET); - avio_flush(pb); } } @@ -605,7 +604,6 @@ static int w64_write_trailer(AVFormatContext *s) } avio_seek(pb, file_size, SEEK_SET); - avio_flush(pb); } return 0; diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c index 4a68b8133f..498bc64019 100644 --- a/libavformat/wtvenc.c +++ b/libavformat/wtvenc.c @@ -823,8 +823,6 @@ static int write_trailer(AVFormatContext *s) avio_seek(pb, 0x5c, SEEK_SET); avio_wl32(pb, file_end_pos >> WTV_SECTOR_BITS); - avio_flush(pb); - av_free(wctx->sp_pairs); av_free(wctx->st_pairs); av_packet_unref(&wctx->thumbnail); 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; } From patchwork Sun Jan 5 13:14:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17200 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 5B80D44B762 for ; Sun, 5 Jan 2020 15:14:37 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 448ED68AE58; Sun, 5 Jan 2020 15:14:37 +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 8E5EE68AC2D for ; Sun, 5 Jan 2020 15:14:30 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 57A93E3756; Sun, 5 Jan 2020 14:14:30 +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 wlCcIXb6wihE; Sun, 5 Jan 2020 14:14:28 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 46412E3769; Sun, 5 Jan 2020 14:14:28 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 5 Jan 2020 14:14:12 +0100 Message-Id: <20200105131413.22707-5-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 5/6] avformat: remove more unneeded avio_flush() calls 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" These instances are simply redundant or present because avio_flush() used to be required before doing a seekback. That is no longer the case, aviobuf code does the flush automatically on seek. This only affects code which is either disabled for streaming IO contexts or does no seekbacks after the flush, so this change should have no adverse effect on streaming. Signed-off-by: Marton Balint --- libavformat/asfenc.c | 1 - libavformat/avienc.c | 1 - libavformat/gxfenc.c | 2 -- libavformat/segafilmenc.c | 2 -- libavformat/wavenc.c | 7 ------- 5 files changed, 13 deletions(-) diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index d03cff91c0..8eaa9d40ce 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -1130,7 +1130,6 @@ static int asf_write_trailer(AVFormatContext *s) return ret; asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->next_start_sec); } - avio_flush(s->pb); if (asf->is_streamed || !(s->pb->seekable & AVIO_SEEKABLE_NORMAL)) { put_chunk(s, 0x4524, 0, 0); /* end of stream */ diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 23cc58ea76..d6cfb1b783 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -591,7 +591,6 @@ static void update_odml_entry(AVFormatContext *s, int stream_index, int64_t ix, int64_t pos; int au_byterate, au_ssize, au_scale; - avio_flush(pb); pos = avio_tell(pb); /* Updating one entry in the AVI OpenDML master index */ diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index c9fb0dcd91..e09b8d7625 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -863,13 +863,11 @@ static int gxf_write_trailer(AVFormatContext *s) return ret; gxf_write_flt_packet(s); gxf_write_umf_packet(s); - avio_flush(pb); /* update duration in all map packets */ for (i = 1; i < gxf->map_offsets_nb; i++) { avio_seek(pb, gxf->map_offsets[i], SEEK_SET); if ((ret = gxf_write_map_packet(s, 1)) < 0) return ret; - avio_flush(pb); } avio_seek(pb, end, SEEK_SET); diff --git a/libavformat/segafilmenc.c b/libavformat/segafilmenc.c index f1048ff808..812d0ad64e 100644 --- a/libavformat/segafilmenc.c +++ b/libavformat/segafilmenc.c @@ -362,8 +362,6 @@ static int film_write_header(AVFormatContext *format_context) avio_wb32(pb, film->packet_count); - avio_flush(pb); - /* Finally, write out each packet's data to the header */ packet = film->start; while (packet != NULL) { diff --git a/libavformat/wavenc.c b/libavformat/wavenc.c index ea7573139c..f6f5710802 100644 --- a/libavformat/wavenc.c +++ b/libavformat/wavenc.c @@ -411,17 +411,13 @@ static int wav_write_trailer(AVFormatContext *s) int rf64 = 0; int ret = 0; - avio_flush(pb); - if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) { if (wav->write_peak != PEAK_ONLY && avio_tell(pb) - wav->data < UINT32_MAX) { ff_end_tag(pb, wav->data); - avio_flush(pb); } if (wav->write_peak && wav->peak_output) { ret = peak_write_chunk(s); - avio_flush(pb); } /* update file size */ @@ -433,8 +429,6 @@ static int wav_write_trailer(AVFormatContext *s) avio_seek(pb, 4, SEEK_SET); avio_wl32(pb, (uint32_t)(file_size - 8)); avio_seek(pb, file_size, SEEK_SET); - - avio_flush(pb); } else { av_log(s, AV_LOG_ERROR, "Filesize %"PRId64" invalid for wav, output file will be broken\n", @@ -454,7 +448,6 @@ static int wav_write_trailer(AVFormatContext *s) } else { avio_wl32(pb, number_of_samples); avio_seek(pb, file_size, SEEK_SET); - avio_flush(pb); } } From patchwork Sun Jan 5 13:14:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17201 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 5F3F444B762 for ; Sun, 5 Jan 2020 15:14:41 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4B25A68AE72; Sun, 5 Jan 2020 15:14:41 +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 D5CA268ADD9 for ; Sun, 5 Jan 2020 15:14:34 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id B0A7CE314D; Sun, 5 Jan 2020 14:14:34 +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 0td2BJVjkxpU; Sun, 5 Jan 2020 14:14:32 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 3C9B0E377B; Sun, 5 Jan 2020 14:14:32 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 5 Jan 2020 14:14:13 +0100 Message-Id: <20200105131413.22707-6-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 6/6] avformat: convert some avio_flush() calls to avio_write_marker(AVIO_DATA_MARKER_FLUSH_POINT) 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" Converting 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 FLUSH_POINT flushing behaviour using the -flush_packets option, the default typically means to flush unless a non-streamed file output is used, so this change should have no adverse effect on streaming even if it is assumed that after an avio_flush() the output buffer is clean so small seekbacks within the output buffer will work even when the IO context is not seekable. Signed-off-by: Marton Balint --- libavformat/asfenc.c | 3 ++- libavformat/matroskaenc.c | 2 +- libavformat/movenc.c | 8 ++++---- libavformat/mpegenc.c | 4 ++-- libavformat/mxfenc.c | 2 +- libavformat/oggenc.c | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index 8eaa9d40ce..73afb13200 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -892,7 +892,8 @@ static void flush_packet(AVFormatContext *s) avio_write(s->pb, asf->packet_buf, s->packet_size - packet_hdr_size); - avio_flush(s->pb); + avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT); + asf->nb_packets++; asf->packet_nb_payloads = 0; asf->packet_timestamp_start = -1; diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 4b6d14b435..71c9afb15c 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -2235,7 +2235,7 @@ static void mkv_end_cluster(AVFormatContext *s) end_ebml_master_crc32(s->pb, &mkv->cluster_bc, mkv); mkv->cluster_pos = -1; - avio_flush(s->pb); + avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT); } static int mkv_check_new_extra_data(AVFormatContext *s, AVPacket *pkt) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index e20eea7571..1d9497283f 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5152,7 +5152,7 @@ static int mov_flush_fragment(AVFormatContext *s, int force) if (mov->flags & FF_MOV_FLAG_DELAY_MOOV) { if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX) mov->reserved_header_pos = avio_tell(s->pb); - avio_flush(s->pb); + avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT); mov->moov_written = 1; return 0; } @@ -5176,7 +5176,7 @@ static int mov_flush_fragment(AVFormatContext *s, int force) mov->tracks[i].entry = 0; mov->tracks[i].end_reliable = 0; } - avio_flush(s->pb); + avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT); return 0; } @@ -5241,7 +5241,7 @@ static int mov_flush_fragment(AVFormatContext *s, int force) } if (write_moof) { - avio_flush(s->pb); + avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT); mov_write_moof_tag(s->pb, mov, moof_tracks, mdat_size); mov->fragments++; @@ -5273,7 +5273,7 @@ static int mov_flush_fragment(AVFormatContext *s, int force) mov->mdat_size = 0; - avio_flush(s->pb); + avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT); return 0; } diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index f8039a42c0..669ff9d152 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -928,7 +928,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, for (i = 0; i < zero_trail_bytes; i++) avio_w8(ctx->pb, 0x00); - avio_flush(ctx->pb); + avio_write_marker(ctx->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT); s->packet_number++; @@ -957,7 +957,7 @@ static void put_vcd_padding_sector(AVFormatContext *ctx) s->vcd_padding_bytes_written += s->packet_size; - avio_flush(ctx->pb); + avio_write_marker(ctx->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT); /* increasing the packet number is correct. The SCR of the following packs * is calculated from the packet_number and it has to include the padding diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 396768d51f..374a83d069 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -1936,7 +1936,7 @@ static int mxf_write_partition(AVFormatContext *s, int bodysid, } if(key) - avio_flush(pb); + avio_write_marker(pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT); return 0; } diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index 04f7813083..fe89f23e36 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -139,7 +139,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) return size; avio_write(s->pb, buf, size); - avio_flush(s->pb); + avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_FLUSH_POINT); av_free(buf); oggstream->page_count--; return 0;