[FFmpeg-devel] [PATCH] avcodec/libdav1d: fix setting AVFrame reordered_opaque

James Almer jamrial at gmail.com
Fri Oct 18 01:40:38 EEST 2019


On 10/17/2019 7:27 PM, Hendrik Leppkes wrote:
> On Fri, Oct 18, 2019 at 12:13 AM Andrey Semashev
> <andrey.semashev at gmail.com> wrote:
>>
>> On 2019-10-17 23:11, James Almer wrote:
>>> Actually reorder the values.
>>>
>>> Should effectively fix ticket #8300.
>>>
>>> Signed-off-by: James Almer <jamrial at gmail.com>
>>> ---
>>>   libavcodec/libdav1d.c | 21 ++++++++++++++++++++-
>>>   1 file changed, 20 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
>>> index 8aa248e6cd..87abdb4569 100644
>>> --- a/libavcodec/libdav1d.c
>>> +++ b/libavcodec/libdav1d.c
>>> @@ -191,6 +191,24 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
>>>
>>>               pkt.buf = NULL;
>>>               av_packet_unref(&pkt);
>>> +
>>> +            if (c->reordered_opaque != AV_NOPTS_VALUE) {
>>
>> I'm not sure this comparison is valid. The default value of
>> reordered_opaque is 0, and there seems to be no convention whatsoever
>> about what this value represents (i.e. its semantics are completely
>> user-defined). I think, this check needs to be removed and the code
>> below should execute for any reordered_opaque values.
>>
> 
> AV_NOPTS_VALUE is the default value of that field in AVCodecContext
> (see init_context_defaults in avcodec\options.c), so we can easily
> avoid an allocation while conveying the same value, which will happen
> a lot since the field isn't used everywhere.
> I'm not sure if AVFrame also defaults to that value, but even if it
> doesn't, further down it could just set the field to that if no value
> is provided.

AVFrame sets it to 0 in get_frame_defaults in frame.h

I guess we could effectively set it to NOPTS in libdav1d.c if no value
is set in avctx->reordered_opaque.

> 
> - Hendrik
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> 



More information about the ffmpeg-devel mailing list