[Live-devel] TransportStreamFramer latency?

Ross Finlayson finlayson at live.com
Wed Aug 31 11:39:15 PDT 2005


At 02:16 AM 8/31/2005, you wrote:
> > For a custom project (using only the Amino STBs as client), we
> > overcame this problem by modifying the "MPEG2TransportStreamFramer"
> > by continually adjusting the computed "fTSPacketDurationEstimate"
> > value in order to maintain a roughly fixed (and >0) estimated buffer
> > size at the client.  Unfortunately, this code isn't very portable
> > (because it's peculiar to the ideosyncracies of the Amino STB), so
> > it's not clear if/when/how it could be made part of the general, 
> public code.
>
>Could you lend me an hand figuring out how to do this? Do you use
>feedback from the STB?

No.  The STB receives raw UDP only, and so doesn't send back any RTCP 
packets, or anything similar.

>  In that case, how? I cannot see any function in
>the stb that gives that kind of feedback.

There isn't any.  Instead, we *estimate* how much extra data is 
buffered at the client, and insert a 'fudge factor' into the 
calculation of "fDurationInMicroseconds" in order to keep the amount 
of estimated buffered data roughly constant.

I.e., the statement
         fDurationInMicroseconds
     = numTSPackets * (unsigned)(fTSPacketDurationEstimate*1000000);
becomes
         double fudgedPacketDurationEstimate = fTSPacketDurationEstimate;
         if (clientBufferTimeEstimate < desiredBufferTime) {
                 fudgedPacketDurationEstimate *= 0.9;
         } else {
                 fudgedPacketDurationEstimate /= 0.9;
         }
         fDurationInMicroseconds
     = numTSPackets * (unsigned)(fudgedPacketDurationEstimate*1000000);

Where "clientBufferTimeEstimate" is our estimate of how many seconds 
worth of extra data is currently buffered at the client.  It is computed as
         clientBufferTimeEstimate = estimatedTransmitTime - estimatedPlayTime;
where "estimatedTransmitTime" is computed by adding up
         fDurationInMicroseconds/1000000.0
each time round the loop, and "estimatedPlayTime" is just the most 
recently-seen SCR.

Apart from this, the "MPEG2TransportStreamFramer" code remained the same.



	Ross Finlayson
	LIVE.COM
	<http://www.live.com/>



More information about the live-devel mailing list