summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorSeungha Yang <seungha@centricular.com>2021-03-07 16:47:07 +0900
committerSeungha Yang <seungha@centricular.com>2021-03-07 16:51:59 +0900
commit9da6da20e788a96070d9193fa431a5b4f92a1cc2 (patch)
tree8749d69d4bcafa193239a2b7b553ff390722649b /sys
parenta29c8935b74cc9f818d7bcdba0800bd14beec378 (diff)
downloadgstreamer-plugins-bad-9da6da20e788a96070d9193fa431a5b4f92a1cc2.tar.gz
nvh264sldec: Reopen decoder object if larger DPB size is required
Equivalent to the d3d11h264dec fix https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1839 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2059>
Diffstat (limited to 'sys')
-rw-r--r--sys/nvcodec/gstnvh264dec.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/nvcodec/gstnvh264dec.c b/sys/nvcodec/gstnvh264dec.c
index 1b7bbd81e..7d8f7ff15 100644
--- a/sys/nvcodec/gstnvh264dec.c
+++ b/sys/nvcodec/gstnvh264dec.c
@@ -112,6 +112,7 @@ struct _GstNvH264Dec
guint coded_width, coded_height;
guint bitdepth;
guint chroma_format_idc;
+ gint max_dpb_size;
GstVideoFormat out_format;
/* For OpenGL interop. */
@@ -237,6 +238,20 @@ gst_nv_h264_dec_set_context (GstElement * element, GstContext * context)
GST_ELEMENT_CLASS (parent_class)->set_context (element, context);
}
+/* Clear all codec specific (e.g., SPS) data */
+static void
+gst_d3d11_h264_dec_reset (GstNvH264Dec * self)
+{
+ self->width = 0;
+ self->height = 0;
+ self->coded_width = 0;
+ self->coded_height = 0;
+ self->bitdepth = 0;
+ self->chroma_format_idc = 0;
+ self->out_format = GST_VIDEO_FORMAT_UNKNOWN;
+ self->max_dpb_size = 0;
+}
+
static gboolean
gst_nv_h264_dec_open (GstVideoDecoder * decoder)
{
@@ -250,6 +265,8 @@ gst_nv_h264_dec_open (GstVideoDecoder * decoder)
return FALSE;
}
+ gst_d3d11_h264_dec_reset (self);
+
return TRUE;
}
@@ -367,6 +384,12 @@ gst_nv_h264_dec_new_sequence (GstH264Decoder * decoder, const GstH264SPS * sps,
modified = TRUE;
}
+ if (self->max_dpb_size < max_dpb_size) {
+ GST_INFO_OBJECT (self, "Requires larger DPB size (%d -> %d)",
+ self->max_dpb_size, max_dpb_size);
+ modified = TRUE;
+ }
+
if (modified || !self->decoder) {
GstVideoInfo info;
@@ -396,6 +419,7 @@ gst_nv_h264_dec_new_sequence (GstH264Decoder * decoder, const GstH264SPS * sps,
gst_video_info_set_format (&info,
self->out_format, self->width, self->height);
+ self->max_dpb_size = max_dpb_size;
/* FIXME: add support cudaVideoCodec_H264_SVC and cudaVideoCodec_H264_MVC */
self->decoder = gst_nv_decoder_new (self->context, cudaVideoCodec_H264,
&info,