quartz: Set a default sync source on the filtergraph

Chris Robinson chris.kcat at gmail.com
Fri Mar 14 20:37:49 CDT 2008


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.


I don't think SetDefaultSyncSource should should just jump right to the system 
clock. As far as I can tell, you need to hold a reference to a clock, and a 
bool saying if it's custom set (as even NULL can be a valid custom override). 
When Run is called, if no custom override is set, it would release the 
current set clock (if any) and check as steps 2, 3, and 4 describe.

So really what the function needs to do is release the current set reference 
clock (if non-NULL), clear a custom-override flag (while SetSyncSource sets 
the custom-override flag and holds a reference for non-NULL filters), and 
check steps 2, 3, and 4. So something like:

SetSyncSource(clock) {
    if(this->ref_clock)
        this->ref_clock->Release();
    this->ref_clock = clock;
    if(clock)
        clock->AddRef();
    this->custom_clock = TRUE;
}
SetDefaultSyncSource() {
    SetSyncSource(NULL);
    this->custom_clock = FALSE;
    ...do steps 2, 3, and 4...
    this->ref_clock = selected_clock;
}
Run() {
    if(!this->custom_clock)
        SetDefaultSyncSource();
    ...run...
}



More information about the wine-devel mailing list