From c8640e23f4cec14faa0fe3093d2d98f0bfced612 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Wed, 24 Jul 2019 20:38:58 +0900 Subject: [PATCH] nvdec: Skip draining before creating internal parser GstVideoDecoder::drain/flush can be called at very initial state with stream-start and flush-stop event, respectively. Draning with NULL CUvideoparser seems to unsafe and that eventually failed to handle it. --- sys/nvcodec/gstnvdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/nvcodec/gstnvdec.c b/sys/nvcodec/gstnvdec.c index d02cc62bdd..c0ec8986d9 100644 --- a/sys/nvcodec/gstnvdec.c +++ b/sys/nvcodec/gstnvdec.c @@ -812,7 +812,7 @@ gst_nvdec_flush (GstVideoDecoder * decoder) nvdec->state = GST_NVDEC_STATE_PARSE; - if (!cuda_OK (CuvidParseVideoData (nvdec->parser, &packet))) + if (nvdec->parser && !cuda_OK (CuvidParseVideoData (nvdec->parser, &packet))) GST_WARNING_OBJECT (nvdec, "parser failed"); return TRUE; @@ -830,7 +830,7 @@ gst_nvdec_drain (GstVideoDecoder * decoder) packet.payload = NULL; packet.flags = CUVID_PKT_ENDOFSTREAM; - if (!cuda_OK (CuvidParseVideoData (nvdec->parser, &packet))) + if (nvdec->parser && !cuda_OK (CuvidParseVideoData (nvdec->parser, &packet))) GST_WARNING_OBJECT (nvdec, "parser failed"); return nvdec->last_ret;