0

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?

Roman R.
  • 68,205
  • 6
  • 94
  • 158
H.Gh
  • 306
  • 2
  • 16

1 Answers1

0

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.

Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • Unfortunately BeginFlash and EndFlash didn't help. The audio buffer length is 500ms and when I'm calling these functions, audio still continue to playing. – H.Gh Jan 24 '16 at 06:26