[Live-devel] small bug in rtspclient

Gabriel Bouvigne gabriel.bouvigne at resonate-mp4.com
Tue Jun 1 10:35:27 PDT 2004


Hello

I found a small bug in rtspclient.cpp, when looking for a "Session:" header.

Here is the correction (code snippet):

     // Look for a "Session:" header (to set our session id), and
     // a "Transport: " header (to set the server address/port)
     // For now, ignore other headers.  (Later, check for "CSeq" also #####)
     char* lineStart;
     char* sessionId = new char[readBufSize]; // ensures we have enough 
space
     while (1) {
       lineStart = nextLineStart;
       if (lineStart == NULL) break;

       nextLineStart = getLine(lineStart);

       if (sscanf(lineStart, "Session: %s", sessionId) == 1) {
         char tmpSessionID[17];
         //one server is responding this way: "Session: 
c907d527a54dbc90;timeout=60"
         //the "timeout" part should not be used.

         memcpy(tmpSessionID, sessionId, 16);
         tmpSessionID[16] = 0;
         subsession.sessionId = strDup(tmpSessionID);

	    delete[] fLastSessionId; fLastSessionId = strDup(tmpSessionID);
	    continue;
       }

       char* serverAddressStr;
       portNumBits serverPortNum;
       unsigned char rtpChannelId, rtcpChannelId;
       if (parseTransportResponse(lineStart,
				 serverAddressStr, serverPortNum,
				 rtpChannelId, rtcpChannelId)) {
	delete[] subsession.connectionEndpointName();
	subsession.connectionEndpointName() = serverAddressStr;
	subsession.serverPortNum = serverPortNum;
	subsession.rtpChannelId = rtpChannelId;
	subsession.rtcpChannelId = rtcpChannelId;
	continue;
       }
     }
     delete[] sessionId;



Regards,


-- 

Gabriel Bouvigne
Resonate mp4
Tel: (+33) 142 411 665


More information about the live-devel mailing list