MPEG-2 PTS and MediaSample TimeStamps when demuxing

Tech-Archive recommends: Fix windows errors by optimizing your registry



I am hoping someone here can help me with a problem I have had for a few
days now.
I have modified the GDCL parser sample to demux a MPEG-2 PS and it is
working fine except for seeking (A/V is out of sync).

I am trying to understand the correct method of converting the MPEG-2 PTS
values to MediaSample TimeStamps.
The current method I am following (as per the example code) is as follows -

On creation the filter sets REFERENCE_TIME m_tStart = 0;

In CompleteConnect() the parser finds the first Audio PTS in the file and
saves it in m_firstPTS.

In Receive() the parser obtains the PTS of the current audio or video packet
and subtracts m_firstPTS from it
then converts the result to a REFERENCE_TIME value.
m_tStart is then subtracted from it and it is used to set the timestamps on
the outgoing media samples.

I know that after a seek has occured the outgoing timestamps need to start
again from zero.
This is where the trouble starts!

So I have a couple of questions -

[1] Why do you need to modify each PTS value to subtract the initial PTS ?
If the stream starts at zero why is it an issue if say the first Audio
sample is timestamped with say 0.02 seconds?
It is possible that intial video timestamps may be negative, so why is this
not a problem?

[2] What should I do about the m_tStart and m_firstPTS offsets after a seek
?

Many Thanks

Steve



.



Relevant Pages

  • Re: Need Help With Audio Renderer
    ... you create stream time timestamps from the PTS or DTS values. ... I'm working with something very similar to MPEG2 transport format. ... So what happens if the audio render gets samples with timestamps 100 ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: MPEG-2 PTS and MediaSample TimeStamps when demuxing
    ... sending any timestamps at all. ... (It was Friday 13th, that's my excuse.) ... The extra logging did however throw up an issue regarding PTS values, ...
    (microsoft.public.win32.programmer.directx.video)