[FFmpeg-devel] [PATCH] movenc.c fix (Was: Can av_write_frame() modify pkt.data?)
Tue Jun 17 15:41:19 CEST 2008
Michael Niedermayer wrote:
>> I just discovered that the mov muxer can modify the
>> "data" field of the AVPacket structure that it receives
>> as parameter (in case of H.264 video, mov_write_packet()
>> calls ff_avc_parse_nal_units(pkt->data, &pkt->data, &pkt->size);
>> which frees pkt->data and allocates a new buffer).
>> So, should output_example.c be fixed, or should movenc.c
>> be fixed? (or is everything ok, since output_example does
>> not write H.264 in mov unless you modify it?)
> movenc.c looks buggy, and a quick grep hints towards that its not
> the only one.
> pkt.data does not need to be a malloced() buffer. Thus a blind av_free()
> is always wrong. The correct way to kill a packet is with pkt->destruct()
> though that is of course not the muxers job to do.
> Besides a packet could be passed to more than 1 muxer and thus its content
> must not be changed by any muxer.
Ok; I tried to fix this bug, but I do not know if the attached patch
is the best solution. It seems to work well here.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1802 bytes
Desc: not available
More information about the ffmpeg-devel