[Live-devel] Problem in function RTSPClient::handleResponseBytes and RTSPClient::incomingDataHandler1()

张世勇 shiyong.zhang.cn at gmail.com
Sat May 19 00:10:04 PDT 2012


Hello

In RTSPClient

line 1312  void RTSPClient::incomingDataHandler1() {
line 1313    struct sockaddr_in dummy; // 'from' address - not used
line 1314
line 1315    int bytesRead = readSocket(envir(), fInputSocketNum, (unsigned
char*)&fResponseBuffer[fResponseBytesAlreadySeen], fResponseBufferBytesLeft,
dummy);
line 1316    handleResponseBytes(bytesRead);
line 1317  }


line 1338  void RTSPClient::handleResponseBytes(int newBytesRead) {
line 1339    do {
line 1340      if (newBytesRead > 0 && (unsigned)newBytesRead <
fResponseBufferBytesLeft) break; // data was read OK; process it below
line 1341
line 1342      if (newBytesRead >= (int)fResponseBufferBytesLeft) {
line 1343        // We filled up our response buffer.  Treat this as an
error (for the first response handler):
line 1344        envir().setResultMsg("RTSP response was truncated.
Increase \"RTSPClient::responseBufferSize\"");
line 1345      }
...
line  1370   fResponseBuffer[fResponseBytesAlreadySeen] = '\0';

In line 1340, You expect newBytesRead < fResponseBufferBytesLeft, but it's
possible newBytesRead == fResponseBufferBytesLeft.
Though you expectd to increase responseBufferSize to contain network date,
but it cann't avoid it.In some scenario it's still happen, especially in
RTP over RTSP.

Would you mind to change function RTSPClient::incomingDataHandler1, line
1315 as the following:
int bytesRead = readSocket(envir(), fInputSocketNum, (unsigned
char*)&fResponseBuffer[fResponseBytesAlreadySeen], fResponseBufferBytesLeft- 1,
dummy);
At this time, codes between line 1339-1366 maybe useless.

I don't think it can be avoid  this problem at its root by change the value
of TSPClient::responseBufferSize.

How do you think ?

Br

Shiyong Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120519/a754622c/attachment.html>


More information about the live-devel mailing list