[FFmpeg-devel] [PATCH] avcodec/mpeg4_unpack_bframes: make sure the packet is writable when data needs to changed
James Almer
jamrial at gmail.com
Thu Mar 22 03:41:03 EET 2018
Nothing currently guarantees that the packet passed to the bsf will
be writable.
Signed-off-by: James Almer <jamrial at gmail.com>
---
This supersedes "[PATCH 2/2] avcodec/mpeg4_unpack_bframes: allocate a
new packet when data needs to be changed"
libavcodec/mpeg4_unpack_bframes_bsf.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libavcodec/mpeg4_unpack_bframes_bsf.c b/libavcodec/mpeg4_unpack_bframes_bsf.c
index ba970794c5..3a0ba105f5 100644
--- a/libavcodec/mpeg4_unpack_bframes_bsf.c
+++ b/libavcodec/mpeg4_unpack_bframes_bsf.c
@@ -149,6 +149,9 @@ static int mpeg4_unpack_bframes_filter(AVBSFContext *ctx, AVPacket *out)
av_packet_move_ref(out, in);
out->size = pos_vop2;
} else if (pos_p >= 0) {
+ ret = av_packet_make_writable(in);
+ if (ret < 0)
+ goto fail;
av_log(ctx, AV_LOG_DEBUG, "Updating DivX userdata (remove trailing 'p').\n");
av_packet_move_ref(out, in);
/* remove 'p' (packed) from the end of the (DivX) userdata string */
--
2.16.2
More information about the ffmpeg-devel
mailing list