Commit ef71d876 authored by Jean-Paul Saman's avatar Jean-Paul Saman

vaapi-x11: vasub.c: change CopyRGBAToVAImage() asserts() into runtime check.

Check also in runtime if the create VAImage succeeds properly.
parent c77342f8
......@@ -348,14 +348,18 @@ static int CopyRGBAToVAImage(vlc_object_t *obj, VADisplay p_display,
}
/* Sanity checks */
assert(image->image_id != VA_INVALID_ID);
assert(image->buf != VA_INVALID_ID);
assert(image->format.fourcc == VA_FOURCC_RGBA);
assert(image->num_planes == 1);
assert(image->height == pic->format.i_height);
assert(image->width == pic->format.i_width);
assert(image->format.bits_per_pixel == pic->format.i_bits_per_pixel);
if ((image->image_id == VA_INVALID_ID) ||
(image->buf == VA_INVALID_ID) ||
(image->format.fourcc != VA_FOURCC_RGBA) ||
(image->num_planes != 1) ||
(image->height != pic->format.i_height) ||
(image->width != pic->format.i_width) ||
(image->format.bits_per_pixel != pic->format.i_bits_per_pixel))
{
msg_Err(obj, "image created with wrong properties, destroying it.");
vaDestroyImage(p_display, image->image_id);
return VLC_EGENERIC;
}
void *p_base;
status = vaMapBuffer(p_display, image->buf, &p_base);
......@@ -453,8 +457,6 @@ vasubpicture_cache_t *cache_SubpictureCreate(vlc_object_t *obj, vlc_va_conn_t *v
return NULL;
}
assert(image->image_id != VA_INVALID_ID);
VAStatus status;
status = vaCreateSubpicture(vaconn->p_display, image->image_id, &vasub_cache->i_id);
if (status != VA_STATUS_SUCCESS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment