diff options
author | Seungha Yang <seungha@centricular.com> | 2020-11-26 05:55:29 +0900 |
---|---|---|
committer | Seungha Yang <seungha@centricular.com> | 2021-03-04 18:11:32 +0900 |
commit | c87f178e678c19036960efed11c558ada3a4b758 (patch) | |
tree | dd418590c0d508eae5e69b9fbb94dfed37bda09b | |
parent | 3dc8effb3a5f1634cb47846cf54bd282479e71b3 (diff) | |
download | gstreamer-plugins-bad-c87f178e678c19036960efed11c558ada3a4b758.tar.gz |
d3d11h264dec: Reconfigure decoder object on DPB size change
Even if resolution and/or bitdepth is not updated, required
DPB size can be changed per SPS update and it could be even
larger than previously configured size of DPB. If so, we need
to reconfigure DPB d3d11 texture pool again.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2057>
-rw-r--r-- | sys/d3d11/gstd3d11h264dec.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sys/d3d11/gstd3d11h264dec.c b/sys/d3d11/gstd3d11h264dec.c index ec28df25d..74733fbc1 100644 --- a/sys/d3d11/gstd3d11h264dec.c +++ b/sys/d3d11/gstd3d11h264dec.c @@ -99,6 +99,8 @@ typedef struct _GstD3D11H264Dec guint chroma_format_idc; GstVideoFormat out_format; + gint max_dpb_size; + /* Array of DXVA_Slice_H264_Short */ GArray *slice_list; @@ -288,6 +290,20 @@ gst_d3d11_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 (GstD3D11H264Dec * 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_d3d11_h264_dec_open (GstVideoDecoder * decoder) { @@ -308,6 +324,8 @@ gst_d3d11_h264_dec_open (GstVideoDecoder * decoder) return FALSE; } + gst_d3d11_h264_dec_reset (self); + return TRUE; } @@ -419,6 +437,13 @@ gst_d3d11_h264_dec_new_sequence (GstH264Decoder * decoder, 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); + self->max_dpb_size = max_dpb_size; + modified = TRUE; + } + if (modified || !self->d3d11_decoder->opened) { GstVideoInfo info; |