Skip to content

Commit ea2b1ac

Browse files
committed
Flushing buffers (related fcd1ed5)
After 3bbe176 do not by default open and close the codec in order to flush the video buffer.
1 parent 18f243b commit ea2b1ac

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

common/lwlibav_dec.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ void lwlibav_flush_buffers
4545
lwlibav_decode_handler_t *dhp
4646
)
4747
{
48-
if (dhp->index_entries_count <= 1)
48+
if (!strcmp(dhp->ctx->codec->name, "libdav1d")
49+
&& dhp->ctx->level > 9)
50+
avcodec_flush_buffers(dhp->ctx);
51+
else if (dhp->ctx->codec_type == AVMEDIA_TYPE_VIDEO
52+
&& strcmp(dhp->ctx->codec->name, "libdav1d"))
53+
avcodec_flush_buffers(dhp->ctx);
54+
else
4955
{
5056
const AVCodecParameters* codecpar = dhp->format->streams[dhp->stream_index]->codecpar;
5157
const AVCodec* codec = dhp->ctx->codec;
@@ -67,8 +73,6 @@ void lwlibav_flush_buffers
6773
dhp->ctx->opaque = app_specific;
6874
}
6975
}
70-
else
71-
avcodec_flush_buffers(dhp->ctx);
7276

7377
dhp->exh.delay_count = 0;
7478
}

0 commit comments

Comments
 (0)