[vlc-devel] A Bug: VLC CANNOT seek RTSP stream , and its solution
sf
shaofa at vip.163.com
Thu Sep 9 11:38:03 CEST 2010
Hi, All
I think I have found a bug with live555 library which is used in VLC media player. When it' playing a RTSP stream from the MediaServer, I drag the slider to a new position but an error occurs : The slider will no longer move, while the video and audio still run correctly. (the tsx file is right there, and sequential playing is no problem). So I say, the live555 library with the client is not able to 'SEEK' to a position.
The cause is located in the live555 library. See MediaSession.cpp, MediaSubsession::getNormalPlayTime() . Look at this line:
u_int32_t timestampOffset = rtpSource()->curPacketRTPTimestamp() - rtpInfo.timestamp;
In the suitation of 'SEEKING', it will not work because rtpInfo.timestamp will be larger than curPacketRTPTimestamp. According to RFC 2326, the media server echo a reply in response of 'PLAY' with the timestamp and seq_num. And should it be noted that the seq_num can be something in the future. So current RTP packet's timestamp maybe smaller than the rtpInfo.timestamp.
A solution to this problem can be just add a judgement before compute the new fNPT_PTS_Offset:
..........................
if (rtpInfo.infoIsNew) {
if(rtpSource()->curPacketRTPSeqNum() < rtpInfo.seqNum) return -0.1; // add this line
u_int32_t timestampOffset = rtpSource()->curPacketRTPTimestamp() - rtpInfo.timestamp;
double nptOffset = (timestampOffset/(double)(rtpSource()->timestampFrequency()))*scale();
..........................
Then the VLC media player will work fine.
John. ShaoFa
2010-9-9
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100909/524d28ab/attachment.html>
More information about the vlc-devel
mailing list