On 6/21/2019 11:39 AM, Derek Buitenhuis wrote: > On 21/06/2019 15:26, James Almer wrote: >> Remove the three lines below as well before pushing. They are >> superfluous as av_packet_unref() does the same internally. > > OK. > > The documentation for av_packet_unref says it sets the 'remaining' > fields to default values, but av_init_packet says it sets the > 'optional' fields to default values. Not clear if they mean > the same thing. Looking at the source, it's clear, but I prefer > not to do that, since it encourages relying on undocumented > behavior. > > - Derek
The doxy says "Unreference the buffer referenced by the packet and reset the remaining packet fields to their default values", which means it unrefs the AVBufferRef, and then sets the remaining fields in the packet to default values, effectively wiping the whole struct. av_init_packet() does indeed change only a subset of fields, as stated by the doxy, which is why the data and size fields are set to NULL/0 in this function right after it, as those are not touched by it. Since you want to wipe the packet, calling av_packet_unref() on it does a thorough job. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".