[Live-devel] A Bug with "MediaSubsession::getNormalPlayTime()" and its solution

sf shaofa at vip.163.com
Thu Sep 9 02:27:04 PDT 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 MediaSubsession::getNormalPlayTime() , MediaSession.cpp. 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 will work fine.
 
        John. ShaoFa
        2010-9-9
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20100909/eb420469/attachment-0001.html>


More information about the live-devel mailing list