Skip to content

Commit fc40b33

Browse files
committed
Also do it for AVPacket.
1 parent e2d36e1 commit fc40b33

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Diff for: CHANGES

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
1.1.3 (2022-04-06)
22
=====
3-
* Use size of memory referred by AVFrame
4-
when allocating OCaml frame custom block
5-
to make sure the GC is diligent when cleaning
6-
up OCaml values referring to AVFrame.
3+
* Use size of memory referred by AVFrame and AVPacket
4+
when allocating OCaml frame custom block to make sure
5+
the GC is diligent when cleaning up OCaml values
6+
referring to AVFrame and AVPacket.
77

88
1.1.2 (2022-03-13)
99
=====

Diff for: avcodec/avcodec_stubs.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,12 @@ value value_of_ffmpeg_packet(AVPacket *packet) {
144144
if (!packet)
145145
Fail("Empty packet");
146146

147-
ret = caml_alloc_custom(&packet_ops, sizeof(AVPacket *), 0, 1);
147+
int size = 0;
148+
149+
if (packet->buf)
150+
size = packet->buf->size;
151+
152+
ret = caml_alloc_custom_mem(&packet_ops, sizeof(AVPacket *), size);
148153
Packet_val(ret) = packet;
149154

150155
return ret;

0 commit comments

Comments
 (0)