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: Wed, 23 Jan 2008 09:58:01 -0800,    group: microsoft.public.windowsmedia.encoder        back       


RaceOnRCWCleanup   
Hello,
I am writing a program with C# using Windows Media Encoder 9 series. The 
program will have two encoders running at the same time. I did use 
ReleaseComObject. But I got RaceOnRCWCleanup error and the system crashed.

Here is a snippet of my code:

public class Encoder
{
       WMEncoderApp wmEncApp = new WMEncoderApplication();
      IWMEncoder wmEnc = wmEncApp.Encoder;
      IWMEncFile arcFile = wmEnc.File;
      arcFile.LocalFileName = somestring; 
      .......
       public void shutdown()
      {
            NAR(arcFile);
            NAR(wmEnc);
            NAR(wmEncApp);
            arcFile = null;
            wmEnc=null;
            wmEncApp = null;
      }

       private void NAR(object obj)
      {
           try {
           System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
           } catch 
          {
          }
}


As I said, I have two Encoder objects running at the same time. Seems I got 
the RaceOnRCWCleanup either when calling NAR(arcFile) or NAR(wmEncApp). I 
have at least the following questions:
1. Should I call NAR on some other objects? As I general questions, how to 
tell which objects should be released by calling releaseComObject?

2. How to tell if an object is in use?

3. When I checked the Task Manager, there are two wmenc.exe and one 
wmencagt.exe running.  What's wmencagt.exe?

4. Seems the RaceOnRCWCleanup cannot be catched using try and catch. My 
program crashed whenever this happened. How to pass this problem? 

Thanks a lot.

CWang
date: Wed, 23 Jan 2008 09:58:01 -0800   author:   cwang

Google
 
Web ureader.com


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