nvdec: Do not map GStreamer discont to CUVid discont
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Thu, 23 Jan 2020 16:01:33 +0000 (11:01 -0500)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Sat, 25 Jan 2020 13:39:03 +0000 (13:39 +0000)
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

index fddc1c9..00c9539 100644 (file)
@@ -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);