Some CCTV decribe additional information in the response of GET_PARAMETER. Such 
like,

"
RTSP/1.0 200 OK
CSeq: 7
Content-Length: 0
Content-Type: text/parameters
Session: 109532068

framerate: 25
"

In this case, 
We couldn't handle body (framerate: 25) because content length is zero.
Furthermore, unhandled body stored as extra data in response buffer.
And it causes connection loss.

Below patch works for me But I want to confirm it.

diff -ur ori/liveMedia/RTSPClient.cpp live/liveMedia/RTSPClient.cpp
--- ori/liveMedia/RTSPClient.cpp    2016-10-29 15:28:35.000000000 +0900
+++ live/liveMedia/RTSPClient.cpp   2016-11-01 17:49:04.095745523 +0900
@@ -1763,6 +1763,11 @@
       unsigned bodyOffset = nextLineStart == NULL ? fResponseBytesAlreadySeen 
: nextLineStart - headerDataCopy;
       bodyStart = &fResponseBuffer[bodyOffset];
       numBodyBytes = fResponseBytesAlreadySeen - bodyOffset;
+      /* Handle abnormal response: body exist but content-length is zero */
+      if (!contentLength && strlen(bodyStart)) {
+        contentLength = numBodyBytes;
+      }
+           
       if (contentLength > numBodyBytes) {
    // We need to read more data.  First, make sure we have enough space for it:
    unsigned numExtraBytesNeeded = contentLength - numBodyBytes;

_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to