[PATCH 3/4] quartz: Try all surfaces when calling GetSurface

Jan Schmidt jan at centricular.com
Tue Jul 19 23:37:11 CDT 2016


If the surface we want is refused, cycle through all
possible ones. Some applications (Silver at least)
request 2 surfaces, but then refuse to return anything
other than the first one.

Signed-off-by: Jan Schmidt <jan at centricular.com>
---
 dlls/quartz/vmr9.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c
index d590a71..8455678 100644
--- a/dlls/quartz/vmr9.c
+++ b/dlls/quartz/vmr9.c
@@ -292,6 +292,7 @@ static HRESULT WINAPI VMR9_DoRenderSample(BaseRenderer *iface, IMediaSample * pS
     REFERENCE_TIME tStart, tStop;
     VMR9PresentationInfo info;
     HRESULT hr;
+    int i;
 
     TRACE("%p %p\n", iface, pSample);
 
@@ -338,10 +339,19 @@ static HRESULT WINAPI VMR9_DoRenderSample(BaseRenderer *iface, IMediaSample * pS
     info.szAspectRatio.cx = This->bmiheader.biWidth;
     info.szAspectRatio.cy = This->bmiheader.biHeight;
 
-    hr = IVMRSurfaceAllocatorEx9_GetSurface(This->allocator, This->cookie, (++This->cur_surface)%This->num_surfaces, 0, &info.lpSurf);
+    /* Sometimes apps refuse to return the surface we request,
+     * so try each and see if any are available if the first fails */
+    for (i = 0; i < This->num_surfaces; i++) {
+      hr = IVMRSurfaceAllocatorEx9_GetSurface(This->allocator, This->cookie,
+              (++This->cur_surface) % This->num_surfaces, 0, &info.lpSurf);
+      if (SUCCEEDED (hr))
+        break;
+    }
 
-    if (FAILED(hr))
+    if (FAILED(hr)) {
+        ERR("Failed to get render surface (%x)\n", hr);
         return hr;
+    }
 
     VMR9_SendSampleData(This, &info, pbSrcStream, cbSrcStream);
     IDirect3DSurface9_Release(info.lpSurf);
-- 
2.7.4




More information about the wine-patches mailing list