diff mbox series

[FFmpeg-devel,2/2] avcodec/libdav1d: don't repeatedly parse the same sequence header

Message ID 20210626202415.4227-2-jamrial@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,1/2] avcodec/libdav1d: use ff_decode_frame_props() to fill frame properties | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer June 26, 2021, 8:24 p.m. UTC
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>
---
 libavcodec/libdav1d.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 6370ae1fbf..faa1d242c8 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -220,6 +220,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 DAV1D_API_VERSION_MAJOR >= 5 && DAV1D_API_VERSION_MINOR >= 1
+    enum Dav1dEventFlags event_flags = 0;
+#endif
     int res;
 
     if (!data->sz) {
@@ -296,6 +299,10 @@  static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
     frame->linesize[1] = p->stride[1];
     frame->linesize[2] = p->stride[1];
 
+#if DAV1D_API_VERSION_MAJOR >= 5 && DAV1D_API_VERSION_MINOR >= 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)