[Live-devel] Suggestions for RTSPClient [ testRTSPClient example]

Novalis Vapuru 6.45.vapuru at gmail.com
Sat Jan 21 01:37:36 PST 2012


As a user of your library, i have some problems with your RTSPClient
while integrating it to my app.
So i decide to write my "pains" and my "ideal" client example for testRTSPClient

-- What i need to create client? Do i have to know "env" or "task scheduler?


string rtspUrl = "rtsp://..../video.h264"
string userName = "user";
string password = "password"


// This factory automatically create single enviroment object
// pass this reference to newly created client and
 // start env->taskScheduler().doEventLoop(&watchVariable) in a new thread
 // so that it will not block anything

OurRTSPClient* ourClient =
ClientFactory::GiveMeNewClient(rtspUrl,userName, password);

If i need  "env" then i can get if from our client or ClientFactory...

-- Do i need the details of Rtsp  Protocole?

ourClient->Start(); // send "describe" request and if sucess then continue
ourClient->Stop(); // just send teardown and close all sockets for that client

-- Do i need to worry about "dirty details" of deleting/closing resources?

// Just delete object
// Anyway we are using C++
delete ourClient();

-- At the end, i want to close everthing

// stop do event loop
// delete env and scheduler
ClientFactory::CloseEnv();

-- What about if something goes wrong?
Why not to use Exceptions ?

try
{

    OurRTSPClient* ourClient =
ClientFactory::GiveMeNewClient(rtspUrl,userName, password);

    ourClient->Start(); // send "describe" request and if sucess then continue

     Sleep(30);

     ourClient->Stop(); // just send teardown and close all sockets
for that client

     delete ourClient;
     ourClient = NULL;

     ClientFactory::CloseEnv();
	
}

cath(const Live555CannotGetSDPDescription& e)
{
	
	// may be i create new client and try to re-connect
}

catch(const Live555ServerConnectionGone& e)
{
    //....
}

catch(const Live555CanNotCloseEnvriment& e)

{
	//....

}



Best Wishes


More information about the live-devel mailing list