Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
media
danimation.controls
danimation.programming
devices
drm
dshow.programming
dtransform
encoder
encoder.optimization
hometheaterpc
media
media.beta
media.beta.encoder
mediacenter
mediacenter.portable
mediaplayer
music.products
musicproducer
player
player.plugins
player.skins
player.solaris
player.visualizations
player.web
sdk
server
tools
  
 
date: Tue, 1 Jul 2008 14:15:21 -0700,    group: microsoft.public.windowsmedia.sdk        back       


Memory leak with WMP OCX   
I'm using the Windows Media Player OCX control in one of my applications 
which has to handle a large number of audio files sequentially without using 
up too much memory.  I call the Close() function each time I am finished with 
a file, but as the program progresses I see its VM usage shoot past 1GB after 
opening only ten or twelve wave files!  Does anyone have any idea why this is 
happening and what I can do to fix it?
Here's a code transcript (it's in PB, but it's similar enough to VB to be 
understandable, hopefully):
ole_wmp.object.URL = ls_docname
ole_wmp.object.settings.volume = 0
li_wmpDuration = 0
do
	yield()
	li_wmpDuration = ole_wmp.object.currentmedia.duration
loop until li_wmpDuration <> 0 or not 
isnull(ole_wmp.object.currentmedia.error)
...
ole_wmp.object.URL = ""
ole_wmp.object.close()
date: Tue, 1 Jul 2008 14:15:21 -0700   author:   MNGoldenEagle

Re: Memory leak with WMP OCX   
From: "MNGoldenEagle"

> I'm using the Windows Media Player OCX control in one of
> my applications which has to handle a large number of
> audio files sequentially without using up too much
> memory.  I call the Close() function each time I am
> finished with a file, but as the program progresses I see
> its VM usage shoot past 1GB after opening only ten or
> twelve wave files!  Does anyone have any idea why this is
> happening and what I can do to fix it?
> Here's a code transcript (it's in PB, but it's similar
> enough to VB to be understandable, hopefully):

Unless you need some specific feature of WMP (DRM, effects, 
visualizations...), why don't you just use what WMP uses 
internally, that is DirectShow? Basic DirectShow tasks like 
file playback can be accomplished through its automation 
interface and, if you can use WMP's automation interface 
(OCX), you should be able to use DirectShow's even more 
easily:

http://msdn.microsoft.com/en-us/library/ms787852(VS.85).aspx

-- 
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
date: Tue, 1 Jul 2008 17:44:59 -0400   author:   Alessandro Angeli

Re: Memory leak with WMP OCX   
Well, I tried using DirectShow, but in order for it to work properly with PB 
I need to use the OLE interface, and from what I could find in the Windows 
Registry, none of the Quartz.dll records had any ProgIDs that I could use to 
link to them.  I can't seem to find any other means of accessing these except 
via ProgIDs, and I've tried registering the DLL numerous times to no effect.  
If I attempt to use the "ActiveMovieControl" object, it spawns a WMP 6 OCX, 
which isn't what I want.  Is there a way to set up DirectShow so that its 
components have ProgIDs I can use?  Otherwise, I have no choice but to use 
WMP, which currently eats up 1GB of virtual memory after opening roughly ten 
wave files.

"Alessandro Angeli" wrote:
> Unless you need some specific feature of WMP (DRM, effects, 
> visualizations...), why don't you just use what WMP uses 
> internally, that is DirectShow? Basic DirectShow tasks like 
> file playback can be accomplished through its automation 
> interface and, if you can use WMP's automation interface 
> (OCX), you should be able to use DirectShow's even more 
> easily:
> 
> http://msdn.microsoft.com/en-us/library/ms787852(VS.85).aspx
date: Thu, 3 Jul 2008 12:34:03 -0700   author:   MNGoldenEagle

Re: Memory leak with WMP OCX   
From: "MNGoldenEagle"

> Well, I tried using DirectShow, but in order for it to
> work properly with PB I need to use the OLE interface,
> and from what I could find in the Windows Registry, none
> of the Quartz.dll records had any ProgIDs that I could
> use to link to them.  I can't seem to find any other
> means of accessing these except via ProgIDs, and I've
> tried registering the DLL numerous times to no effect. If
> I attempt to use the "ActiveMovieControl" object, it
> spawns a WMP 6 OCX, which isn't what I want.  Is there a
> way to set up DirectShow so that its components have
> ProgIDs I can use?  Otherwise, I have no choice but to
> use WMP, which currently eats up 1GB of virtual memory
> after opening roughly ten wave files.

The documentation for PowerBuilder's
OLEObject.ConnectToNewObject() (if that's what you're using) 
says that you can use a CLSID instead of a ProgID.

Have you tried the FilgraphManager's CLSID?
{E436EBB3-524F-11CE-9F53-0020AF0BA770}

Otherwise you can just add a ProgID to the registry
yourself:

[HKCR\MNGoldenEagle.FilterGraph\CLSID]
@="{E436EBB3-524F-11CE-9F53-0020AF0BA770}"


-- 
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
date: Thu, 3 Jul 2008 16:05:11 -0400   author:   Alessandro Angeli

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us