RE: Memory leak when using directshow, help!



Hello Lee,

I believe I am chasing the same problem with essentially the same app level
code, but playing a wmv file.

Can I suggest you take a look at your window list with the remote spy tool.
On my system every RenderFile() creates 2 windows with title
"ActiveMovieWindow", one for class "VideoRenderer" and one for class
"FilterGraphWindow". These do not get destroyed after all the directshow
interfaces have been "Release()"ed.

What "ActiveMovieWindow" windows do you see and are they destroyed?

I see the same behaviour in desktop windows.

I have used the ocx to play the same files with no memory leak. Presumably
the ocx is built on top of directshow in the same way as our apps but knows
what to do about those windows. Sadly I need to use a custom video renderer
so I can no longer use the ocx.

Peter Donson (peterdotdonsonatteckprodotcom)

"Lee" wrote:

> Hi, All
>
> I am using eVC.40 sp2 and programm on wince4.2.
> I use directshow to play mp3 music file.
> The following is the code:
>
> IGraphBuilder *pGraph;
> IMediaControl *pMediaControl;
> IMediaEventEx *m_pMediaEvent;
> IBasicAudio *m_pBasicAudio;
> IMediaPosition *pMediaPosition;
>
> void DirectShowInit()
> {
>
> TRACE(_T("Mp3Player:: +++DirectShowInit\r\n"));
>
>
> // Create the filter graph manager.
> CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC,
> IID_IGraphBuilder, (void **)&pGraph);
>
> pGraph->QueryInterface(IID_IMediaControl, (void **)&pMediaControl);
>
> pGraph->QueryInterface(IID_IBasicAudio, (void **)&m_pBasicAudio);
>
> pGraph->QueryInterface(IID_IMediaEventEx, (void **)&m_pMediaEvent);
>
> pGraph->QueryInterface(IID_IMediaPosition, (void **)&pMediaPosition);
>
> TRACE(_T("Mp3Player:: ---DirectShowInit\r\n"));
>
> }
>
> void DirectShowClean()
> {
>
> TRACE(_T("Mp3Player:: +++DirectShowClean\r\n"));
>
> pMediaControl->Release();
> m_pMediaEvent->Release();
> m_pBasicAudio->Release();
> pMediaPosition->Release();
> pGraph->Release();
>
>
>
> TRACE(_T("Mp3Player:: ---DirectShowClean\r\n"));
> }
>
> void Play(TCHAR *szfilename)
> {
> REFTIME length,curPositon;
>
> GetDlgItem(IDC_BTN_PLAY)->EnableWindow(false);
>
> m_bStop = false;
>
> while(1)
> {
> DirectShowInit();
>
> pGraph->RenderFile(szfilename, NULL);
>
> pMediaPosition->get_Duration(&length);
>
> pMediaControl->Run();
>
>
> while(1)
> {
> Sleep(500);
>
> pMediaPosition->get_CurrentPosition(&curPositon);
> if(curPositon >= length)
> break;
>
>
> }
>
> pMediaControl->Stop();
>
> pMediaPosition->put_CurrentPosition(0);
>
> // Clean up.
> DirectShowClean();
>
>
> }
> }
>
> In the main function, I init the com and play multi mp3 file like this:
>
> woid DoWork()
> {
> CoInitializeEx(NULL, COINIT_MULTITHREADED);
>
> CString playlist[10];
>
> .....
> .....
> for(int i =0;i<10;i++)
> {
> play(playlist[i]);
> }
>
> CoUninitialize();
>
> }
>
> When music files are being played, I watch the systme memory state by
> control panel utility. The programm memory available is decreasing.
>
> The problem is in my source code,not in the low level driver. Because if i
> use ceplayer to play, everything is ok.
>
> Is there any problem in my source code?
> BTW, is there any general method to detect memory leak in eVC? Is there any
> system API to do this?
>
> Thanks a lot!!!!
>
>
.



Relevant Pages

  • Re: Playing fullscreen video
    ... I think the fastest thing to do is install the Windows Mobile 6.0 ... Mobile 6.0 SDK even if you are targetting a 5.0 device. ... I'm rather inexperienced with DirectShow, ... I've only been able to get DirectShow to play uncompressed AVI, ...
    (microsoft.public.windowsce.app.development)
  • Re: Memory leak when using directshow, help!
    ... These do not get destroyed after all the directshow ... > What "ActiveMovieWindow" windows do you see and are they destroyed? ... > I have used the ocx to play the same files with no memory leak. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Memory leak when using directshow, help!
    ... The memory leak occus when switching from one song to another. ... I think there is something wrong with the way I use directshow. ... It seems that ceplayer does not use directshow to play mp3 file. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: WMP 9/10/11 - Cannot play Type 1 DV AVIs
    ... default WMP on Windows 2000 DOES play Type 1). ... More details about directshow handling of Type 1 and Type 2 DV-AVI at ... then the user will not be able to use WMP to play them. ...
    (microsoft.public.windowsmedia.player)
  • Re: Video Error with Xbox 360 Extender
    ... - Did you check the Application, System, Media Center, and Security Event ... corresponding to the time that you tried to play TV? ... Is this a clean install of Windows Vista, an upgrade on top of Windows XP, ... "Video Error with Xbox 360" in particular look on this site and also ...
    (microsoft.public.windows.mediacenter)