[Live-devel] SubClassing "OnDemandServerMediaSubsession"

Gaurav Badhan gauravb at interfaceinfosoft.com
Wed Feb 13 07:40:24 PST 2013


Hello Ross,

Thanks for the guidance.
I was able to stream the live source the only issue that i have is i am
creating rtsp server on start and then when
some predefined command comes like stream i am adding the the session.
but when stop message comes i am breaking the do event loop and and calling
doing like this:-

First of all i have taken TaskScheduler* scheduler;RTSPServer*
rtspServer;ServerMediaSession* sms; objects as global

int StartRTSPServer()
{
scheduler = BasicTaskScheduler::createNew();

env = BasicUsageEnvironment::createNew(*scheduler);

UserAuthenticationDatabase* authDB = NULL;
portNumBits rtspServerPortNum = 554;
unsigned reclamationTestSeconds=65U;

rtspServer = RTSPServer::createNew(*env,rtspServerPortNum, authDB,
reclamationTestSeconds); //creating rtsp server
if (rtspServer == NULL)
{
 *env << "Failed to create RTSP server: " <<env->getResultMsg()<<"\n";
//If rtsp server creation fails on 554 it will be created on 8554
rtspServerPortNum = 8554;
rtspServer = RTSPServer::createNew(*env,rtspServerPortNum);
flag=false;
if (rtspServer == NULL)
{
 return 0;
}
else
{pDailyLogger->LogInfoString("Created RTSP server.. on port 8554");
*env << "Created RTSP server.."<<"\n.";
}
}
else
{
 *env << "Created RTSP server.."<<"\n.";
}
}

//The following code executes on start message


int InitLive555()
{
g_ExitEventLoop = 0;
Boolean const inputStreamIsRawUDP = False;

char const* descriptionString={"Session streamed by \"testOnDemandRT\""};
sms = ServerMediaSession::createNew(*env, streamName,
streamName,descriptionString);

MyOnDemandServerMediaSubsession *session = new
MyOnDemandServerMediaSubsession(*env, false,sport);

 //created my subseeion
 sms->addSubsession(session);

 rtspServer->addServerMediaSession(sms);
char* url = rtspServer->rtspURL(sms);

*env << "Play this stream using the URL \"" << url << "\"\n";
delete[] url;
env->taskScheduler().doEventLoop(&g_ExitEventLoop);

//try catch execute when stop message come and my code break here
try
{
if(sms)
{
Medium::close(sms);
}

rtspServer->deleteServerMediaSession(sms);
}
catch(...)
{
if(sms)
{
Medium::close(sms);
}
rtspServer->deleteServerMediaSession(sms);
}

Can you please guide why my code is breaking.

On Wed, Feb 13, 2013 at 12:07 AM, Ross Finlayson <finlayson at live555.com>wrote:

>
> On Feb 13, 2013, at 5:05 AM, Robert Clove <cloverobert at gmail.com> wrote:
>
> Really nice ques fox.Hey Ross i have implemented
>
>    - createNewStreamSource()
>    - createNewRTPSink()
>
> Those are the ONLY functions that you need to implement.  All of the other
> functions you mentioned are already implemented by the
> "OnDemandServerMediaSubsession" class.  YOU DO NOT NEED TO CONCERN YOURSELF
> WITH THAT CODE!
>
>
> Ross Finlayson
> Live Networks, Inc.
> http://www.live555.com/
>
>
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20130213/45a75612/attachment.html>


More information about the live-devel mailing list