From 85f01d77091d5ce5e6a6e62bd240ff7079088893 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sat, 16 Sep 2023 22:49:30 +0900 Subject: [PATCH] d3d11h265dec: Reconfigure decoder on max-dpb-size change Decoder should create new picture pool for larger DPB size Part-of: --- .../sys/d3d11/gstd3d11h265dec.cpp | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h265dec.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h265dec.cpp index 5a4d6a20fc..9f726d7d23 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h265dec.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11h265dec.cpp @@ -77,6 +77,7 @@ typedef struct _GstD3D11H265DecInner guint8 chroma_format_idc = 0; GstVideoFormat out_format = GST_VIDEO_FORMAT_UNKNOWN; GstVideoInterlaceMode interlace_mode = GST_VIDEO_INTERLACE_MODE_PROGRESSIVE; + gint max_dpb_size = 0; } GstD3D11H265DecInner; /* *INDENT-ON* */ @@ -219,6 +220,22 @@ gst_d3d11_h265_dec_set_context (GstElement * element, GstContext * context) GST_ELEMENT_CLASS (parent_class)->set_context (element, context); } +static void +gst_d3d11_h265_dec_reset (GstD3D11H265Dec * self) +{ + GstD3D11H265DecInner *inner = self->inner; + + inner->width = 0; + inner->height = 0; + inner->coded_width = 0; + inner->coded_height = 0; + inner->bitdepth = 0; + inner->chroma_format_idc = 0; + inner->out_format = GST_VIDEO_FORMAT_UNKNOWN; + inner->interlace_mode = GST_VIDEO_INTERLACE_MODE_PROGRESSIVE; + inner->max_dpb_size = 0; +} + static gboolean gst_d3d11_h265_dec_open (GstVideoDecoder * decoder) { @@ -233,6 +250,8 @@ gst_d3d11_h265_dec_open (GstVideoDecoder * decoder) return FALSE; } + gst_d3d11_h265_dec_reset (self); + return TRUE; } @@ -382,6 +401,12 @@ gst_d3d11_h265_dec_new_sequence (GstH265Decoder * decoder, modified = TRUE; } + if (inner->max_dpb_size < max_dpb_size) { + GST_INFO_OBJECT (self, "Requires larger DPB size (%d -> %d)", + inner->max_dpb_size, max_dpb_size); + modified = TRUE; + } + if (modified || !gst_d3d11_decoder_is_configured (inner->d3d11_decoder)) { GstVideoInfo info; @@ -410,6 +435,7 @@ gst_d3d11_h265_dec_new_sequence (GstH265Decoder * decoder, inner->out_format, inner->width, inner->height); GST_VIDEO_INFO_INTERLACE_MODE (&info) = inner->interlace_mode; + inner->max_dpb_size = max_dpb_size; if (!gst_d3d11_decoder_configure (inner->d3d11_decoder, decoder->input_state, &info, inner->crop_x, inner->crop_y, inner->coded_width, inner->coded_height, max_dpb_size)) {