From f7b2b1b99db38b0bb680f96bafdfd32190c73f5c Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sun, 18 Aug 2019 15:45:37 +0900 Subject: [PATCH] nvdec: Fix timestamp mismatch on draining frames The internal decoding state must be GST_NVDEC_STATE_PARSE before calling CuvidParseVideoData(). Otherwise, nvdec will be confused on decode callback as if the frame is decoding only frame and the input timestamp of corresponding frame will be ignored. Eventually one decoded frame will have non-increased PTS. --- sys/nvcodec/gstnvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/nvcodec/gstnvdec.c b/sys/nvcodec/gstnvdec.c index 2819fffc0f..a1c54b3f3a 100644 --- a/sys/nvcodec/gstnvdec.c +++ b/sys/nvcodec/gstnvdec.c @@ -1039,6 +1039,8 @@ gst_nvdec_drain (GstVideoDecoder * decoder) packet.payload = NULL; packet.flags = CUVID_PKT_ENDOFSTREAM; + nvdec->state = GST_NVDEC_STATE_PARSE; + if (nvdec->parser && !gst_cuda_result (CuvidParseVideoData (nvdec->parser, &packet))) GST_WARNING_OBJECT (nvdec, "parser failed");