summaryrefslogtreecommitdiff
path: root/libavformat/mpegenc.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2019-12-27 13:53:00 +0100
committerMarton Balint <cus@passwd.hu>2020-01-07 21:51:45 +0100
commit3414115cd4e1eac555ebd3e9658cb9ba3c5b246b (patch)
treec94e3af27e71e10e31e7ed87de1834f13249ad6e /libavformat/mpegenc.c
parentf4a8ea7ff6fd83ec925cfd3fccde538196cff85a (diff)
avformat: convert some avio_flush() calls to avio_write_marker(AVIO_DATA_MARKER_FLUSH_POINT)
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 <cus@passwd.hu>
Diffstat (limited to 'libavformat/mpegenc.c')
-rw-r--r--libavformat/mpegenc.c4
1 files changed, 2 insertions, 2 deletions
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