[Live-devel] controlling the rtsp negotiation with custom event loop

Sampsa Riikonen sampsa.riikonen at iki.fi
Thu Dec 17 01:31:35 PST 2015


Dear List,

I have some absolute newbie questions.

I have an application that has its own event loop when 
manipulating/reading sockets, however, I'd like to use live555 to do the 
rtsp negotiation process with the cameras.
I also need my own step-to-step control over the rtsp negotiation 
process, i.e.

1) describe+setup => port numbers
(do something within my own event loop)
2) play
(do something within my own event loop)
3) teardown
(do something within my own event loop)

The best strategy I came up with, was to modify "testRTSPClient.cpp" and 
fiddle with the "eventLoopWatchVariable".

After breaking the event loop in "setupNextSubSession", I can access the 
results of the rtsp negotiation in "main", like this (I also modified to 
code in such a way that the rtspClient variable is passed as a pointer 
to "openURL"):

----------
StreamClientState& scs = ((ourRTSPClient*)rtspClient)->scs; // alias

*env << "has subsessions " << scs.session->hasSubsessions() << "\n";

scs.iter = new MediaSubsessionIterator(*scs.session);
scs.subsession = scs.iter->next();

*env << "client port 1 " << scs.subsession->clientPortNum() << "\n";

scs.subsession = scs.iter->next();

*env << "client port 2 " << scs.subsession->clientPortNum() << "\n";
----------

I find live555 a bit .. complicated, because it's mandatory to use 
live555's own, internal event loop (right?) that is buried quite deep in 
the code..!

So, questions:

1) I understand that in the rtsp "response handlers" and in the 
callbacks within them, we create the necessary logic, but how does the 
program actually run?  .. does the event loop explicitly execute the 
"response handlers"..? where in the code this takes place?

2) Is there any better stragey to achieve (1,2,3) than described here 
(breaking the event loop, etc.) ?

3) Is there any better way to access the subsession data, other than 
always creating a *new* MediaSubsessionIterator and then using the 
"next()" method ?  .. iterators should have also "begin()", 
"previous()", etc. methods, but these seem to me missing in the code..?  
i.e. one must create a new object and then, after using "next" couple of 
times, the object becomes useless and throwing segfaults if you try to 
access data, for example, clientPortNums.

Regards,

Sampsa



More information about the live-devel mailing list