| 867 | // which case the object should simply render the sample data immediately |
| 868 | |
| 869 | HRESULT CBaseRenderer::GetSampleTimes(IMediaSample *pMediaSample, __out REFERENCE_TIME *pStartTime, |
| 870 | __out REFERENCE_TIME *pEndTime) |
| 871 | { |
| 872 | ASSERT(m_dwAdvise == 0); |
| 873 | ASSERT(pMediaSample); |
| 874 | |
| 875 | // If the stop time for this sample is before or the same as start time, |
| 876 | // then just ignore it (release it) and schedule the next one in line |
| 877 | // Source filters should always fill in the start and end times properly! |
| 878 | |
| 879 | if (SUCCEEDED(pMediaSample->GetTime(pStartTime, pEndTime))) |
| 880 | { |
| 881 | if (*pEndTime < *pStartTime) |
| 882 | { |
| 883 | return VFW_E_START_TIME_AFTER_END; |
| 884 | } |
| 885 | } |
| 886 | else |
| 887 | { |
| 888 | // no time set in the sample... draw it now? |
| 889 | return S_OK; |
| 890 | } |
| 891 | |
| 892 | // Can't synchronise without a clock so we return S_OK which tells the |
| 893 | // caller that the sample should be rendered immediately without going |
| 894 | // through the overhead of setting a timer advise link with the clock |
| 895 | |
| 896 | if (m_pClock == NULL) |
| 897 | { |
| 898 | return S_OK; |
| 899 | } |
| 900 | return ShouldDrawSampleNow(pMediaSample, pStartTime, pEndTime); |
| 901 | } |
| 902 | |
| 903 | // By default all samples are drawn according to their time stamps so we |
| 904 | // return S_FALSE. Returning S_OK means draw immediately, this is used |