From c6b8157dd63f95933d229a6446cc29a7b9220fba Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Wed, 12 Feb 2020 23:48:16 -0500 Subject: [PATCH] codecs: Pass the max_dpb_size to new_segment virtual On new_segment, the decoder is expected to negotiate. The decoder may want to pre-allocate the needed buffers. Pass the max_dpb_size as this is needed to determin how many buffers should be allocated. --- gst-libs/gst/codecs/gsth264decoder.c | 2 +- gst-libs/gst/codecs/gsth264decoder.h | 3 ++- sys/d3d11/gstd3d11h264dec.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gst-libs/gst/codecs/gsth264decoder.c b/gst-libs/gst/codecs/gsth264decoder.c index 7e172fa..81db6ff 100644 --- a/gst-libs/gst/codecs/gsth264decoder.c +++ b/gst-libs/gst/codecs/gsth264decoder.c @@ -1698,7 +1698,7 @@ gst_h264_decoder_process_sps (GstH264Decoder * self, GstH264SPS * 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/gsth264decoder.h b/gst-libs/gst/codecs/gsth264decoder.h index 1dbe6ab..b5d8991 100644 --- a/gst-libs/gst/codecs/gsth264decoder.h +++ b/gst-libs/gst/codecs/gsth264decoder.h @@ -82,7 +82,8 @@ struct _GstH264DecoderClass GstVideoDecoderClass parent_class; gboolean (*new_sequence) (GstH264Decoder * decoder, - const GstH264SPS * sps); + const GstH264SPS * sps, + gint max_dpb_size); gboolean (*new_picture) (GstH264Decoder * decoder, GstH264Picture * picture); diff --git a/sys/d3d11/gstd3d11h264dec.c b/sys/d3d11/gstd3d11h264dec.c index 6836f4d..3f4c9da 100644 --- a/sys/d3d11/gstd3d11h264dec.c +++ b/sys/d3d11/gstd3d11h264dec.c @@ -154,7 +154,7 @@ static gboolean gst_d3d11_h264_dec_src_query (GstVideoDecoder * decoder, /* GstH264Decoder */ static gboolean gst_d3d11_h264_dec_new_sequence (GstH264Decoder * decoder, - const GstH264SPS * sps); + const GstH264SPS * sps, gint max_dpb_size); static gboolean gst_d3d11_h264_dec_new_picture (GstH264Decoder * decoder, GstH264Picture * picture); static GstFlowReturn gst_d3d11_h264_dec_output_picture (GstH264Decoder * @@ -476,7 +476,7 @@ gst_d3d11_h264_dec_src_query (GstVideoDecoder * decoder, GstQuery * query) static gboolean gst_d3d11_h264_dec_new_sequence (GstH264Decoder * decoder, - const GstH264SPS * sps) + const GstH264SPS * sps, gint max_dpb_size) { GstD3D11H264Dec *self = GST_D3D11_H264_DEC (decoder); gint crop_width, crop_height; -- 2.7.4