Question

I have a PC running Windows XP x64 and I am trying to record video+audio and closed caption from Analog TV using a USB PCTV (Conexant Polaris). As a initial test, I have built a simple graph in GraphStudio with the following chain of filters:

Crossbar > Video Capture > CC Decoder > Line 21 Decoder > Video Renderer

I can play this and see it render a video showing correct closed caption, but almost every time I hit stop in GraphStudio, the computer will freeze and I have to reboot it.

I also have wrote a service, using .NET 4 + DirectShowLib. As it is a service, there is no UI to lock. I have the following chain:

Video Capture > Infinite Pin Tee Filter > ASF Writer
Video Capture > CC Decoder > SampleGrabber > NullRenderer

I use IFilterGraph2.AddFilter() and ICaptureGraphBuilder2.RenderStream() methods to create filter instances and connect it all together. When I call IMediaControl.Stop(), the application causes the computer to freeze. I've tried using DebugViewer, as suggested in other posts at StackOverflow, but I have not managed to capture any information. There is also no information in Dr Watson dumps.

I was calling Marshal.ReleaseComObject() on each interface -- tried doing that before and after the MediaControl.Stop() --, but many posts in StackOverflow said I should not do that, so I removed those calls, which didn't help with the freezing. I have also tried stopping the Video Capture filter before calling MediaControl.Stop() and calling EndFlush() at the VBI pin:

IEnumPins enumPins = null;
int hr = _source.EnumPins(out enumPins);
if (hr == 0)
{
    IPin[] pins = new IPin[1];
    int pcFetched = 0;
    while (enumPins.Next(1, pins, out pcFetched) == 0)
    {
        try
        {
            PinDirection pDir = new PinDirection();
            hr = pins[0].QueryDirection(out pDir);
            PinInfo pInfo = new PinInfo();
            hr = pins[0].QueryPinInfo(out pInfo);

            if (hr == 0 && pInfo.name == pinName)
                pins[0].EndFlush();
        }
        finally
        {
            Marshal.ReleaseComObject(pins[0]);
            pins[0] = null;
        }
    }
    Marshal.ReleaseComObject(enumPins);
    enumPins = null;
    pins = null;
}          

The idea was that no signal could cause a deadlock at the CC Decoder filter, but that didn't work.

I also have tried to use a computer with Windows 7 x64, where the CC Decoder filter is replaced by VBI Codec, which seems to be much more stable. But I guess I cannot use VBI Codec in XP, can I? Changing the OS is not an option for me.

How can I avoid these deadlocks when I I have no access to the internals of the filters? I think the EndFlush() solution should have worked, have I done something wrong there? I would also like to test VBI Codec in XP, even though it is not meant for that OS, is there a way to do that?

Thank you.

Was it helpful?

Solution

Freeze which requires reboot (as opposed to simply killing the task) to get things fixed is an indication of driver issue. The video capture device driver is supposedly having freeze causing bugs. The best you can do is to get a better driver from hardware vendor.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top