mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
vaapi: Fix some code defects
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3954>
This commit is contained in:
parent
906b90287c
commit
68425e8241
4 changed files with 19 additions and 8 deletions
|
@ -499,8 +499,7 @@ nal_is_rasl (guint8 nal_type)
|
||||||
static gboolean
|
static gboolean
|
||||||
nal_is_slice (guint8 nal_type)
|
nal_is_slice (guint8 nal_type)
|
||||||
{
|
{
|
||||||
if ((nal_type >= GST_H265_NAL_SLICE_TRAIL_N) &&
|
if ((nal_type <= GST_H265_NAL_SLICE_CRA_NUT))
|
||||||
(nal_type <= GST_H265_NAL_SLICE_CRA_NUT))
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3017,11 +3017,11 @@ gst_vaapi_encoder_h264_get_pending_reordered (GstVaapiEncoder * base_encoder,
|
||||||
iter->pic_type = GST_VAAPI_PICTURE_TYPE_B;
|
iter->pic_type = GST_VAAPI_PICTURE_TYPE_B;
|
||||||
} else if (iter->pic_type == GST_VAAPI_PICTURE_TYPE_B) {
|
} else if (iter->pic_type == GST_VAAPI_PICTURE_TYPE_B) {
|
||||||
pic = g_queue_pop_head (&reorder_pool->reorder_frame_list);
|
pic = g_queue_pop_head (&reorder_pool->reorder_frame_list);
|
||||||
g_assert (pic);
|
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING ("Unhandled pending picture type");
|
GST_WARNING ("Unhandled pending picture type");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_assert (pic);
|
||||||
set_frame_num (encoder, pic);
|
set_frame_num (encoder, pic);
|
||||||
|
|
||||||
if (GST_CLOCK_TIME_IS_VALID (pic->frame->pts))
|
if (GST_CLOCK_TIME_IS_VALID (pic->frame->pts))
|
||||||
|
|
|
@ -152,11 +152,16 @@ GST_START_TEST (test_overlay_position)
|
||||||
fail_unless (handoff_buffer != NULL);
|
fail_unless (handoff_buffer != NULL);
|
||||||
pad = gst_element_get_static_pad (sink, "sink");
|
pad = gst_element_get_static_pad (sink, "sink");
|
||||||
caps = gst_pad_get_current_caps (pad);
|
caps = gst_pad_get_current_caps (pad);
|
||||||
gst_video_info_from_caps (&vinfo, caps);
|
if (!gst_video_info_from_caps (&vinfo, caps)) {
|
||||||
gst_caps_unref (caps);
|
GST_ERROR ("Failed to parse the caps");
|
||||||
gst_object_unref (pad);
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gst_video_frame_map (&frame, &vinfo, handoff_buffer, GST_MAP_READ)) {
|
||||||
|
GST_ERROR ("Failed to map the frame");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
gst_video_frame_map (&frame, &vinfo, handoff_buffer, GST_MAP_READ);
|
|
||||||
{
|
{
|
||||||
guint i, j, n_planes, plane;
|
guint i, j, n_planes, plane;
|
||||||
n_planes = GST_VIDEO_FRAME_N_PLANES (&frame);
|
n_planes = GST_VIDEO_FRAME_N_PLANES (&frame);
|
||||||
|
@ -193,7 +198,10 @@ GST_START_TEST (test_overlay_position)
|
||||||
}
|
}
|
||||||
gst_video_frame_unmap (&frame);
|
gst_video_frame_unmap (&frame);
|
||||||
|
|
||||||
|
end:
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
gst_object_unref (pad);
|
||||||
gst_buffer_replace (&handoff_buffer, NULL);
|
gst_buffer_replace (&handoff_buffer, NULL);
|
||||||
gst_element_set_state (bin, GST_STATE_NULL);
|
gst_element_set_state (bin, GST_STATE_NULL);
|
||||||
g_main_loop_unref (main_loop);
|
g_main_loop_unref (main_loop);
|
||||||
|
|
|
@ -298,7 +298,11 @@ app_free (App * app)
|
||||||
y4m_reader_close (app->parser);
|
y4m_reader_close (app->parser);
|
||||||
|
|
||||||
if (app->encoder) {
|
if (app->encoder) {
|
||||||
gst_vaapi_encoder_flush (app->encoder);
|
if ((gst_vaapi_encoder_flush (app->encoder)) !=
|
||||||
|
GST_VAAPI_ENCODER_STATUS_SUCCESS)
|
||||||
|
GST_WARNING_OBJECT (app->encoder,
|
||||||
|
"Failed to flush pending encoded frames");
|
||||||
|
|
||||||
gst_object_unref (app->encoder);
|
gst_object_unref (app->encoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue