View Full Version : Timestamps - getCurReferenceTime() and tsMediaSampleDesc structure members

August 9, 2007, 19:03:25

First off, sorry if this has been discussed before, but search did not give me any results for either the function or structure member name.

I would like to know how the times reported in the getCurReferenceTime() function and those in the tsMediaSampleDesc structure of an IFrame (recieved via updateInPlace in own FrameUpdateFilterImpl) are related.

I know they both use the DShow REFERENCE_TIME type and getCurReferenceTime() is simply the current time of the DShow graph. No issues with that.

Experimentation seems to confirm that the times in the tsMediaSampleDesc structure are anchored at the graph start time.
That is in a perfect world with infinite accuracy and no line/execution delay, the relation
tsMediaSampleDesc.SampleStart == getCurReferenceTime() - getGraphStartReferenceTime() would have held true at the time the camera started recording the picture (and analoguous for SampleEnd).

Can you confirm this based on the code (not only from own experimentation) ?

If so, it seems when i do this calculation as the first instruction within my updateInPlace(), the delta time getCurReferenceTime() - getGraphStartReferenceTime() i get is _smaller_ than the time the camera recorded as SampleStart (as much as 1.5 microseconds). I would have expected my time to be considerably larger than the one from the camera, since the whole DShow stuff the frame has to travel from the camera until it reaches my "callback", but definitely not smaller.

Is there someone around who knows what happens here and maybe even could give some concrete numbers?

My first impression was the above mentioned delta time is truncated to milliseconds - that is "graphNow - graphStart" (my naming, for brevity) is always a multiple of 10000 (decimal).

Do you internally update the time reported by getCurReferenceTime() in a way that leads to this odd behaviour?

And if so: the camera timestamps seems not affected by this, at least the timestamps in the structure do not look truncated in anyway. What accuracy (with respect to the graph start moment) is to be expected from them?

I know these are quite some questions, but i hope someone can answer at least parts of it :)

If the questions are not clear, please say so and i try to word it differently.

TIA, F.Seiler