From: Rudolf Polzer Date: Tue, 4 Jan 2011 13:20:38 +0000 (+0100) Subject: handle failure of video capture startup X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4631bf5907a7e2989791018859dbcb7382555bf2;p=xonotic%2Fdarkplaces.git handle failure of video capture startup --- diff --git a/cap_lavc.c b/cap_lavc.c index f48765d7..b5e4a306 100644 --- a/cap_lavc.c +++ b/cap_lavc.c @@ -886,6 +886,7 @@ void SCR_CaptureVideo_Lavc_BeginVideo(void) { Con_Printf("Failed to write header\n"); SCR_CaptureVideo_EndVideo(); + return; } format->buffer = Z_Malloc(format->bufsize); diff --git a/cl_screen.c b/cl_screen.c index 75f21727..a155c867 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -1194,6 +1194,7 @@ void SCR_CaptureVideo_EndVideo(void) if (!cls.capturevideo.active) return; cls.capturevideo.active = false; + Cvar_SetValueQuick(&cl_capturevideo, 0); Con_Printf("Finishing capture of %s.%s (%d frames, %d audio frames)\n", cls.capturevideo.basename, cls.capturevideo.formatextension, cls.capturevideo.frame, cls.capturevideo.soundsampleframe); @@ -1312,6 +1313,8 @@ void SCR_CaptureVideo(void) { if (!cls.capturevideo.active) SCR_CaptureVideo_BeginVideo(); + if(!cls.capturevideo.active) + return; if (cls.capturevideo.framerate != cl_capturevideo_fps.value * cl_capturevideo_framestep.integer) { Con_Printf("You can not change the video framerate while recording a video.\n"); @@ -1330,7 +1333,6 @@ void SCR_CaptureVideo(void) // if falling behind more than one second, stop if (newframenum - cls.capturevideo.frame > 60 * (int)ceil(cls.capturevideo.framerate)) { - Cvar_SetValueQuick(&cl_capturevideo, 0); Con_Printf("video saving failed on frame %i, your machine is too slow for this capture speed.\n", cls.capturevideo.frame); SCR_CaptureVideo_EndVideo(); return; @@ -1340,7 +1342,6 @@ void SCR_CaptureVideo(void) cls.capturevideo.frame = newframenum; if (cls.capturevideo.error) { - Cvar_SetValueQuick(&cl_capturevideo, 0); Con_Printf("video saving failed on frame %i, out of disk space? stopping video capture.\n", cls.capturevideo.frame); SCR_CaptureVideo_EndVideo(); }