va: encoder: Do not continue when push_buffer gets error

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4359>
This commit is contained in:
He Junyan 2023-04-06 19:57:29 +08:00 committed by Víctor Manuel Jáquez Leal
parent 9e2f0ea8dc
commit 0694c4a1c3

View file

@ -660,9 +660,12 @@ gst_va_base_enc_handle_frame (GstVideoEncoder * venc,
if (ret != GST_FLOW_OK)
goto error_encode;
while (g_queue_get_length (&base->output_list) > 0)
while (ret == GST_FLOW_OK && g_queue_get_length (&base->output_list) > 0)
ret = _push_out_one_buffer (base);
if (ret != GST_FLOW_OK)
goto error_push_buffer;
frame_encode = NULL;
if (!base_class->reorder_frame (base, NULL, FALSE, &frame_encode))
goto error_reorder;
@ -706,6 +709,12 @@ error_encode:
gst_video_encoder_finish_frame (venc, frame_encode);
return ret;
}
error_push_buffer:
{
GST_ELEMENT_ERROR (venc, STREAM, ENCODE,
("Failed to push one frame."), (NULL));
return ret;
}
}
static GstFlowReturn