diff mbox series

[FFmpeg-devel,1/2] avcodec/zerocodec: implement flushing

Message ID 20200409085053.26045-1-onemda@gmail.com
State Accepted
Commit 05e04e821d2bc977764ca3456e96d8e9850f498c
Headers show
Series [FFmpeg-devel,1/2] avcodec/zerocodec: implement flushing
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Paul B Mahol April 9, 2020, 8:50 a.m. UTC
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/zerocodec.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c
index e67eee4f7d..b0fab91004 100644
--- a/libavcodec/zerocodec.c
+++ b/libavcodec/zerocodec.c
@@ -139,6 +139,13 @@  static av_cold int zerocodec_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
+static void zerocodec_decode_flush(AVCodecContext *avctx)
+{
+    ZeroCodecContext *zc = avctx->priv_data;
+
+    av_frame_unref(zc->previous_frame);
+}
+
 AVCodec ff_zerocodec_decoder = {
     .type           = AVMEDIA_TYPE_VIDEO,
     .name           = "zerocodec",
@@ -147,6 +154,7 @@  AVCodec ff_zerocodec_decoder = {
     .priv_data_size = sizeof(ZeroCodecContext),
     .init           = zerocodec_decode_init,
     .decode         = zerocodec_decode_frame,
+    .flush          = zerocodec_decode_flush,
     .close          = zerocodec_decode_close,
     .capabilities   = AV_CODEC_CAP_DR1,
     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,