[SCM] liblivemedia/master: Imported Upstream version 2016.03.16

sramacher at users.alioth.debian.org sramacher at users.alioth.debian.org
Wed Mar 23 17:11:55 UTC 2016


The following commit has been merged in the master branch:
commit 7b54c706d47ae0b45ec7fc5394c15b3d523fe2c6
Author: Sebastian Ramacher <sramacher at debian.org>
Date:   Mon Mar 21 14:41:30 2016 +0100

    Imported Upstream version 2016.03.16

diff --git a/BasicUsageEnvironment/include/BasicUsageEnvironment_version.hh b/BasicUsageEnvironment/include/BasicUsageEnvironment_version.hh
index 6233699..12a4cd1 100644
--- a/BasicUsageEnvironment/include/BasicUsageEnvironment_version.hh
+++ b/BasicUsageEnvironment/include/BasicUsageEnvironment_version.hh
@@ -4,7 +4,7 @@
 #ifndef _BASICUSAGEENVIRONMENT_VERSION_HH
 #define _BASICUSAGEENVIRONMENT_VERSION_HH
 
-#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_STRING	"2016.02.22"
-#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_INT		1456099200
+#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_STRING	"2016.03.16"
+#define BASICUSAGEENVIRONMENT_LIBRARY_VERSION_INT		1458086400
 
 #endif
diff --git a/UsageEnvironment/include/UsageEnvironment_version.hh b/UsageEnvironment/include/UsageEnvironment_version.hh
index 0bece0b..ca1a160 100644
--- a/UsageEnvironment/include/UsageEnvironment_version.hh
+++ b/UsageEnvironment/include/UsageEnvironment_version.hh
@@ -4,7 +4,7 @@
 #ifndef _USAGEENVIRONMENT_VERSION_HH
 #define _USAGEENVIRONMENT_VERSION_HH
 
-#define USAGEENVIRONMENT_LIBRARY_VERSION_STRING	"2016.02.22"
-#define USAGEENVIRONMENT_LIBRARY_VERSION_INT		1456099200
+#define USAGEENVIRONMENT_LIBRARY_VERSION_STRING	"2016.03.16"
+#define USAGEENVIRONMENT_LIBRARY_VERSION_INT		1458086400
 
 #endif
diff --git a/config.linux-with-shared-libraries b/config.linux-with-shared-libraries
index 1b60078..0a32e64 100644
--- a/config.linux-with-shared-libraries
+++ b/config.linux-with-shared-libraries
@@ -4,7 +4,7 @@
 # One or more interfaces were added, but no existing interfaces were changed or removed => CURRENT += 1; REVISION = 0; AGE += 1
 
 libliveMedia_VERSION_CURRENT=52
-libliveMedia_VERSION_REVISION=0
+libliveMedia_VERSION_REVISION=2
 libliveMedia_VERSION_AGE=0
 libliveMedia_LIB_SUFFIX=so.$(shell expr $(libliveMedia_VERSION_CURRENT) - $(libliveMedia_VERSION_AGE)).$(libliveMedia_VERSION_AGE).$(libliveMedia_VERSION_REVISION)
 
diff --git a/genMakefiles b/genMakefiles
index 2f674de..027b762 100755
--- a/genMakefiles
+++ b/genMakefiles
@@ -10,42 +10,16 @@ then
     usage $*
 fi
 
-cd liveMedia
-/bin/rm -f Makefile
-cat Makefile.head ../config.$1 Makefile.tail > Makefile
-chmod a-w Makefile
-
-cd ../groupsock
-/bin/rm -f Makefile
-cat Makefile.head ../config.$1 Makefile.tail > Makefile
-chmod a-w Makefile
-
-cd ../UsageEnvironment
-/bin/rm -f Makefile
-cat Makefile.head ../config.$1 Makefile.tail > Makefile
-chmod a-w Makefile
-
-cd ../BasicUsageEnvironment
-/bin/rm -f Makefile
-cat Makefile.head ../config.$1 Makefile.tail > Makefile
-chmod a-w Makefile
-
-cd ../testProgs
-/bin/rm -f Makefile
-cat Makefile.head ../config.$1 Makefile.tail > Makefile
-chmod a-w Makefile
-
-cd ../mediaServer
-/bin/rm -f Makefile
-cat Makefile.head ../config.$1 Makefile.tail > Makefile
-chmod a-w Makefile
-
-cd ../proxyServer
-/bin/rm -f Makefile
-cat Makefile.head ../config.$1 Makefile.tail > Makefile
-chmod a-w Makefile
+platform=$1
+subdirs="liveMedia groupsock UsageEnvironment BasicUsageEnvironment testProgs mediaServer proxyServer"
+    
+for subdir in $subdirs
+do
+    /bin/rm -f $subdir/Makefile
+    cat $subdir/Makefile.head config.$platform $subdir/Makefile.tail > $subdir/Makefile
+    chmod a-w $subdir/Makefile
+done
 
-cd ..
 /bin/rm -f Makefile
 cat Makefile.head config.$1 Makefile.tail > Makefile
 chmod a-w Makefile
diff --git a/groupsock/include/groupsock_version.hh b/groupsock/include/groupsock_version.hh
index 518b046..92603e4 100644
--- a/groupsock/include/groupsock_version.hh
+++ b/groupsock/include/groupsock_version.hh
@@ -4,7 +4,7 @@
 #ifndef _GROUPSOCK_VERSION_HH
 #define _GROUPSOCK_VERSION_HH
 
-#define GROUPSOCK_LIBRARY_VERSION_STRING	"2016.02.22"
-#define GROUPSOCK_LIBRARY_VERSION_INT		1456099200
+#define GROUPSOCK_LIBRARY_VERSION_STRING	"2016.03.16"
+#define GROUPSOCK_LIBRARY_VERSION_INT		1458086400
 
 #endif
diff --git a/liveMedia/MediaSession.cpp b/liveMedia/MediaSession.cpp
index 88829a7..fe24c32 100644
--- a/liveMedia/MediaSession.cpp
+++ b/liveMedia/MediaSession.cpp
@@ -723,7 +723,7 @@ Boolean MediaSubsession::initiate(int useSpecialRTPoffset) {
       // Port numbers were not specified in advance, so we use ephemeral port numbers.
       // Create sockets until we get a port-number pair (even: RTP; even+1: RTCP).
       // (However, if we're multiplexing RTCP with RTP, then we create only one socket,
-      // and the port number  can be even or odd.)
+      // and the port number can be even or odd.)
       // We need to make sure that we don't keep trying to use the same bad port numbers over
       // and over again, so we store bad sockets in a table, and delete them all when we're done.
       HashTable* socketHashTable = HashTable::create(ONE_WORD_HASH_KEYS);
diff --git a/liveMedia/ProxyServerMediaSession.cpp b/liveMedia/ProxyServerMediaSession.cpp
index 776e132..f3bda20 100644
--- a/liveMedia/ProxyServerMediaSession.cpp
+++ b/liveMedia/ProxyServerMediaSession.cpp
@@ -36,6 +36,7 @@ public:
   virtual ~ProxyServerMediaSubsession();
 
   char const* codecName() const { return fCodecName; }
+  char const* url() const { return ((ProxyServerMediaSession*)fParentSession)->url(); }
 
 private: // redefined virtual functions
   virtual FramedSource* createNewStreamSource(unsigned clientSessionId,
@@ -66,7 +67,7 @@ private:
 ////////// ProxyServerMediaSession implementation //////////
 
 UsageEnvironment& operator<<(UsageEnvironment& env, const ProxyServerMediaSession& psms) { // used for debugging
-  return env << "ProxyServerMediaSession[\"" << psms.url() << "\"]";
+  return env << "ProxyServerMediaSession[" << psms.url() << "]";
 }
 
 ProxyRTSPClient*
@@ -238,7 +239,7 @@ static void continueAfterGET_PARAMETER(RTSPClient* rtspClient, int resultCode, c
 ////////// "ProxyRTSPClient" implementation /////////
 
 UsageEnvironment& operator<<(UsageEnvironment& env, const ProxyRTSPClient& proxyRTSPClient) { // used for debugging
-  return env << "ProxyRTSPClient[\"" << proxyRTSPClient.url() << "\"]";
+  return env << "ProxyRTSPClient[" << proxyRTSPClient.url() << "]";
 }
 
 ProxyRTSPClient::ProxyRTSPClient(ProxyServerMediaSession& ourServerMediaSession, char const* rtspURL,
@@ -330,7 +331,7 @@ void ProxyRTSPClient::continueAfterLivenessCommand(int resultCode, Boolean serve
   scheduleLivenessCommand();
 }
 
-#define SUBSESSION_TIMEOUT_SECONDS 10 // how many seconds to wait for the last track's "SETUP" to be done (note below)
+#define SUBSESSION_TIMEOUT_SECONDS 5 // how many seconds to wait for the last track's "SETUP" to be done (note below)
 
 void ProxyRTSPClient::continueAfterSETUP(int resultCode) {
   if (resultCode != 0) {
@@ -347,7 +348,8 @@ void ProxyRTSPClient::continueAfterSETUP(int resultCode) {
 	    << "; numSubsessions " << fSetupQueueHead->fParentSession->numSubsessions() << "\n\tqueue:";
     for (ProxyServerMediaSubsession* p = fSetupQueueHead; p != NULL; p = p->fNext) {
       envir() << "\t" << p->codecName();
-      if (p->fNext == fSetupQueueHead || p->fNext == p) { fprintf(stderr, "##### INTERNAL ERROR 1\n"); break; } //##### TEMP FOR DEBUGGING
+      if (p->fNext == fSetupQueueHead) { fprintf(stderr, "##### INTERNAL ERROR 1.1\n"); break; } //##### TEMP FOR DEBUGGING
+      else if (p->fNext == p) { fprintf(stderr, "##### INTERNAL ERROR 1.2\n"); break; } //##### TEMP FOR DEBUGGING
     }
     envir() << "\n";
   }
@@ -479,7 +481,7 @@ ProxyServerMediaSubsession
 }
 
 UsageEnvironment& operator<<(UsageEnvironment& env, const ProxyServerMediaSubsession& psmss) { // used for debugging
-  return env << "ProxyServerMediaSubsession[\"" << psmss.codecName() << "\"]";
+  return env << "ProxyServerMediaSubsession[" << psmss.url() << "," << psmss.codecName() << "]";
 }
 
 ProxyServerMediaSubsession::~ProxyServerMediaSubsession() {
@@ -565,11 +567,17 @@ FramedSource* ProxyServerMediaSubsession::createNewStreamSource(unsigned clientS
       if (queueWasEmpty) {
 	if (proxyRTSPClient->fSetupQueueTail != NULL) fprintf(stderr, "##### INTERNAL ERROR 3\n");
 	proxyRTSPClient->fSetupQueueHead = this;
+	proxyRTSPClient->fSetupQueueTail = this;
       } else {
-	if (proxyRTSPClient->fSetupQueueTail == NULL) fprintf(stderr, "##### INTERNAL ERROR 4\n"); else //##### TEMP FOR DEBUGGING
-	proxyRTSPClient->fSetupQueueTail->fNext = this;
+	if (proxyRTSPClient->fSetupQueueTail == NULL) fprintf(stderr, "##### INTERNAL ERROR 4\n"); else { //##### TEMP FOR DEBUGGING
+	  Boolean err5 = False; //##### TEMP FOR DEBUGGING
+	  for (ProxyServerMediaSubsession* psms = proxyRTSPClient->fSetupQueueHead; psms != NULL; psms = psms->fNext) { if (psms == this) { err5 = True; break; } } //##### TEMP FOR DEBUGGING
+	  if (err5) fprintf(stderr, "##### INTERNAL ERROR 5\n"); else { //##### TEMP FOR DEBUGGING
+	    proxyRTSPClient->fSetupQueueTail->fNext = this;
+	    proxyRTSPClient->fSetupQueueTail = this;
+	  } //##### TEMP FOR DEBUGGING
+	} //##### TEMP FOR DEBUGGING
       }
-      proxyRTSPClient->fSetupQueueTail = this;
 
       // Hack: If there's already a pending "SETUP" request (for another track), don't send this track's "SETUP" right away, because
       // the server might not properly handle 'pipelined' requests.  Instead, wait until after previous "SETUP" responses come back.
@@ -608,8 +616,16 @@ void ProxyServerMediaSubsession::closeStreamSource(FramedSource* inputSource) {
     ProxyServerMediaSession* const sms = (ProxyServerMediaSession*)fParentSession;
     ProxyRTSPClient* const proxyRTSPClient = sms->fProxyRTSPClient;
     if (proxyRTSPClient->fLastCommandWasPLAY) { // so that we send only one "PAUSE"; not one for each subsession
-      proxyRTSPClient->sendPauseCommand(fClientMediaSubsession.parentSession(), NULL, proxyRTSPClient->auth());
-      proxyRTSPClient->fLastCommandWasPLAY = False;
+      if (fParentSession->referenceCount() > 1) {
+	// There are other client(s) still streaming other subsessions of this stream.
+	// Therefore, we don't send a "PAUSE" for the whole stream, but only for the sub-stream:
+	proxyRTSPClient->sendPauseCommand(fClientMediaSubsession, NULL, proxyRTSPClient->auth());
+      } else {
+	// Normal case: There are no other client still streaming (parts of) this stream.
+	// Send a "PAUSE" for the whole stream.
+	proxyRTSPClient->sendPauseCommand(fClientMediaSubsession.parentSession(), NULL, proxyRTSPClient->auth());
+	proxyRTSPClient->fLastCommandWasPLAY = False;
+      }
     }
   }
 }
diff --git a/liveMedia/RTCP.cpp b/liveMedia/RTCP.cpp
index 6dc0941..28b3ffc 100644
--- a/liveMedia/RTCP.cpp
+++ b/liveMedia/RTCP.cpp
@@ -39,11 +39,11 @@ public:
 	delete fTable;
   }
 
-  Boolean isMember(unsigned ssrc) const {
+  Boolean isMember(u_int32_t ssrc) const {
     return fTable->Lookup((char*)(long)ssrc) != NULL;
   }
 
-  Boolean noteMembership(unsigned ssrc, unsigned curTimeCount) {
+  Boolean noteMembership(u_int32_t ssrc, unsigned curTimeCount) {
     Boolean isNew = !isMember(ssrc);
 
     if (isNew) {
@@ -56,7 +56,7 @@ public:
     return isNew;
   }
 
-  Boolean remove(unsigned ssrc) {
+  Boolean remove(u_int32_t ssrc) {
     Boolean wasPresent = fTable->Remove((char*)(long)ssrc);
     if (wasPresent) {
       --fNumMembers;
@@ -835,8 +835,7 @@ void RTCPInstance
   } while (0);
 }
 
-void RTCPInstance::onReceive(int typeOfPacket, int totPacketSize,
-			     unsigned ssrc) {
+void RTCPInstance::onReceive(int typeOfPacket, int totPacketSize, u_int32_t ssrc) {
   fTypeOfPacket = typeOfPacket;
   fLastReceivedSize = totPacketSize;
   fLastReceivedSSRC = ssrc;
@@ -990,7 +989,7 @@ void RTCPInstance::addRR() {
 }
 
 void RTCPInstance::enqueueCommonReportPrefix(unsigned char packetType,
-					     unsigned SSRC,
+					     u_int32_t SSRC,
 					     unsigned numExtraWords) {
   unsigned numReportingSources;
   if (fSource == NULL) {
diff --git a/liveMedia/include/liveMedia_version.hh b/liveMedia/include/liveMedia_version.hh
index 2876ed1..ffd5791 100644
--- a/liveMedia/include/liveMedia_version.hh
+++ b/liveMedia/include/liveMedia_version.hh
@@ -4,7 +4,7 @@
 #ifndef _LIVEMEDIA_VERSION_HH
 #define _LIVEMEDIA_VERSION_HH
 
-#define LIVEMEDIA_LIBRARY_VERSION_STRING	"2016.02.22"
-#define LIVEMEDIA_LIBRARY_VERSION_INT		1456099200
+#define LIVEMEDIA_LIBRARY_VERSION_STRING	"2016.03.16"
+#define LIVEMEDIA_LIBRARY_VERSION_INT		1458086400
 
 #endif
diff --git a/proxyServer/live555ProxyServer.cpp b/proxyServer/live555ProxyServer.cpp
index 3d02d9a..9764a58 100644
--- a/proxyServer/live555ProxyServer.cpp
+++ b/proxyServer/live555ProxyServer.cpp
@@ -29,6 +29,7 @@ UserAuthenticationDatabase* authDBForREGISTER = NULL;
 int verbosityLevel = 0;
 Boolean streamRTPOverTCP = False;
 portNumBits tunnelOverHTTPPortNum = 0;
+portNumBits rtspServerPortNum = 554;
 char* username = NULL;
 char* password = NULL;
 Boolean proxyREGISTERRequests = False;
@@ -47,6 +48,7 @@ void usage() {
   *env << "Usage: " << progName
        << " [-v|-V]"
        << " [-t|-T <http-port>]"
+       << " [-p <rtspServer-port>]"
        << " [-u <username> <password>]"
        << " [-R] [-U <username-for-REGISTER> <password-for-REGISTER>]"
        << " <rtsp-url-1> ... <rtsp-url-n>\n";
@@ -64,7 +66,8 @@ int main(int argc, char** argv) {
 
   *env << "LIVE555 Proxy Server\n"
        << "\t(LIVE555 Streaming Media library version "
-       << LIVEMEDIA_LIBRARY_VERSION_STRING << ")\n\n";
+       << LIVEMEDIA_LIBRARY_VERSION_STRING
+       << "; licensed under the GNU LGPL)\n\n";
 
   // Check command-line arguments: optional parameters, then one or more rtsp:// URLs (of streams to be proxied):
   progName = argv[0];
@@ -108,6 +111,22 @@ int main(int argc, char** argv) {
       break;
     }
 
+    case 'p': {
+      // specify a rtsp server port number 
+      if (argc > 3 && argv[2][0] != '-') {
+        // The next argument is the rtsp server port number:
+        if (sscanf(argv[2], "%hu", &rtspServerPortNum) == 1
+            && rtspServerPortNum > 0) {
+          ++argv; --argc;
+          break;
+        }
+      }
+
+      // If we get here, the option was specified incorrectly:
+      usage();
+      break;
+    }
+    
     case 'u': { // specify a username and password (to be used if the 'back end' (i.e., proxied) stream requires authentication)
       if (argc < 4) usage(); // there's no argv[3] (for the "password")
       username = argv[2];
@@ -167,12 +186,21 @@ int main(int argc, char** argv) {
       // Repeat this line with each <username>, <password> that you wish to allow access to the server.
 #endif
 
-  // Create the RTSP server.  Try first with the default port number (554),
+  // Create the RTSP server. Try first with the configured port number,
+  // and then with the default port number (554) if different,
   // and then with the alternative port number (8554):
   RTSPServer* rtspServer;
-  portNumBits rtspServerPortNum = 554;
   rtspServer = createRTSPServer(rtspServerPortNum);
   if (rtspServer == NULL) {
+    if (rtspServerPortNum != 554) {
+      *env << "Unable to create a RTSP server with port number " << rtspServerPortNum << ": " << env->getResultMsg() << "\n";
+      *env << "Trying instead with the standard port numbers (554 and 8554)...\n";
+
+      rtspServerPortNum = 554;
+      rtspServer = createRTSPServer(rtspServerPortNum);
+    }
+  }
+  if (rtspServer == NULL) {
     rtspServerPortNum = 8554;
     rtspServer = createRTSPServer(rtspServerPortNum);
   }
diff --git a/testProgs/#testMPEG2TransportStreamer.cpp# b/testProgs/#testMPEG2TransportStreamer.cpp#
deleted file mode 100644
index e78474a..0000000
--- a/testProgs/#testMPEG2TransportStreamer.cpp#
+++ /dev/null
@@ -1,158 +0,0 @@
-1;95;0c/**********
-This library is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published by the
-Free Software Foundation; either version 2.1 of the License, or (at your
-option) any later version. (See <http://www.gnu.org/copyleft/lesser.html>.)
-
-This library is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
-more details.
-
-You should have received a copy of the GNU Lesser General Public License
-along with this library; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
-**********/
-// Copyright (c) 1996-2016, Live Networks, Inc.  All rights reserved
-// A test program that reads a MPEG-2 Transport Stream file,
-// and streams it using RTP
-// main program
-
-#include "liveMedia.hh"
-#include "BasicUsageEnvironment.hh"
-#include "GroupsockHelper.hh"
-
-// To stream using "source-specific multicast" (SSM), uncomment the following:
-//#define USE_SSM 1
-#ifdef USE_SSM
-Boolean const isSSM = True;
-#else
-Boolean const isSSM = False;
-#endif
-
-// To set up an internal RTSP server, uncomment the following:
-//#define IMPLEMENT_RTSP_SERVER 1
-// (Note that this RTSP server works for multicast only)
-
-#define TRANSPORT_PACKET_SIZE 188
-#define TRANSPORT_PACKETS_PER_NETWORK_PACKET 7
-// The product of these two numbers must be enough to fit within a network packet
-
-UsageEnvironment* env;
-char const* inputFileName = "test.ts";
-FramedSource* videoSource;
-RTPSink* videoSink;
-
-void play(); // forward
-
-int main(int argc, char** argv) {
-  // Begin by setting up our usage environment:
-  TaskScheduler* scheduler = BasicTaskScheduler::createNew();
-  env = BasicUsageEnvironment::createNew(*scheduler);
-
-  // Create 'groupsocks' for RTP and RTCP:
-  char const* destinationAddressStr
-#ifdef USE_SSM
-    = "232.255.42.42";
-#else
-  = "239.255.42.42";
-  // Note: This is a multicast address.  If you wish to stream using
-  // unicast instead, then replace this string with the unicast address
-  // of the (single) destination.  (You may also need to make a similar
-  // change to the receiver program.)
-#endif
-  const unsigned short rtpPortNum = 1234;
-  const unsigned short rtcpPortNum = rtpPortNum+1;
-  const unsigned char ttl = 7; // low, in case routers don't admin scope
-
-  struct in_addr destinationAddress;
-  destinationAddress.s_addr = our_inet_addr(destinationAddressStr);
-  const Port rtpPort(rtpPortNum);
-  const Port rtcpPort(rtcpPortNum);
-
-  Groupsock rtpGroupsock(*env, destinationAddress, rtpPort, ttl);
-  Groupsock rtcpGroupsock(*env, destinationAddress, rtcpPort, ttl);
-#ifdef USE_SSM
-  rtpGroupsock.multicastSendOnly();
-  rtcpGroupsock.multicastSendOnly();
-#endif
-
-  // Create an appropriate 'RTP sink' from the RTP 'groupsock':
-  videoSink =
-    SimpleRTPSink::createNew(*env, &rtpGroupsock, 33, 90000, "video", "MP2T",
-			     1, True, False /*no 'M' bit*/);
-
-  // Create (and start) a 'RTCP instance' for this RTP sink:
-  const unsigned estimatedSessionBandwidth = 5000; // in kbps; for RTCP b/w share
-  const unsigned maxCNAMElen = 100;
-  unsigned char CNAME[maxCNAMElen+1];
-  gethostname((char*)CNAME, maxCNAMElen);
-  CNAME[maxCNAMElen] = '\0'; // just in case
-#ifdef IMPLEMENT_RTSP_SERVER
-  RTCPInstance* rtcp =
-#endif
-    RTCPInstance::createNew(*env, &rtcpGroupsock,
-			    estimatedSessionBandwidth, CNAME,
-			    videoSink, NULL /* we're a server */, isSSM);
-  // Note: This starts RTCP running automatically
-
-#ifdef IMPLEMENT_RTSP_SERVER
-  RTSPServer* rtspServer = RTSPServer::createNew(*env);
-  // Note that this (attempts to) start a server on the default RTSP server
-  // port: 554.  To use a different port number, add it as an extra
-  // (optional) parameter to the "RTSPServer::createNew()" call above.
-  if (rtspServer == NULL) {
-    *env << "Failed to create RTSP server: " << env->getResultMsg() << "\n";
-    exit(1);
-  }
-  ServerMediaSession* sms
-    = ServerMediaSession::createNew(*env, "testStream", inputFileName,
-		   "Session streamed by \"testMPEG2TransportStreamer\"",
-					   isSSM);
-  sms->addSubsession(PassiveServerMediaSubsession::createNew(*videoSink, rtcp));
-  rtspServer->addServerMediaSession(sms);
-
-  char* url = rtspServer->rtspURL(sms);
-  *env << "Play this stream using the URL \"" << url << "\"\n";
-  delete[] url;
-#endif
-
-  // Finally, start the streaming:
-  *env << "Beginning streaming...\n";
-  play();
-
-  env->taskScheduler().doEventLoop(); // does not return
-
-  return 0; // only to prevent compiler warning
-}
-
-void afterPlaying(void* /*clientData*/) {
-  *env << "...done reading from file\n";
-
-  videoSink->stopPlaying();
-  Medium::close(videoSource);
-  // Note that this also closes the input file that this source read from.
-
-  play();
-}
-
-void play() {
-  unsigned const inputDataChunkSize
-    = TRANSPORT_PACKETS_PER_NETWORK_PACKET*TRANSPORT_PACKET_SIZE;
-
-  // Open the input file as a 'byte-stream file source':
-  ByteStreamFileSource* fileSource
-    = ByteStreamFileSource::createNew(*env, inputFileName, inputDataChunkSize);
-  if (fileSource == NULL) {
-    *env << "Unable to open file \"" << inputFileName
-	 << "\" as a byte-stream file source\n";
-    exit(1);
-  }
-
-  // Create a 'framer' for the input source (to give us proper inter-packet gaps):
-  videoSource = MPEG2TransportStreamFramer::createNew(*env, fileSource);
-
-  // Finally, start playing:
-  *env << "Beginning to read from file...\n";
-  videoSink->startPlaying(*videoSource, afterPlaying, videoSink);
-}

-- 
liblivemedia packaging



More information about the pkg-multimedia-commits mailing list