[Live-devel] testOnDemandRTSPServer multicast question

Tim J Shackleton live555 at timshackleton.com
Sun Dec 16 16:24:43 PST 2012


On 17/12/12 12:18, Ross Finlayson wrote:
> Since the "testOnDemandRTSPServer" demonstrates how to stream from 
> *files* to (unicast) clients, it does not 'demonstrate' multicast to 
> unicast RTSP relaying at all.  Therefore, you must have modified the 
> supplied application's code in some (unspecified) way.  So I don't 
> really see how I can help you.
>

I have copied testOnDemandRTSPServer.cpp to another file and modified it 
- the modification is simply the removal of all available streams with 
the exception of the following block:

   // A MPEG-2 Transport Stream, coming from a live UDP (raw-UDP or 
RTP/UDP) source:
   {
     char const* streamName = "mpeg2TransportStreamFromUDPSourceTest";
     char const* inputAddressStr = "239.255.42.42";
         // This causes the server to take its input from the stream 
sent by the "testMPEG2TransportStreamer" demo application.
         // (Note: If the input UDP source is unicast rather than 
multicast, then change this to NULL.)
     portNumBits const inputPortNum = 1234;
         // This causes the server to take its input from the stream 
sent by the "testMPEG2TransportStreamer" demo application.
     Boolean const inputStreamIsRawUDP = False;
     ServerMediaSession* sms
       = ServerMediaSession::createNew(*env, streamName, streamName,
                                       descriptionString);
     sms->addSubsession(MPEG2TransportUDPServerMediaSubsession
                        ::createNew(*env, inputAddressStr, inputPortNum, 
inputStreamIsRawUDP));
     rtspServer->addServerMediaSession(sms);

     char* url = rtspServer->rtspURL(sms);
     *env << "\n\"" << streamName << "\" stream, from a UDP Transport 
Stream input source \n\t(";
     if (inputAddressStr != NULL) {
       *env << "IP multicast address " << inputAddressStr << ",";
     } else {
       *env << "unicast;";
     }
     *env << " port " << inputPortNum << ")\n";
     *env << "Play this stream using the URL \"" << url << "\"\n";
     delete[] url;
   }

>
> Once again, you haven't said how you have modified the supplied code, 
> but it sounds like you added a new "OnDemandServerMediaSubsession" 
> subclass that (1) correctly sets "reuseFirstSource" to True, and (2) 
> redefines the "createNewStreamSource()" virtual function to create a 
> new input source object (of some unspecified type...).
>

Correct, I have specified reuseFirstSource as true.  As above, I have 
used the code block from the supplied test program, with the multicast 
group and port modified to suit local conditions.

> If you do this, then, yes, the input source object will get closed 
> (and its destructor called) whenever the last RTSP client leaves. 
>  This is the proper behavior, because we want the input source to be 
> closed when noone is requesting its data.  (Similarly, when another 
> client arrives later, "createNewStreamSource()" will get called again, 
> and a new input source object will get created.)
>

Now, if that was the behaviour I am observing, then I would be quite 
happy with that!  However, when another client arrives later, the 
multicast stream source does not appear to become active again.  I can 
confirm however that createNewStreamSource from 
MPEG2TransportUDPServerMediaSubsession.cpp is being called as you say it 
should be when the client arrives.

I am confident the source is still present on the network, as the source 
is directly connected to an ethernet port on the testing machine.  I can 
see no reason why the library shouldn't be able to resubscribe to this 
source, either.

Thanks and regards,

-Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20121217/7992035a/attachment.html>


More information about the live-devel mailing list