[vlc-devel] [RFC 1/2] avcodec: encoder: Always provide frame dimension and pixel format

Hugo Beauzée-Luyssen hugo at beauzee.fr
Mon Apr 4 13:33:27 CEST 2016


On 03/29/2016 05:27 PM, Vittorio Giovara wrote:
> On Tue, Mar 29, 2016 at 2:28 PM, Hugo Beauzée-Luyssen <hugo at beauzee.fr> wrote:
>> On 03/29/2016 01:34 PM, Vittorio Giovara wrote:
>>>
>>> On Mon, Mar 28, 2016 at 2:28 PM, Hugo Beauzée-Luyssen <hugo at beauzee.fr>
>>> wrote:
>>>>
>>>> av_frame_unref will clear most of the frame fields, including dimension
>>>> & pixel format.
>>>
>>>
>>> Where does that happen?
>>>
>>
>> modules/codec/avcodec/encoder.c:1076 (EncodeVideo)
>> -> libavutil/frame.c:306 (av_frame_unref)
>> -> libavutil/frame.c:34 (get_frame_defaults)
>> which memset the entire frame to 0, and explicitely sets the format to -1
>
> I see, what happens if you *don't* call unref on the input avframe?
>

Haven't tried it, but the frame is returned by av_frame_alloc and stored 
unaltered, so I'd expect all the fields to be set to 0 to their default 
value to begin with, so not calling av_frame_unref wouldn't change much

Regards,


More information about the vlc-devel mailing list