0
votes

I have a directshow filter graph that run forever without any stopping. But when I change source of the graph to other video file, synchronization between audio & video streams was failed.

It's happening because of some audio frames haven't played yet. How could tell to graph to flash out audio buffer?

1
you might try GMFBridge to switch source. - wimh

1 Answers

0
votes

When you stop filter graph, the data is flushed unconditionally.

Without stopping, you can remove buffered data by calling respective input pin's IPin::BeginFlush and IPin::EndFlush methods (the first one and then the second immediately afterwards). This does not have to be renderer's input pin, you are interested in calling the upstream audio pin so that this flushing call is propagated through and drains everything up to the renderer.