From b3df58add1595cd8a6c3cc98a4aa9cacf8970c7b Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sat, 12 Mar 2022 01:12:25 +0900 Subject: [PATCH] nvh265sldec: Add support for delayed output Delay 4 frames in case of non-live to improve throughput Part-of: --- .../gst-plugins-bad/sys/nvcodec/gstnvh265dec.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/subprojects/gst-plugins-bad/sys/nvcodec/gstnvh265dec.c b/subprojects/gst-plugins-bad/sys/nvcodec/gstnvh265dec.c index 8de388b63e..8bc60a6e7f 100644 --- a/subprojects/gst-plugins-bad/sys/nvcodec/gstnvh265dec.c +++ b/subprojects/gst-plugins-bad/sys/nvcodec/gstnvh265dec.c @@ -144,6 +144,9 @@ static GstFlowReturn gst_nv_h265_dec_decode_slice (GstH265Decoder * decoder, GArray * ref_pic_list0, GArray * ref_pic_list1); static GstFlowReturn gst_nv_h265_dec_end_picture (GstH265Decoder * decoder, GstH265Picture * picture); +static guint +gst_nv_h265_dec_get_preferred_output_delay (GstH265Decoder * decoder, + gboolean live); static void gst_nv_h265_dec_class_init (GstNvH265DecClass * klass) @@ -182,6 +185,8 @@ gst_nv_h265_dec_class_init (GstNvH265DecClass * klass) GST_DEBUG_FUNCPTR (gst_nv_h265_dec_decode_slice); h265decoder_class->end_picture = GST_DEBUG_FUNCPTR (gst_nv_h265_dec_end_picture); + h265decoder_class->get_preferred_output_delay = + GST_DEBUG_FUNCPTR (gst_nv_h265_dec_get_preferred_output_delay); GST_DEBUG_CATEGORY_INIT (gst_nv_h265_dec_debug, "nvh265dec", 0, "Nvidia H.265 Decoder"); @@ -921,6 +926,18 @@ gst_nv_h265_dec_end_picture (GstH265Decoder * decoder, GstH265Picture * picture) return GST_FLOW_OK; } +static guint +gst_nv_h265_dec_get_preferred_output_delay (GstH265Decoder * 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;