Message ID | 20180322014103.8168-1-jamrial@gmail.com |
---|---|
State | Accepted |
Commit | 4f2ff3a53e170d77e1dd231d7246a74e186011c9 |
Headers | show |
On Wed, Mar 21, 2018 at 10:41:03PM -0300, James Almer wrote: > Nothing currently guarantees that the packet passed to the bsf will > be writable. > > Signed-off-by: James Almer <jamrial@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(+) didnt test yet but should be ok thx [...]
On 3/22/2018 4:34 PM, Michael Niedermayer wrote: > On Wed, Mar 21, 2018 at 10:41:03PM -0300, James Almer wrote: >> Nothing currently guarantees that the packet passed to the bsf will >> be writable. >> >> Signed-off-by: James Almer <jamrial@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(+) > > didnt test yet but should be ok > > thx Pushed, thanks.
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 */
Nothing currently guarantees that the packet passed to the bsf will be writable. Signed-off-by: James Almer <jamrial@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(+)