Question

I'm using an custom source filter to get a live video stream from the internet, without knowing how it works. This source filter offers two output pins that are audio/video separately. When I just use it to capture the livestream into an avi file, like this: Simple Connectiones

It worked well. However, when I was trying to do a previewing while still remains capturing, I first added an Infinite Pin Tee Filter between the custom filter and AVI Mux, like this: Connections with an InfTee

Then the graph in GraphEdit just cannot be started (When I clicked the "Start the graph" button, it does nothing and doesn't give any reaction).

(ps: I thought that it's better using an Infinite Tee instead of a Smart Tee here, because that custom filter looks like not a capture filter.)

I've tried to write a Visual-C++ code doing the same thing, just using CoCreateInstance, IGraphBuilder::AddFilter and IGraphBuilder::Connect. To see what's wrong happened and what's the HRESULT is. Then I found the program hung when IMediaControl::Run was called. (The instance of IMediaControl was queried from the instance of IGraphBuilder).

I don't know why it would behave like that, neither do I know how to debug this. So does anyone gives me any help or tip ?

Thank you. :)

Was it helpful?

Solution

If you have source code for custom source filter, you can just break in and see the deadlock context yourself.

A typical streaming problem with multiple pin source is media sample delivery on the same thread. Even if it makes sense, one should avoid doing this since downstream filters that block streaming for reasons of stream matching or rate enforcement are not aware of thread reuse and would eventually lock dead.

If you have source code for the source filter, make sure sample delivery is split between threads. Otherwise, develop a helper filter which implements an asynchronous queue using worker thread, and connect source output pins, except the first pin, through these filters.

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