pool = gst_msdk_context_get_alloc_pool (context);
if (!pool) {
+ status = MFX_ERR_MEMORY_ALLOC;
goto error_alloc;
}
config = gst_buffer_pool_get_config (GST_BUFFER_POOL_CAST (pool));
if (!gst_buffer_pool_config_get_params (config, &caps, NULL, &min_buffers,
- &max_buffers))
+ &max_buffers)) {
+ status = MFX_ERR_MEMORY_ALLOC;
goto error_alloc;
+ }
max_buffers = MAX (max_buffers, surfaces_num);
gst_buffer_pool_config_set_params (config, caps,
if (!gst_buffer_pool_set_config (pool, config)) {
GST_ERROR ("Failed to set pool config");
gst_object_unref (pool);
+ status = MFX_ERR_MEMORY_ALLOC;
goto error_alloc;
}
if (!gst_buffer_pool_set_active (pool, TRUE)) {
GST_ERROR ("Failed to activate pool");
gst_object_unref (pool);
+ status = MFX_ERR_MEMORY_ALLOC;
goto error_alloc;
}
GST_ERROR ("Failed to allocate buffer");
gst_buffer_pool_set_active (pool, FALSE);
gst_object_unref (pool);
+ status = MFX_ERR_MEMORY_ALLOC;
goto error_alloc;
}
GST_ERROR ("Failed to get GstMsdkSurface");
gst_buffer_pool_set_active (pool, FALSE);
gst_object_unref (pool);
+ status = MFX_ERR_MEMORY_ALLOC;
goto error_alloc;
}
status = gst_msdk_get_mfx_status_from_va_status (va_status);
if (status < MFX_ERR_NONE) {
GST_ERROR ("failed to create buffer");
- return status;
+ goto error_alloc;
}
msdk_mid.surface = coded_buf;
g_slice_free (GstMsdkAllocResponse, msdk_resp);
if (tmp_list)
g_list_free_full (tmp_list, (GDestroyNotify) gst_msdk_surface_list_free);
- return MFX_ERR_MEMORY_ALLOC;
+ return status;
}
mfxStatus
in_surface->surface->Data.TimeStamp =
gst_util_uint64_scale_round (inbuf->pts, 90000, GST_SECOND);
- out_surface = gst_msdk_import_to_msdk_surface (outbuf, thiz->context,
- &thiz->srcpad_info, GST_MAP_WRITE);
-
- if (!thiz->use_video_memory)
+ if (thiz->use_video_memory) {
+ out_surface = gst_msdk_import_to_msdk_surface (outbuf, thiz->context,
+ &thiz->srcpad_info, GST_MAP_WRITE);
+ } else {
out_surface =
gst_msdk_import_sys_mem_to_msdk_surface (outbuf, &thiz->srcpad_info);
+ }
if (out_surface) {
out_surface->buf = gst_buffer_ref (outbuf);
GST_BUFFER_DURATION (outbuf_new) = thiz->buffer_duration;
release_out_surface (thiz, out_surface);
- out_surface =
- gst_msdk_import_to_msdk_surface (outbuf_new, thiz->context,
- &thiz->srcpad_buffer_pool_info, GST_MAP_WRITE);
-
- if (!thiz->use_video_memory)
+ if (thiz->use_video_memory) {
+ out_surface =
+ gst_msdk_import_to_msdk_surface (outbuf_new, thiz->context,
+ &thiz->srcpad_buffer_pool_info, GST_MAP_WRITE);
+ } else {
out_surface =
gst_msdk_import_sys_mem_to_msdk_surface (outbuf_new,
&thiz->srcpad_buffer_pool_info);
+ }
if (out_surface) {
out_surface->buf = gst_buffer_ref (outbuf_new);