[Live-devel] whether is a bug in function RTPInterface::handleRead in RTP over RTSP scenario

Ross Finlayson finlayson at live555.com
Sun Apr 8 22:31:40 PDT 2012


> In function  RTPInterface::handleRead (version 2012/04/04),
> 
> 225  if (fNextTCPReadStreamSocketNum < 0) {
> 226       // Normal case: read from the (datagram) 'groupsock':
> 227       readSuccess = fGS->handleRead(buffer, bufferMaxSize, bytesRead, fromAddress);
> 228       } else {
>          ...
> 242    fNextTCPReadSize -= bytesRead;
> 243    if (curBytesRead == 0 && curBytesToRead > 0) {
> 244      packetReadWasIncomplete = True;
> 245      return True;
> 246    } else if (curBytesRead < 0) {
> 247      bytesRead = 0;
> 248      readSuccess = False;
> 249    } else {
> 250      readSuccess = True;
> 251    }
> 252    fNextTCPReadStreamSocketNum = -1; // default, for next time
>          ...
> 
> Pay attension to line 252, variable fNextTCPReadStreamSocketNum is reset to -1 when handRead succeed(readSuccess=True). But at this time it is possible for condition fNextTCPReadSize > 0. if there are still bytes in TCP, and fNextTCPReadStreamSocketNum was reset to -1

Yes, you have discovered a bug.  Thank you.

Note, however, that the bug will show up only if the condition in the "if" statement on line 232:
	if (totBytesToRead > bufferMaxSize) totBytesToRead = bufferMaxSize;
is true.  I.e., the bug will show up only if "totBytesToRead > bufferMaxSize".  (Because otherwise, upon exiting the "while" loop,  the condition on line 243 will be true, and we'll return without getting to line 252.)

But nonetheless, there is a bug.  You should be able to fix it by replacing line 243
	if (curBytesRead == 0 && curBytesToRead > 0) {
with
	if (fNextTCPReadSize > 0) {

If this doesn't fix the problem, then please let us know.  Otherwise, this fix will be included in the next release of the software.

Thank you again.


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120408/9d4d96c1/attachment.html>


More information about the live-devel mailing list