Postby [kultigin] » 15 Apr 2006 04:22
When PC or set top boxes decode mpeg they have a 27MHz local timer called STC. The video and audio has PTS values, which indicates the time (based on STC) to present the data (display the decoded video or output decoded audio).
If you are playing DVD or any other local mpeg file, it is easy, you can always read more data as you need it. But if you are receiving mpeg-ts from live broadcast, you need to buffer the data carefully in order to avoid interruption of presentation or running out of memory. PCR becomes handy at this stage, it is inserted to the mpeg-ts during broadcast based on broadcast equipments 27MHz clock. In order to buffer the data properly, you should try to match the local STC to incoming PCR referance. This way you will not start presentation early (can run out of data) or late (you will consume more than required memory for buffering).
Also if you have a way to adjust your clock, you can adjust it to match the broadcast. If your clock is slow, then your buffers will overflow in time. If your clock is fast, then your buffers will underrun in time.