From 0de266b550bd2aa68fe55d854dcab9f29b1b70fa Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Thu, 21 Sep 2006 21:32:33 +0000 Subject: [PATCH] Windows memory leak fix --- videowin.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/videowin.cc b/videowin.cc index e610a84..b2cd880 100644 --- a/videowin.cc +++ b/videowin.cc @@ -206,7 +206,7 @@ int VideoWin::play() int VideoWin::dsplay() { if (!initted) return 0; - + CleanupDS(); //Build filter graph HRESULT hres; @@ -273,6 +273,7 @@ int VideoWin::dsplay() allocatorvmr=new DsAllocator(); dsvmrsurfnotify->AdviseSurfaceAllocator(NULL,allocatorvmr); allocatorvmr->AdviseNotify(dsvmrsurfnotify); + @@ -287,10 +288,12 @@ int VideoWin::dsplay() if (hres=fg2->RenderEx(sourcefilter->GetPin(1)/*video*/, AM_RENDEREX_RENDERTOEXISTINGRENDERERS,NULL)!=S_OK) { Log::getInstance()->log("VideoWin", Log::WARN , "Failed rendering Video!"); + fg2->Release(); CleanupDS(); ReleaseMutex(filtermutex); return 0; } + fg2->Release(); } #endif if (hres=CoCreateInstance(CLSID_SystemClock,NULL,CLSCTX_INPROC_SERVER, @@ -435,6 +438,7 @@ ULLONG VideoWin::frameNumberToTimecode(ULONG framenumber) void VideoWin::CleanupDS() { WaitForSingleObject(filtermutex,INFINITE); + if (dsmediacontrol)dsmediacontrol->Stop(); if (cur_audio_media_sample) { cur_audio_media_sample->Release(); cur_audio_media_sample=NULL; @@ -471,6 +475,7 @@ void VideoWin::CleanupDS() } + if (dsmediacontrol) { dsmediacontrol->Stop(); dsmediacontrol->Release(); -- 2.39.2