[Live-devel] [PATCH] Fix buffering of multiple GET_PARAMETER responses

Paul Clark paul at packetship.com
Wed Jun 24 06:12:57 PDT 2015


Abstruse case triggered by a VLC live555 module bug, in which
doEventLoop() is not called during PAUSE, causing GET_PARAMETER
responses to get stacked up.  When PLAY starts again the parsing
of these responses then fails because handleGET_PARAMETERResponse()
trims the entire buffer rather than just the response being
parsed, leading to the PLAY response being lost.

This patch delimits the buffer to the end of the response before
passing to handleGET_PARAMETERResponse so that the trimming
happens in the response in question, not at the end of the response
buffer
---
  liveMedia/RTSPClient.cpp | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/liveMedia/RTSPClient.cpp b/liveMedia/RTSPClient.cpp
index e49afbe..de0416f 100644
--- a/liveMedia/RTSPClient.cpp
+++ b/liveMedia/RTSPClient.cpp
@@ -1778,7 +1778,11 @@ void RTSPClient::handleResponseBytes(int 
newBytesRead) {
        } else if (strcmp(foundRequest->commandName(), "TEARDOWN") == 0) {
          if (!handleTEARDOWNResponse(*foundRequest->session(), 
*foundRequest->subsession())) break;
        } else if (strcmp(foundRequest->commandName(), "GET_PARAMETER") 
== 0) {
+            // Protect any further buffered responses from trimming
+            char saved = *responseEnd;
+            *responseEnd = '\0';
          if (!handleGET_PARAMETERResponse(foundRequest->contentStr(), 
bodyStart)) break;
+        *responseEnd = saved;
        }
      } else if (responseCode == 401 && 
handleAuthenticationFailure(wwwAuthenticateParamsStr)) {
        // We need to resend the command, with an "Authorization:" header:
-- 
2.1.4




More information about the live-devel mailing list