Hi,

I noticed that the RTSPClient class lacks a method for sending RECORD requests for a whole media session; there's only a method for sending RECORD requests for individual subsessions. Is this an intentional omission, or has it just not been needed yet?

I implemented such a method, see the attached patch. This seems to work fine for me.

Regards,
// Martin Storsjö
diff -ur live-orig/liveMedia/RTSPClient.cpp live/liveMedia/RTSPClient.cpp
--- live-orig/liveMedia/RTSPClient.cpp	2009-02-23 12:03:54.000000000 +0200
+++ live/liveMedia/RTSPClient.cpp	2009-03-11 21:29:31.000000000 +0200
@@ -1366,6 +1366,62 @@
   return False;
 }
 
+Boolean RTSPClient::recordMediaSession(MediaSession& session) {
+  char* cmd = NULL;
+  do {
+    // First, make sure that we have a RTSP session in progress
+    if (fLastSessionId == NULL) {
+      envir().setResultMsg(NoSessionErr);
+      break;
+    }
+
+    // Send the RECORD command:
+
+    // First, construct an authenticator string:
+    char* authenticatorStr
+      = createAuthenticatorString(&fCurrentAuthenticator,
+				  "RECORD", fBaseURL);
+
+    char const* sessURL = sessionURL(session);
+    char* const cmdFmt =
+      "RECORD %s RTSP/1.0\r\n"
+      "CSeq: %d\r\n"
+      "Session: %s\r\n"
+      "Range: npt=0-\r\n"
+      "%s"
+      "%s"
+      "\r\n";
+
+    unsigned cmdSize = strlen(cmdFmt)
+      + strlen(sessURL)
+      + 20 /* max int len */
+      + strlen(fLastSessionId)
+      + strlen(authenticatorStr)
+      + fUserAgentHeaderStrSize;
+    cmd = new char[cmdSize];
+    sprintf(cmd, cmdFmt,
+	    sessURL,
+	    ++fCSeq,
+	    fLastSessionId,
+	    authenticatorStr,
+	    fUserAgentHeaderStr);
+    delete[] authenticatorStr;
+
+    if (!sendRequest(cmd, "RECORD")) break;
+
+    // Get the response from the server:
+    unsigned bytesRead; unsigned responseCode;
+    char* firstLine; char* nextLineStart;
+    if (!getResponse("RECORD", bytesRead, responseCode, firstLine, nextLineStart)) break;
+
+    delete[] cmd;
+    return True;
+  } while (0);
+
+  delete[] cmd;
+  return False;
+}
+
 Boolean RTSPClient::recordMediaSubsession(MediaSubsession& subsession) {
   char* cmd = NULL;
   do {
diff -ur live-orig/liveMedia/include/RTSPClient.hh live/liveMedia/include/RTSPClient.hh
--- live-orig/liveMedia/include/RTSPClient.hh	2009-02-23 12:03:54.000000000 +0200
+++ live/liveMedia/include/RTSPClient.hh	2009-03-10 13:49:47.000000000 +0200
@@ -112,6 +112,9 @@
       // Issues a RTSP "PAUSE" command on "subsession".
       // Returns True iff this command succeeds
 
+  Boolean recordMediaSession(MediaSession& session);
+      // Issues a RTSP "RECORD" command on "session".
+      // Returns True iff this command succeeds
   Boolean recordMediaSubsession(MediaSubsession& subsession);
       // Issues a RTSP "RECORD" command on "subsession".
       // Returns True iff this command succeeds
_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to