From d393232bc20ce8902ca3ab2c46a4ef0a73a64b2a Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 23 Jan 2020 11:01:33 -0500 Subject: [PATCH] nvdec: Do not map GStreamer discont to CUVid discont Setting the CUVID_PKT_DISCONTINUITY implies clearing any past information about the stream in the decoder. The GStreamer discont flag is used for discontinuity caused by a seek, for first buffer and if a buffer was dropped. In the first two cases, the parsers and demuxers should ensure we start from a synchronization point, so it's unlikely that delta will be matched against the wrong state. For packet lost, the discontinuity flag will prevent the decoder from doing any concealment, with a result that ca be much worst visually, or freeze the playback until an IDR is met. It's better to let the decoder handle that for us. Removing this flag, also workaround a but in NVidia parser that makes it ignore our ENDOFFRAME flag and increase the latency by one frame. --- sys/nvcodec/gstnvdec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/nvcodec/gstnvdec.c b/sys/nvcodec/gstnvdec.c index fddc1c9429..00c95395dd 100644 --- a/sys/nvcodec/gstnvdec.c +++ b/sys/nvcodec/gstnvdec.c @@ -1116,7 +1116,6 @@ gst_nvdec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame) in_buffer = gst_buffer_ref (frame->input_buffer); if (GST_BUFFER_IS_DISCONT (frame->input_buffer)) { - packet.flags = CUVID_PKT_DISCONTINUITY; if (nvdec->codec_data && klass->codec_type == cudaVideoCodec_MPEG4) { in_buffer = gst_buffer_append (gst_buffer_ref (nvdec->codec_data), in_buffer);