nvdec: Tell the parser we have complete pictures

This sets the CUVID_PKT_ENDOFPICTURE flag in order to inform the decoder that
we have a complete picture. This should remove one frame latency otherwise
introduce by NVidia parser.
This commit is contained in:
Nicolas Dufresne 2020-01-22 10:26:02 -05:00 committed by GStreamer Merge Bot
parent 0478e2dc1a
commit a28ce16b3f
2 changed files with 16 additions and 0 deletions

View file

@ -881,6 +881,18 @@ gst_nvdec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state)
GstBuffer *codec_data = gst_value_get_buffer (codec_data_value);
gst_buffer_replace (&nvdec->codec_data, codec_data);
}
/* For all CODEC we get completre picture ... */
nvdec->recv_complete_picture = TRUE;
/* Except for JPEG, for which it depends on the caps */
if (klass->codec_type == cudaVideoCodec_JPEG) {
gboolean parsed;
if (gst_structure_get_boolean (str, "parsed", &parsed))
nvdec->recv_complete_picture = parsed;
else
nvdec->recv_complete_picture = FALSE;
}
}
return ret;
@ -1123,6 +1135,9 @@ gst_nvdec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame)
packet.timestamp = frame->pts;
packet.flags |= CUVID_PKT_TIMESTAMP;
if (nvdec->recv_complete_picture)
packet.flags |= CUVID_PKT_ENDOFPICTURE;
nvdec->state = GST_NVDEC_STATE_PARSE;
nvdec->last_ret = GST_FLOW_OK;

View file

@ -89,6 +89,7 @@ struct _GstNvDec
GstNvDecMemType mem_type;
GstBuffer *codec_data;
gboolean recv_complete_picture;
};
struct _GstNvDecClass