[FFmpeg-devel] [PATCH v4 2/9] avformat/utils: unref packet on AVInputFormat.read_packet() failure

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Sun Sep 29 02:43:00 EEST 2019


James Almer:
> On 9/20/2019 5:39 PM, Andreas Rheinhardt wrote:
>> From: James Almer <jamrial at gmail.com>
>>
>> Demuxers may have allocated a packet before encountering an error and aborting.
> 
> Fun thing about this, the doxy states that packets should be freed on
> error before returning from the demuxer, so technically the apng demuxer
> is misbehaving.
> 
> Still, i think the generic code doing some cleaning is a good idea. But
> of course, if people prefer to enforce the expected behavior from
> documentation, we could replace the unref call introduced by this patch
> with an assert.
> 
IMO this change is very good and I have already begun work on removing
unnecessary av_packet_unref() calls in various demuxers [1]. I'll add
changes to the doxy when I'm done.

- Andreas

[1]:
https://github.com/mkver/FFmpeg/commit/1930edf0e225fc541ffacbdff1921d4743e998cc


More information about the ffmpeg-devel mailing list