mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-06 14:32:31 +00:00
nvcodec: nv{vp8,vp9}sldec: Implement get_preferred_output_delay()
Equivalent to that of nvh264sldec. Use render delay in case of non-live pipeline for the better throughput performance. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/987>
This commit is contained in:
parent
aab3ea2736
commit
834d6f4031
2 changed files with 35 additions and 1 deletions
|
@ -80,6 +80,8 @@ static GstFlowReturn gst_nv_vp8_dec_decode_picture (GstVp8Decoder * decoder,
|
||||||
GstVp8Picture * picture, GstVp8Parser * parser);
|
GstVp8Picture * picture, GstVp8Parser * parser);
|
||||||
static GstFlowReturn gst_nv_vp8_dec_output_picture (GstVp8Decoder *
|
static GstFlowReturn gst_nv_vp8_dec_output_picture (GstVp8Decoder *
|
||||||
decoder, GstVideoCodecFrame * frame, GstVp8Picture * picture);
|
decoder, GstVideoCodecFrame * frame, GstVp8Picture * picture);
|
||||||
|
static guint gst_nv_vp8_dec_get_preferred_output_delay (GstVp8Decoder * decoder,
|
||||||
|
gboolean is_live);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_nv_vp8_dec_class_init (GstNvVp8DecClass * klass)
|
gst_nv_vp8_dec_class_init (GstNvVp8DecClass * klass)
|
||||||
|
@ -105,6 +107,8 @@ gst_nv_vp8_dec_class_init (GstNvVp8DecClass * klass)
|
||||||
GST_DEBUG_FUNCPTR (gst_nv_vp8_dec_decode_picture);
|
GST_DEBUG_FUNCPTR (gst_nv_vp8_dec_decode_picture);
|
||||||
vp8decoder_class->output_picture =
|
vp8decoder_class->output_picture =
|
||||||
GST_DEBUG_FUNCPTR (gst_nv_vp8_dec_output_picture);
|
GST_DEBUG_FUNCPTR (gst_nv_vp8_dec_output_picture);
|
||||||
|
vp8decoder_class->get_preferred_output_delay =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_nv_vp8_dec_get_preferred_output_delay);
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_nv_vp8_dec_debug,
|
GST_DEBUG_CATEGORY_INIT (gst_nv_vp8_dec_debug,
|
||||||
"nvvp8dec", 0, "NVIDIA VP8 Decoder");
|
"nvvp8dec", 0, "NVIDIA VP8 Decoder");
|
||||||
|
@ -254,7 +258,8 @@ gst_nv_vp8_dec_new_sequence (GstVp8Decoder * decoder,
|
||||||
|
|
||||||
if (!gst_nv_decoder_configure (self->decoder,
|
if (!gst_nv_decoder_configure (self->decoder,
|
||||||
cudaVideoCodec_VP8, &info, self->width, self->height,
|
cudaVideoCodec_VP8, &info, self->width, self->height,
|
||||||
NUM_OUTPUT_VIEW)) {
|
/* +4 for render delay */
|
||||||
|
NUM_OUTPUT_VIEW + 4)) {
|
||||||
GST_ERROR_OBJECT (self, "Failed to configure decoder");
|
GST_ERROR_OBJECT (self, "Failed to configure decoder");
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
}
|
}
|
||||||
|
@ -430,6 +435,18 @@ error:
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static guint
|
||||||
|
gst_nv_vp8_dec_get_preferred_output_delay (GstVp8Decoder * decoder,
|
||||||
|
gboolean is_live)
|
||||||
|
{
|
||||||
|
/* Prefer to zero latency for live pipeline */
|
||||||
|
if (is_live)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* NVCODEC SDK uses 4 frame delay for better throughput performance */
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GstCaps *sink_caps;
|
GstCaps *sink_caps;
|
||||||
|
|
|
@ -83,6 +83,8 @@ static GstFlowReturn gst_nv_vp9_dec_decode_picture (GstVp9Decoder * decoder,
|
||||||
GstVp9Picture * picture, GstVp9Dpb * dpb);
|
GstVp9Picture * picture, GstVp9Dpb * dpb);
|
||||||
static GstFlowReturn gst_nv_vp9_dec_output_picture (GstVp9Decoder *
|
static GstFlowReturn gst_nv_vp9_dec_output_picture (GstVp9Decoder *
|
||||||
decoder, GstVideoCodecFrame * frame, GstVp9Picture * picture);
|
decoder, GstVideoCodecFrame * frame, GstVp9Picture * picture);
|
||||||
|
static guint gst_nv_vp9_dec_get_preferred_output_delay (GstVp9Decoder * decoder,
|
||||||
|
gboolean is_live);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_nv_vp9_dec_class_init (GstNvVp9DecClass * klass)
|
gst_nv_vp9_dec_class_init (GstNvVp9DecClass * klass)
|
||||||
|
@ -110,6 +112,8 @@ gst_nv_vp9_dec_class_init (GstNvVp9DecClass * klass)
|
||||||
GST_DEBUG_FUNCPTR (gst_nv_vp9_dec_decode_picture);
|
GST_DEBUG_FUNCPTR (gst_nv_vp9_dec_decode_picture);
|
||||||
vp9decoder_class->output_picture =
|
vp9decoder_class->output_picture =
|
||||||
GST_DEBUG_FUNCPTR (gst_nv_vp9_dec_output_picture);
|
GST_DEBUG_FUNCPTR (gst_nv_vp9_dec_output_picture);
|
||||||
|
vp9decoder_class->get_preferred_output_delay =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_nv_vp9_dec_get_preferred_output_delay);
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_nv_vp9_dec_debug,
|
GST_DEBUG_CATEGORY_INIT (gst_nv_vp9_dec_debug,
|
||||||
"nvvp9dec", 0, "NVIDIA VP9 Decoder");
|
"nvvp9dec", 0, "NVIDIA VP9 Decoder");
|
||||||
|
@ -260,6 +264,7 @@ gst_nv_vp9_dec_new_sequence (GstVp9Decoder * decoder,
|
||||||
gst_video_info_set_format (&info, out_format, self->width, self->height);
|
gst_video_info_set_format (&info, out_format, self->width, self->height);
|
||||||
if (!gst_nv_decoder_configure (self->decoder,
|
if (!gst_nv_decoder_configure (self->decoder,
|
||||||
cudaVideoCodec_VP9, &info, self->width, self->height,
|
cudaVideoCodec_VP9, &info, self->width, self->height,
|
||||||
|
/* +4 for render delay */
|
||||||
NUM_OUTPUT_VIEW)) {
|
NUM_OUTPUT_VIEW)) {
|
||||||
GST_ERROR_OBJECT (self, "Failed to configure decoder");
|
GST_ERROR_OBJECT (self, "Failed to configure decoder");
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
|
@ -518,6 +523,18 @@ error:
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static guint
|
||||||
|
gst_nv_vp9_dec_get_preferred_output_delay (GstVp9Decoder * decoder,
|
||||||
|
gboolean is_live)
|
||||||
|
{
|
||||||
|
/* Prefer to zero latency for live pipeline */
|
||||||
|
if (is_live)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* NVCODEC SDK uses 4 frame delay for better throughput performance */
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GstCaps *sink_caps;
|
GstCaps *sink_caps;
|
||||||
|
|
Loading…
Reference in a new issue