va: Fix some code defects

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3919>
This commit is contained in:
Mengkejiergeli Ba 2023-02-09 16:54:16 +08:00 committed by GStreamer Marge Bot
parent 4e60e91a05
commit 735b6af5b9
5 changed files with 24 additions and 6 deletions

View file

@ -300,7 +300,11 @@ _create_internal_pool (GstVaAV1Dec * self, gint width, gint height)
return NULL;
}
gst_buffer_pool_set_active (pool, TRUE);
if (!gst_buffer_pool_set_active (pool, TRUE)) {
GST_WARNING_OBJECT (self, "Failed to activate internal pool");
gst_object_unref (pool);
return NULL;
}
return pool;
}

View file

@ -229,7 +229,10 @@ _get_sinkpad_pool (GstVaBaseEnc * base)
gst_object_unref (allocator);
gst_buffer_pool_set_active (base->priv->raw_pool, TRUE);
if (!gst_buffer_pool_set_active (base->priv->raw_pool, TRUE)) {
GST_WARNING_OBJECT (base, "Failed to activate sinkpad pool");
return NULL;
}
return base->priv->raw_pool;
}
@ -690,8 +693,10 @@ error_reorder:
{
GST_ELEMENT_ERROR (venc, STREAM, ENCODE,
("Failed to reorder the input frame."), (NULL));
gst_clear_buffer (&frame->output_buffer);
gst_video_encoder_finish_frame (venc, frame);
if (frame) {
gst_clear_buffer (&frame->output_buffer);
gst_video_encoder_finish_frame (venc, frame);
}
return GST_FLOW_ERROR;
}
error_encode:

View file

@ -768,7 +768,10 @@ _get_sinkpad_pool (GstVaBaseTransform * self)
if (self->priv->sinkpad_caps) {
caps = self->priv->sinkpad_caps;
gst_video_info_from_caps (&in_info, caps);
if (!gst_video_info_from_caps (&in_info, caps)) {
GST_ERROR_OBJECT (self, "Cannot parse caps %" GST_PTR_FORMAT, caps);
return NULL;
}
} else {
caps = self->in_caps;
in_info = self->in_info;

View file

@ -397,7 +397,11 @@ gst_va_encoder_open (GstVaEncoder * self, VAProfile profile,
GST_ERROR_OBJECT (self, "Failed to create reconstruct pool");
goto error;
}
gst_buffer_pool_set_active (recon_pool, TRUE);
if (!gst_buffer_pool_set_active (recon_pool, TRUE)) {
GST_ERROR_OBJECT (self, "Failed to activate reconstruct pool");
goto error;
}
status = vaCreateContext (dpy, config, coded_width, coded_height,
VA_PROGRESSIVE, NULL, 0, &context);

View file

@ -1200,11 +1200,13 @@ _calculate_coded_size (GstVaH264Enc * self)
BitDepthC = 10;
MbWidthC = 8;
MbHeightC = 8;
break;
case VA_RT_FORMAT_YUV422_10:
BitDepthY = 10;
BitDepthC = 10;
MbWidthC = 8;
MbHeightC = 16;
break;
case VA_RT_FORMAT_YUV444_10:
BitDepthY = 10;
BitDepthC = 10;