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.
This commit is contained in:
Seungha Yang 2019-07-24 20:38:58 +09:00 committed by Sebastian Dröge
parent 71d9e33085
commit c8640e23f4

View file

@ -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;