Commit 141c7a3e authored by Jean-Paul Saman's avatar Jean-Paul Saman

xvba_video_glx.c: fix query_surface_status() to report the true state, also on errors.

Be more strict in checking inside query_surface_status() function. It allowed
for reporting that all is ok on error. The function was therefor not reliable.
parent d50d89d0
...@@ -143,45 +143,50 @@ query_surface_status( ...@@ -143,45 +143,50 @@ query_surface_status(
VASurfaceStatus *surface_status VASurfaceStatus *surface_status
) )
{ {
int status; int status, ret = -1;
if (!surface_status)
abort(); /* coding error */
if (surface_status) if (surface_status)
*surface_status = VASurfaceReady; *surface_status = VASurfaceReady;
if (!obj_surface) if (!obj_surface)
return 0; return ret;
switch (obj_surface->va_surface_status) { switch (obj_surface->va_surface_status) {
case VASurfaceRendering: /* Rendering (XvBA level) */ case VASurfaceRendering: /* Rendering (XvBA level) */
ASSERT(obj_surface->used_for_decoding); ASSERT(obj_surface->used_for_decoding);
if (!obj_context) if (!obj_context)
return 0; return -1;
if (!obj_context->xvba_decoder) if (!obj_context->xvba_decoder)
return 0; return -1;
if (!obj_surface->xvba_surface) if (!obj_surface->xvba_surface)
return 0; return -1;
status = xvba_sync_surface( status = xvba_sync_surface(
obj_context->xvba_decoder, obj_context->xvba_decoder,
obj_surface->xvba_surface, obj_surface->xvba_surface,
XVBA_GET_SURFACE_STATUS XVBA_GET_SURFACE_STATUS
); );
if (status < 0) if (status < 0)
return -1; goto out;
if (status == XVBA_COMPLETED) if (status == XVBA_COMPLETED)
obj_surface->va_surface_status = VASurfaceReady; obj_surface->va_surface_status = VASurfaceReady;
ret = 0;
break; break;
case VASurfaceDisplaying: case VASurfaceDisplaying:
status = query_surface_status_glx(driver_data, obj_surface); status = query_surface_status_glx(driver_data, obj_surface);
if (status < 0) if (status < 0)
return -1; goto out;
if (status == XVBA_COMPLETED) if (status == XVBA_COMPLETED)
obj_surface->va_surface_status = VASurfaceReady; obj_surface->va_surface_status = VASurfaceReady;
ret = 0;
break; break;
} }
out:
if (surface_status) if (surface_status)
*surface_status = obj_surface->va_surface_status; *surface_status = obj_surface->va_surface_status;
return 0; return ret;
} }
// Synchronize surface // Synchronize surface
......
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