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

Hendrik Leppkes h.leppkes at gmail.com
Fri Oct 18 01:27:37 EEST 2019


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.

- Hendrik


More information about the ffmpeg-devel mailing list