diff mbox series

[FFmpeg-devel,25/25] avformat/matroskaenc: Write data directly into dynamic buffers

Message ID AM7PR03MB66609308F33127E45B4DBDBF8F569@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit e3c2a97a6d4e24d19f419325057ca2ab2fa37961
Headers show
Series [FFmpeg-devel,01/25] avformat/matroskaenc: Fix potential overflow | expand

Checks

Context Check Description
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 16, 2022, 11:04 p.m. UTC
This avoids copying the data in small chunks (1024B) into
the dynamic buffer's small buffer before finally writing them
into the "big" buffer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/matroskaenc.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 230bbf4a2c..82aab8b633 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2721,6 +2721,7 @@  static int mkv_write_packet_internal(AVFormatContext *s, const AVPacket *pkt)
         ret = start_ebml_master_crc32(&mkv->cluster_bc, mkv);
         if (ret < 0)
             return ret;
+        mkv->cluster_bc->direct = 1;
         mkv->cluster_pos = avio_tell(s->pb);
         put_ebml_uint(mkv->cluster_bc, MATROSKA_ID_CLUSTERTIMECODE, FFMAX(0, ts));
         mkv->cluster_pts = FFMAX(0, ts);