From 5609d8751cf4b0397fef7573d885d3b476013e4b Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sun, 8 Mar 2020 16:10:41 +0900 Subject: [PATCH] h265decoder: Pass max_dpb_size to new_sequence vfunc same as we are doing in h264decoder --- gst-libs/gst/codecs/gsth265decoder.c | 2 +- gst-libs/gst/codecs/gsth265decoder.h | 3 ++- sys/d3d11/gstd3d11h265dec.c | 10 ++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/gst-libs/gst/codecs/gsth265decoder.c b/gst-libs/gst/codecs/gsth265decoder.c index 36a0fbc28a..33af638eb6 100644 --- a/gst-libs/gst/codecs/gsth265decoder.c +++ b/gst-libs/gst/codecs/gsth265decoder.c @@ -239,7 +239,7 @@ gst_h265_decoder_process_sps (GstH265Decoder * self, GstH265SPS * sps) g_assert (klass->new_sequence); - if (!klass->new_sequence (self, sps)) { + if (!klass->new_sequence (self, sps, max_dpb_size)) { GST_ERROR_OBJECT (self, "subclass does not want accept new sequence"); return FALSE; } diff --git a/gst-libs/gst/codecs/gsth265decoder.h b/gst-libs/gst/codecs/gsth265decoder.h index df192e4235..82e653bc3f 100644 --- a/gst-libs/gst/codecs/gsth265decoder.h +++ b/gst-libs/gst/codecs/gsth265decoder.h @@ -97,7 +97,8 @@ struct _GstH265DecoderClass GstVideoDecoderClass parent_class; gboolean (*new_sequence) (GstH265Decoder * decoder, - const GstH265SPS * sps); + const GstH265SPS * sps, + gint max_dpb_size); gboolean (*new_picture) (GstH265Decoder * decoder, GstH265Picture * picture); diff --git a/sys/d3d11/gstd3d11h265dec.c b/sys/d3d11/gstd3d11h265dec.c index 32338845f8..9fb54f82e1 100644 --- a/sys/d3d11/gstd3d11h265dec.c +++ b/sys/d3d11/gstd3d11h265dec.c @@ -53,9 +53,6 @@ DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_HEVC_VLD_MAIN, DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_HEVC_VLD_MAIN10, 0x107af0e0, 0xef1a, 0x4d19, 0xab, 0xa8, 0x67, 0xa1, 0x63, 0x07, 0x3d, 0x13); -/* worst case 16 + 4 margin */ -#define NUM_OUTPUT_VIEW 20 - typedef struct _GstD3D11H265Dec { GstH265Decoder parent; @@ -123,7 +120,7 @@ static gboolean gst_d3d11_h265_dec_src_query (GstVideoDecoder * decoder, /* GstH265Decoder */ static gboolean gst_d3d11_h265_dec_new_sequence (GstH265Decoder * decoder, - const GstH265SPS * sps); + const GstH265SPS * sps, gint max_dpb_size); static gboolean gst_d3d11_h265_dec_new_picture (GstH265Decoder * decoder, GstH265Picture * picture); static GstFlowReturn gst_d3d11_h265_dec_output_picture (GstH265Decoder * @@ -445,7 +442,7 @@ gst_d3d11_h265_dec_src_query (GstVideoDecoder * decoder, GstQuery * query) static gboolean gst_d3d11_h265_dec_new_sequence (GstH265Decoder * decoder, - const GstH265SPS * sps) + const GstH265SPS * sps, gint max_dpb_size) { GstD3D11H265Dec *self = GST_D3D11_H265_DEC (decoder); gint crop_width, crop_height; @@ -520,7 +517,8 @@ gst_d3d11_h265_dec_new_sequence (GstH265Decoder * decoder, gst_d3d11_decoder_reset (self->d3d11_decoder); if (!gst_d3d11_decoder_open (self->d3d11_decoder, GST_D3D11_CODEC_H265, &info, self->coded_width, self->coded_height, - NUM_OUTPUT_VIEW, &profile_guid, 1)) { + /* Additional 4 views margin for zero-copy rendering */ + max_dpb_size + 4, &profile_guid, 1)) { GST_ERROR_OBJECT (self, "Failed to create decoder"); return FALSE; }