[Live-devel] RTCPInstance and RTP timestamp
David BERTRAND
bidibulle at operamail.com
Tue Jul 18 08:16:34 PDT 2006
Hi Ross,
I've struggled for a whisle on a synchronization problem between audio and video occuring with my streaming application (based on liveMedia library). I noticed that main players attach more importance to the timestamp information contained in the RTP-info header than to the timestamp information contained in the RTCP SRs. There is a case where the information sent in the RTP-info and the RTP timestamps of the very first timestamp of each track is wrong.
Let's say for example that the first packet sent for audio track is a RTP packet, the timestamp used in this packet will be the timestamp published in the RTP-info header, i.e. fTimestampBase (up to now, this is fine). However, if the first packet sent for the video track is a RTCP SR, this one will used as RTP timestamp the timestamp published in the RTP-info header, i.e. fTimestampBase. And then we have a problem with the next packet sent for video, which will be fTimestampBase + timestampIncrement.
The two tracks are now desynchronized (to be synchronized they should both use fTimestampBase as first timestamp).
I recognize my problem is quite rare (if you stream from a file, you can send RTP packets immediately, so RTCP packets will probably be sent after the first RTP packets) and also very difficult to resolve properly. IMO, the only acceptable way is to send RTCP packets only if a RTP packet has already been sent for the same track. This fix works for my particular problem and I would like to propose it as patch for the library. Here is the code :
In RTCPInstance::addReport(), replace :
if (fSink != NULL) {
addSR();
} else if (fSource != NULL) {
addRR();
}
with
if (fSink != NULL && fSink->haveComputedFirstTimestamp()) {
addSR();
} else if (fSource != NULL) {
addRR();
}
In RTPSink.hh, add public method to access private field fHaveComputedFirstTimestamp :
Boolean haveComputedFirstTimestamp() const { return fHaveComputedFirstTimestamp; }
Thank you in advance for your feedback
David
--
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 9 at http://www.opera.com
Powered by Outblaze
More information about the live-devel
mailing list