summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2021-06-26 17:24:15 -0300
committerJames Almer <jamrial@gmail.com>2021-07-09 11:07:29 -0300
commit7ee17ec7e46afef0e0af20af196292ec75f50b62 (patch)
tree736b365b9422b4630835231ba4b680d2ee1b18e9 /libavcodec
parent48eaf8ba1c861b306a4550400e01b3373dde5c71 (diff)
downloadffmpeg-7ee17ec7e46afef0e0af20af196292ec75f50b62.tar.gz
avcodec/libdav1d: don't repeatedly parse the same sequence header
Look at the event flag that signals a new sequence header was found in the bitstream on supported libdav1d versions for this purpose. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/libdav1d.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 6370ae1fbf..c39df418d5 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -33,6 +33,9 @@
#include "decode.h"
#include "internal.h"
+#define FF_DAV1D_VERSION_AT_LEAST(x,y) \
+ (DAV1D_API_VERSION_MAJOR > (x) || DAV1D_API_VERSION_MAJOR == (x) && DAV1D_API_VERSION_MINOR >= (y))
+
typedef struct Libdav1dContext {
AVClass *class;
Dav1dContext *c;
@@ -220,6 +223,9 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
Libdav1dContext *dav1d = c->priv_data;
Dav1dData *data = &dav1d->data;
Dav1dPicture pic = { 0 }, *p = &pic;
+#if FF_DAV1D_VERSION_AT_LEAST(5,1)
+ enum Dav1dEventFlags event_flags = 0;
+#endif
int res;
if (!data->sz) {
@@ -296,6 +302,10 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
frame->linesize[1] = p->stride[1];
frame->linesize[2] = p->stride[1];
+#if FF_DAV1D_VERSION_AT_LEAST(5,1)
+ dav1d_get_event_flags(dav1d->c, &event_flags);
+ if (event_flags & DAV1D_EVENT_FLAG_NEW_SEQUENCE)
+#endif
libdav1d_init_params(c, p->seq_hdr);
res = ff_decode_frame_props(c, frame);
if (res < 0)