]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Windows memory leak fix
authorChris Tallon <chris@vomp.tv>
Thu, 21 Sep 2006 21:32:33 +0000 (21:32 +0000)
committerChris Tallon <chris@vomp.tv>
Thu, 21 Sep 2006 21:32:33 +0000 (21:32 +0000)
videowin.cc

index e610a8448249661449775a53f5184ec0c10201bd..b2cd88035b602e1af045c0f3a11cfe4bffc80548 100644 (file)
@@ -206,7 +206,7 @@ int VideoWin::play()
 int VideoWin::dsplay()\r
 {\r
   if (!initted) return 0;\r
-\r
+ CleanupDS();\r
   //Build filter graph\r
   HRESULT hres;\r
 \r
@@ -273,6 +273,7 @@ int VideoWin::dsplay()
     allocatorvmr=new DsAllocator();\r
     dsvmrsurfnotify->AdviseSurfaceAllocator(NULL,allocatorvmr);\r
     allocatorvmr->AdviseNotify(dsvmrsurfnotify);\r
+       \r
 \r
 \r
 \r
@@ -287,10 +288,12 @@ int VideoWin::dsplay()
     if (hres=fg2->RenderEx(sourcefilter->GetPin(1)/*video*/,\r
         AM_RENDEREX_RENDERTOEXISTINGRENDERERS,NULL)!=S_OK) {\r
       Log::getInstance()->log("VideoWin", Log::WARN , "Failed rendering Video!");\r
+         fg2->Release();\r
       CleanupDS();\r
       ReleaseMutex(filtermutex);\r
       return 0;\r
     }\r
+       fg2->Release();\r
    }\r
 #endif\r
    if (hres=CoCreateInstance(CLSID_SystemClock,NULL,CLSCTX_INPROC_SERVER,\r
@@ -435,6 +438,7 @@ ULLONG VideoWin::frameNumberToTimecode(ULONG framenumber)
 void VideoWin::CleanupDS()\r
 {\r
   WaitForSingleObject(filtermutex,INFINITE);\r
+  if (dsmediacontrol)dsmediacontrol->Stop();\r
   if (cur_audio_media_sample) {\r
     cur_audio_media_sample->Release();\r
     cur_audio_media_sample=NULL;\r
@@ -471,6 +475,7 @@ void VideoWin::CleanupDS()
   }\r
 \r
 \r
+\r
   if (dsmediacontrol) {\r
     dsmediacontrol->Stop();\r
     dsmediacontrol->Release();\r