va: check surface status before get derive image

According with documentation the surface has to be in ready state before getting
it derived image. This patch adds that check.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5760>
This commit is contained in:
Víctor Manuel Jáquez Leal 2023-11-30 16:52:02 +01:00 committed by GStreamer Marge Bot
parent 6b1fba14bf
commit ddf6fd9c61

View file

@ -212,6 +212,21 @@ va_get_derive_image (GstVaDisplay * display, VASurfaceID surface,
{
VADisplay dpy = gst_va_display_get_va_dpy (display);
VAStatus status;
VASurfaceStatus state;
/* When directly accessing a surface special care must be taken to insure sync
* proper synchronization with the graphics hardware. Clients should call
* vaQuerySurfaceStatus to insure that a surface is not the target of
* concurrent rendering or currently being displayed by an overlay. */
status = vaQuerySurfaceStatus (dpy, surface, &state);
if (status != VA_STATUS_SUCCESS) {
GST_WARNING ("vaQuerySurfaceStatus: %s", vaErrorStr (status));
return FALSE;
}
if (state != VASurfaceReady) {
GST_INFO ("Surface not ready");
return FALSE;
}
status = vaDeriveImage (dpy, surface, image);
if (status != VA_STATUS_SUCCESS) {