[FFmpeg-cvslog] lavf: Don't explicitly flush after each written packet in muxers

Clément Bœsch git at videolan.org
Tue Sep 17 12:21:50 CEST 2013


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Mon Mar 25 00:23:46 2013 +0100| [73084391588b0f150737990038829cac5013dd68] | committer: Martin Storsjö

lavf: Don't explicitly flush after each written packet in muxers

Since 596e5d4783, this is not necessary anymore. It also allows to
actually disable the flushing, improving write performance (but
possibly giving worse latency in real-time streaming).

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=73084391588b0f150737990038829cac5013dd68
---

 libavformat/adtsenc.c     |    1 -
 libavformat/amr.c         |    1 -
 libavformat/assenc.c      |    3 ---
 libavformat/avienc.c      |    1 -
 libavformat/daud.c        |    1 -
 libavformat/dvenc.c       |    1 -
 libavformat/flacenc.c     |    1 -
 libavformat/flvenc.c      |    1 -
 libavformat/framecrcenc.c |    1 -
 libavformat/gif.c         |    1 -
 libavformat/gxfenc.c      |    2 --
 libavformat/ilbc.c        |    1 -
 libavformat/ivfenc.c      |    1 -
 libavformat/mpjpeg.c      |    1 -
 libavformat/rawenc.c      |    1 -
 libavformat/rmenc.c       |    2 --
 libavformat/smjpegenc.c   |    1 -
 libavformat/spdifenc.c    |    1 -
 libavformat/swfenc.c      |    2 --
 libavformat/vc1testenc.c  |    1 -
 libavformat/wvenc.c       |    1 -
 libavformat/yuv4mpeg.c    |    1 -
 22 files changed, 27 deletions(-)

diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index 0c91944..e7c9ca6 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -158,7 +158,6 @@ static int adts_write_packet(AVFormatContext *s, AVPacket *pkt)
         }
     }
     avio_write(pb, pkt->data, pkt->size);
-    avio_flush(pb);
 
     return 0;
 }
diff --git a/libavformat/amr.c b/libavformat/amr.c
index ba91d7c..3b1a468 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -55,7 +55,6 @@ static int amr_write_header(AVFormatContext *s)
 static int amr_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     avio_write(s->pb, pkt->data, pkt->size);
-    avio_flush(s->pb);
     return 0;
 }
 #endif /* CONFIG_AMR_MUXER */
diff --git a/libavformat/assenc.c b/libavformat/assenc.c
index 5bf2e20..751485d 100644
--- a/libavformat/assenc.c
+++ b/libavformat/assenc.c
@@ -58,9 +58,6 @@ static int write_header(AVFormatContext *s)
 static int write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     avio_write(s->pb, pkt->data, pkt->size);
-
-    avio_flush(s->pb);
-
     return 0;
 }
 
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 9d1f510..751687e 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -558,7 +558,6 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
     if (size & 1)
         avio_w8(pb, 0);
 
-    avio_flush(pb);
     return 0;
 }
 
diff --git a/libavformat/daud.c b/libavformat/daud.c
index 3ceb958..bb7ab7f 100644
--- a/libavformat/daud.c
+++ b/libavformat/daud.c
@@ -68,7 +68,6 @@ static int daud_write_packet(struct AVFormatContext *s, AVPacket *pkt)
     avio_wb16(s->pb, pkt->size);
     avio_wb16(s->pb, 0x8010); // unknown
     avio_write(s->pb, pkt->data, pkt->size);
-    avio_flush(s->pb);
     return 0;
 }
 
diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
index a991cc6..93ae0b5 100644
--- a/libavformat/dvenc.c
+++ b/libavformat/dvenc.c
@@ -388,7 +388,6 @@ static int dv_write_packet(struct AVFormatContext *s, AVPacket *pkt)
                               pkt->data, pkt->size, &frame);
     if (fsize > 0) {
         avio_write(s->pb, frame, fsize);
-        avio_flush(s->pb);
     }
     return 0;
 }
diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index b770623..1e4042e 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -113,7 +113,6 @@ static int flac_write_trailer(struct AVFormatContext *s)
 static int flac_write_packet(struct AVFormatContext *s, AVPacket *pkt)
 {
     avio_write(s->pb, pkt->data, pkt->size);
-    avio_flush(s->pb);
     return 0;
 }
 
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 37f3777..bcb135d 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -545,7 +545,6 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt)
                               pkt->pts + flv->delay + pkt->duration);
     }
 
-    avio_flush(pb);
     av_free(data);
 
     return pb->error;
diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c
index fed0cca..dd55c12 100644
--- a/libavformat/framecrcenc.c
+++ b/libavformat/framecrcenc.c
@@ -31,7 +31,6 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt)
     snprintf(buf, sizeof(buf), "%d, %10"PRId64", %10"PRId64", %8d, %8d, 0x%08x\n",
              pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size, crc);
     avio_write(s->pb, buf, strlen(buf));
-    avio_flush(s->pb);
     return 0;
 }
 
diff --git a/libavformat/gif.c b/libavformat/gif.c
index 2b1e93a..085c2e0 100644
--- a/libavformat/gif.c
+++ b/libavformat/gif.c
@@ -329,7 +329,6 @@ static int gif_write_video(AVFormatContext *s, AVCodecContext *enc,
     gif_image_write_image(pb, 0, 0, enc->width, enc->height,
                           buf, enc->width * 3, AV_PIX_FMT_RGB24);
 
-    avio_flush(s->pb);
     return 0;
 }
 
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index 74df237..fea1d5d 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -896,8 +896,6 @@ static int gxf_write_packet(AVFormatContext *s, AVPacket *pkt)
         gxf->packet_count = 0;
     }
 
-    avio_flush(pb);
-
     return 0;
 }
 
diff --git a/libavformat/ilbc.c b/libavformat/ilbc.c
index c01eb6f..e44af48 100644
--- a/libavformat/ilbc.c
+++ b/libavformat/ilbc.c
@@ -56,7 +56,6 @@ static int ilbc_write_header(AVFormatContext *s)
 static int ilbc_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     avio_write(s->pb, pkt->data, pkt->size);
-    avio_flush(s->pb);
     return 0;
 }
 
diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
index e045597..3cd1616 100644
--- a/libavformat/ivfenc.c
+++ b/libavformat/ivfenc.c
@@ -53,7 +53,6 @@ static int ivf_write_packet(AVFormatContext *s, AVPacket *pkt)
     avio_wl32(pb, pkt->size);
     avio_wl64(pb, pkt->pts);
     avio_write(pb, pkt->data, pkt->size);
-    avio_flush(pb);
 
     return 0;
 }
diff --git a/libavformat/mpjpeg.c b/libavformat/mpjpeg.c
index 6c8bd0c..2114189 100644
--- a/libavformat/mpjpeg.c
+++ b/libavformat/mpjpeg.c
@@ -44,7 +44,6 @@ static int mpjpeg_write_packet(AVFormatContext *s, AVPacket *pkt)
 
     snprintf(buf1, sizeof(buf1), "\n--%s\n", BOUNDARY_TAG);
     avio_write(s->pb, buf1, strlen(buf1));
-    avio_flush(s->pb);
     return 0;
 }
 
diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index 171c603..852a27d 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -26,7 +26,6 @@
 int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
     avio_write(s->pb, pkt->data, pkt->size);
-    avio_flush(s->pb);
     return 0;
 }
 
diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c
index ed1ba7c..fba8feb 100644
--- a/libavformat/rmenc.c
+++ b/libavformat/rmenc.c
@@ -369,7 +369,6 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int
     } else {
         avio_write(pb, buf, size);
     }
-    avio_flush(pb);
     stream->nb_frames++;
     av_free(buf1);
     return 0;
@@ -414,7 +413,6 @@ static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int
     avio_w8(pb, stream->nb_frames & 0xff);
 
     avio_write(pb, buf, size);
-    avio_flush(pb);
 
     stream->nb_frames++;
     return 0;
diff --git a/libavformat/smjpegenc.c b/libavformat/smjpegenc.c
index 5c64e84..551af89 100644
--- a/libavformat/smjpegenc.c
+++ b/libavformat/smjpegenc.c
@@ -109,7 +109,6 @@ static int smjpeg_write_packet(AVFormatContext *s, AVPacket *pkt)
     avio_wb32(pb, pkt->pts);
     avio_wb32(pb, pkt->size);
     avio_write(pb, pkt->data, pkt->size);
-    avio_flush(pb);
 
     smc->duration = FFMAX(smc->duration, pkt->pts + pkt->duration);
     return 0;
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index 1f37340..c350f72 100644
--- a/libavformat/spdifenc.c
+++ b/libavformat/spdifenc.c
@@ -538,7 +538,6 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt)
     av_log(s, AV_LOG_DEBUG, "type=%x len=%i pkt_offset=%i\n",
            ctx->data_type, ctx->out_bytes, ctx->pkt_offset);
 
-    avio_flush(s->pb);
     return 0;
 }
 
diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c
index 93487cc..be2e5cd 100644
--- a/libavformat/swfenc.c
+++ b/libavformat/swfenc.c
@@ -436,8 +436,6 @@ static int swf_write_video(AVFormatContext *s,
     put_swf_tag(s, TAG_SHOWFRAME);
     put_swf_end_tag(s);
 
-    avio_flush(s->pb);
-
     return 0;
 }
 
diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c
index abe8c6b..9d55fee 100644
--- a/libavformat/vc1testenc.c
+++ b/libavformat/vc1testenc.c
@@ -63,7 +63,6 @@ static int vc1test_write_packet(AVFormatContext *s, AVPacket *pkt)
     avio_wl32(pb, pkt->size | ((pkt->flags & AV_PKT_FLAG_KEY) ? 0x80000000 : 0));
     avio_wl32(pb, pkt->pts);
     avio_write(pb, pkt->data, pkt->size);
-    avio_flush(pb);
     ctx->frames++;
 
     return 0;
diff --git a/libavformat/wvenc.c b/libavformat/wvenc.c
index 0ce08e8..2e150e1 100644
--- a/libavformat/wvenc.c
+++ b/libavformat/wvenc.c
@@ -51,7 +51,6 @@ static int wv_write_packet(AVFormatContext *ctx, AVPacket *pkt)
     s->samples += header.samples;
 
     avio_write(ctx->pb, pkt->data, pkt->size);
-    avio_flush(ctx->pb);
 
     return 0;
 }
diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
index c38d641..cc2755f 100644
--- a/libavformat/yuv4mpeg.c
+++ b/libavformat/yuv4mpeg.c
@@ -147,7 +147,6 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
             ptr2 += picture->linesize[2];
         }
     }
-    avio_flush(pb);
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list