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:
parent
a8b2fbf77f
commit
29aab904a8
@ -276,6 +276,9 @@ gst_nv_decoder_configure (GstNvDecoder * decoder, cudaVideoCodec codec,
|
|||||||
|
|
||||||
format = GST_VIDEO_INFO_FORMAT (info);
|
format = GST_VIDEO_INFO_FORMAT (info);
|
||||||
|
|
||||||
|
/* Additional 2 frame margin */
|
||||||
|
pool_size += 2;
|
||||||
|
|
||||||
/* FIXME: check aligned resolution or actual coded resolution */
|
/* FIXME: check aligned resolution or actual coded resolution */
|
||||||
create_info.ulWidth = GST_VIDEO_INFO_WIDTH (&decoder->coded_info);
|
create_info.ulWidth = GST_VIDEO_INFO_WIDTH (&decoder->coded_info);
|
||||||
create_info.ulHeight = GST_VIDEO_INFO_HEIGHT (&decoder->coded_info);
|
create_info.ulHeight = GST_VIDEO_INFO_HEIGHT (&decoder->coded_info);
|
||||||
|
@ -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 */
|
/* FIXME: add support cudaVideoCodec_H264_SVC and cudaVideoCodec_H264_MVC */
|
||||||
if (!gst_nv_decoder_configure (self->decoder,
|
if (!gst_nv_decoder_configure (self->decoder,
|
||||||
cudaVideoCodec_H264, &info, self->coded_width, self->coded_height,
|
cudaVideoCodec_H264, &info, self->coded_width, self->coded_height,
|
||||||
self->bitdepth,
|
self->bitdepth, max_dpb_size)) {
|
||||||
/* Additional 4 buffers for render delay */
|
|
||||||
max_dpb_size + 4)) {
|
|
||||||
GST_ERROR_OBJECT (self, "Failed to configure decoder");
|
GST_ERROR_OBJECT (self, "Failed to configure decoder");
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
}
|
}
|
||||||
|
@ -399,9 +399,7 @@ gst_nv_h265_dec_new_sequence (GstH265Decoder * decoder, const GstH265SPS * sps,
|
|||||||
|
|
||||||
if (!gst_nv_decoder_configure (self->decoder,
|
if (!gst_nv_decoder_configure (self->decoder,
|
||||||
cudaVideoCodec_HEVC, &info, self->coded_width, self->coded_height,
|
cudaVideoCodec_HEVC, &info, self->coded_width, self->coded_height,
|
||||||
self->bitdepth,
|
self->bitdepth, max_dpb_size)) {
|
||||||
/* Additional 2 buffers for margin */
|
|
||||||
max_dpb_size + 2)) {
|
|
||||||
GST_ERROR_OBJECT (self, "Failed to configure decoder");
|
GST_ERROR_OBJECT (self, "Failed to configure decoder");
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,6 @@
|
|||||||
GST_DEBUG_CATEGORY_STATIC (gst_nv_vp8_dec_debug);
|
GST_DEBUG_CATEGORY_STATIC (gst_nv_vp8_dec_debug);
|
||||||
#define GST_CAT_DEFAULT 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
|
struct _GstNvVp8Dec
|
||||||
{
|
{
|
||||||
GstVp8Decoder parent;
|
GstVp8Decoder parent;
|
||||||
@ -259,8 +256,7 @@ gst_nv_vp8_dec_new_sequence (GstVp8Decoder * decoder,
|
|||||||
|
|
||||||
if (!gst_nv_decoder_configure (self->decoder,
|
if (!gst_nv_decoder_configure (self->decoder,
|
||||||
cudaVideoCodec_VP8, &info, self->width, self->height, 8,
|
cudaVideoCodec_VP8, &info, self->width, self->height, 8,
|
||||||
/* +4 for render delay */
|
max_dpb_size)) {
|
||||||
NUM_OUTPUT_VIEW + 4)) {
|
|
||||||
GST_ERROR_OBJECT (self, "Failed to configure decoder");
|
GST_ERROR_OBJECT (self, "Failed to configure decoder");
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,6 @@
|
|||||||
GST_DEBUG_CATEGORY_STATIC (gst_nv_vp9_dec_debug);
|
GST_DEBUG_CATEGORY_STATIC (gst_nv_vp9_dec_debug);
|
||||||
#define GST_CAT_DEFAULT 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
|
struct _GstNvVp9Dec
|
||||||
{
|
{
|
||||||
GstVp9Decoder parent;
|
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);
|
gst_video_info_set_format (&info, out_format, self->width, self->height);
|
||||||
if (!gst_nv_decoder_configure (self->decoder,
|
if (!gst_nv_decoder_configure (self->decoder,
|
||||||
cudaVideoCodec_VP9, &info, self->width, self->height,
|
cudaVideoCodec_VP9, &info, self->width, self->height,
|
||||||
frame_hdr->bit_depth,
|
frame_hdr->bit_depth, max_dpb_size)) {
|
||||||
/* +4 for render delay */
|
|
||||||
NUM_OUTPUT_VIEW + 4)) {
|
|
||||||
GST_ERROR_OBJECT (self, "Failed to configure decoder");
|
GST_ERROR_OBJECT (self, "Failed to configure decoder");
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
return GST_FLOW_NOT_NEGOTIATED;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user