nvdecoder: Handle DPB size margin in a single place

... instead of each subclass

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2343>
This commit is contained in:
Seungha Yang 2022-05-02 22:46:06 +09:00 committed by GStreamer Marge Bot
parent a8b2fbf77f
commit 29aab904a8
5 changed files with 7 additions and 17 deletions

View file

@ -276,6 +276,9 @@ gst_nv_decoder_configure (GstNvDecoder * decoder, cudaVideoCodec codec,
format = GST_VIDEO_INFO_FORMAT (info);
/* Additional 2 frame margin */
pool_size += 2;
/* FIXME: check aligned resolution or actual coded resolution */
create_info.ulWidth = GST_VIDEO_INFO_WIDTH (&decoder->coded_info);
create_info.ulHeight = GST_VIDEO_INFO_HEIGHT (&decoder->coded_info);

View file

@ -447,9 +447,7 @@ gst_nv_h264_dec_new_sequence (GstH264Decoder * decoder, const GstH264SPS * sps,
/* FIXME: add support cudaVideoCodec_H264_SVC and cudaVideoCodec_H264_MVC */
if (!gst_nv_decoder_configure (self->decoder,
cudaVideoCodec_H264, &info, self->coded_width, self->coded_height,
self->bitdepth,
/* Additional 4 buffers for render delay */
max_dpb_size + 4)) {
self->bitdepth, max_dpb_size)) {
GST_ERROR_OBJECT (self, "Failed to configure decoder");
return GST_FLOW_NOT_NEGOTIATED;
}

View file

@ -399,9 +399,7 @@ gst_nv_h265_dec_new_sequence (GstH265Decoder * decoder, const GstH265SPS * sps,
if (!gst_nv_decoder_configure (self->decoder,
cudaVideoCodec_HEVC, &info, self->coded_width, self->coded_height,
self->bitdepth,
/* Additional 2 buffers for margin */
max_dpb_size + 2)) {
self->bitdepth, max_dpb_size)) {
GST_ERROR_OBJECT (self, "Failed to configure decoder");
return GST_FLOW_NOT_NEGOTIATED;
}

View file

@ -31,9 +31,6 @@
GST_DEBUG_CATEGORY_STATIC (gst_nv_vp8_dec_debug);
#define GST_CAT_DEFAULT gst_nv_vp8_dec_debug
/* reference list 4 + 2 margin */
#define NUM_OUTPUT_VIEW 6
struct _GstNvVp8Dec
{
GstVp8Decoder parent;
@ -259,8 +256,7 @@ gst_nv_vp8_dec_new_sequence (GstVp8Decoder * decoder,
if (!gst_nv_decoder_configure (self->decoder,
cudaVideoCodec_VP8, &info, self->width, self->height, 8,
/* +4 for render delay */
NUM_OUTPUT_VIEW + 4)) {
max_dpb_size)) {
GST_ERROR_OBJECT (self, "Failed to configure decoder");
return GST_FLOW_NOT_NEGOTIATED;
}

View file

@ -31,9 +31,6 @@
GST_DEBUG_CATEGORY_STATIC (gst_nv_vp9_dec_debug);
#define GST_CAT_DEFAULT gst_nv_vp9_dec_debug
/* reference list 8 + 2 margin */
#define NUM_OUTPUT_VIEW 10
struct _GstNvVp9Dec
{
GstVp9Decoder parent;
@ -272,9 +269,7 @@ gst_nv_vp9_dec_new_sequence (GstVp9Decoder * decoder,
gst_video_info_set_format (&info, out_format, self->width, self->height);
if (!gst_nv_decoder_configure (self->decoder,
cudaVideoCodec_VP9, &info, self->width, self->height,
frame_hdr->bit_depth,
/* +4 for render delay */
NUM_OUTPUT_VIEW + 4)) {
frame_hdr->bit_depth, max_dpb_size)) {
GST_ERROR_OBJECT (self, "Failed to configure decoder");
return GST_FLOW_NOT_NEGOTIATED;
}