Hi Chris,
2008/3/14, Chris Robinson chris.kcat@gmail.com:
On Friday 14 March 2008 04:25:02 pm Maarten Lankhorst wrote:
Use the fallback system IReferenceClock, unless the app comes up with its own clock.
This doesn't look right. According to MSDN, the clock used when Run is called is chosen by the following algorithm:
1- The app called IMediaFilter::SetSyncSource
2- A live filter source is connected to the graph and supports the IReferenceClock interface
3- Any filters support IReferenceClock, starting with renderers and going "upstream" (following pin connections to the source), and falling back to disconnected filters if still nothing. Normally, an audio renderer would be selected here.
4- If still nothing, use the system reference clock.
Almost right.
You're specifying behavior when doing 'run'.
Quoting msdn on IFilterGraph::SetSyncSource: "This method instructs the Filter Graph Manager to choose a reference clock using its default algorithm. For more information about the algorithm that it uses, see Reference Clocks."
There are also strict criteria for live filter sources (basically webcams or microphones), and when a ireferenceclock will be used from audio. It needs to expose some interfaces before it is chosen as reference clock. This patch sets the reference clock to the system clock, unless overridden by the application. When SetDefaultSyncSource is called the clock is reset to the system clock.
This isn't entirely conforming, but it's the best solution at the moment.
Cheers, Maarten.