nvh264sldec: Add support for output-delay to improve throughput performance

NVDEC API support delaying getting decoded output, and recommended
delay by API document is 4 frames. In case that throughput is
more critical factor than latency, we can prefer delayed output
as recommended by NVIDIA.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1925>
This commit is contained in:
Seungha Yang 2021-01-28 04:03:37 +09:00 committed by GStreamer Merge Bot
parent 86e312c1b1
commit fba807bead

View file

@ -156,6 +156,9 @@ static gboolean gst_nv_h264_dec_decode_slice (GstH264Decoder * decoder,
GArray * ref_pic_list1);
static gboolean gst_nv_h264_dec_end_picture (GstH264Decoder * decoder,
GstH264Picture * picture);
static guint
gst_nv_h264_dec_get_preferred_output_delay (GstH264Decoder * decoder,
gboolean live);
static void
gst_nv_h264_dec_class_init (GstNvH264DecClass * klass)
@ -194,6 +197,8 @@ gst_nv_h264_dec_class_init (GstNvH264DecClass * klass)
GST_DEBUG_FUNCPTR (gst_nv_h264_dec_decode_slice);
h264decoder_class->end_picture =
GST_DEBUG_FUNCPTR (gst_nv_h264_dec_end_picture);
h264decoder_class->get_preferred_output_delay =
GST_DEBUG_FUNCPTR (gst_nv_h264_dec_get_preferred_output_delay);
GST_DEBUG_CATEGORY_INIT (gst_nv_h264_dec_debug,
"nvh264dec", 0, "Nvidia H.264 Decoder");
@ -780,6 +785,18 @@ gst_nv_h264_dec_end_picture (GstH264Decoder * decoder, GstH264Picture * picture)
return ret;
}
static guint
gst_nv_h264_dec_get_preferred_output_delay (GstH264Decoder * decoder,
gboolean live)
{
/* Prefer to zero latency for live pipeline */
if (live)
return 0;
/* NVCODEC SDK uses 4 frame delay for better throughput performance */
return 4;
}
typedef struct
{
GstCaps *sink_caps;