[MPlayer-dev-eng] [PATCH] Let vo directx survive screensaver

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sun Oct 29 10:19:48 CET 2006


Hello,
On Sun, Oct 29, 2006 at 10:19:07AM +0100, Reimar D?ffinger wrote:
> On Mon, Oct 23, 2006 at 01:05:48PM +0800, Zuxy Meng wrote:
> > Currently vo directx will crash with seg fault when a screensaver
> > starts, while vo gl, vo gl2, vo sdl work fine. The root cause is that
> > when this happens, the last line of flip_page() will set image = NULL.
> > This patch enables vo directx to survive a screensaver, a monitor off,
> > a standby and a hibernation, either full screen or windowed, active or
> > inactive. But there's still one situation that it can't handle: if
> > mplayer starts to play a file while the screensaver is running,
> > mplayer won't wake the computer up and once the screensaver exits,
> > mplayer will have a black window.
> 
> Can you test this? It is at least as ugly but more straightforward,
> if it works this while-loop should probably be a separate function and
> all lock calls replaced by it.

Patch here *g*

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libvo/vo_directx.c
===================================================================
--- libvo/vo_directx.c	(revision 20488)
+++ libvo/vo_directx.c	(working copy)
@@ -1168,7 +1168,11 @@
         ddbltfx.dwDDFX = DDBLTFX_NOTEARING;
         g_lpddsPrimary->lpVtbl->Blt(g_lpddsPrimary, &rd, g_lpddsBack, NULL, DDBLT_WAIT, &ddbltfx);
     }	
-	g_lpddsBack->lpVtbl->Lock(g_lpddsBack,NULL,&ddsdsf, DDLOCK_NOSYSLOCK | DDLOCK_WAIT , NULL);
+    while (g_lpddsBack->lpVtbl->Lock(g_lpddsBack, NULL, &ddsdsf,
+             DDLOCK_NOSYSLOCK | DDLOCK_WAIT, NULL) != DD_OK) {
+      mp_msg(MSGT_VO, MSGL_WARN, "<vo_directx>Unable to lock surface, retrying\n");
+      Sleep(500);
+    }
     if(vo_directrendering && (dstride != ddsdsf.lPitch)){
       mp_msg(MSGT_VO,MSGL_WARN,"<vo_directx><WARN>stride changed !!!! disabling direct rendering\n");
       vo_directrendering=0;


More information about the MPlayer-dev-eng mailing list