[Live-devel] Modifying LiveMedia RTSPServer classes to support URI parameters

Matt Schuckmannn matt at schuckmannacres.com
Tue Jun 14 13:42:44 PDT 2011


>
> For example (to use your example string), 
> "live_video?height=320&width=400&kbps=300&fps=15" would use a 
> completely separate "ServerMediaSubsession" (subclass) object than 
> "live_video?height=320&width=400&kbps=300&fps=30".
>
This seems infeasible as I want to be able support any number of 
combination of all 4 of these parameters (plus more parameters like GoP 
size etc). Seems much more reasonable to have one subclass of 
ServerMediaSession and ServerMediaSubsession that can read and interpret 
the parameters on a per connection basis.

> You can probably do this by subclassing "RTSPServer" and redefining 
> the virtual function "lookupServerMediaSession()" in your subclass. 
> Plus, of course, you'll need your own subclass of 
> "OnDemandServerMediaSubsession" (it'll be similar to 
> "H264VideoFileServerMediaSubsession" if you're streaming H.264), but 
> you're presumably already doing that.
>
> Once again, when you think of extending the supplied code, you should 
> be thinking first about subclassing, and modify the supplied code only 
> as a last resort (if at all).
>
Oh I definitely first turned to sub classing, I don't want to modify the 
library code if I don't have to, and it's probably possible, but as they 
say the proof is in the pudding and it's easy to say just subclass it 
until you actually dig in and try and you find the little things that 
are less than ideal.

I've already got a sub class of RTSPServer, RTSPClientSession, 
OnDemandServerMediaSubSession and ServerMediaSession. I think I can see 
at least most of the way there with out modifying the library, but I'll 
have to do some copy, paste, modify of some the library methods into my 
own to get there and I always hate doing that if I don't have to.

I've done my own version of lookupServerMediaSession() to do the look up 
based on the the media name and not the whole urlSuffix (as it's called 
in the code).

I then turned how to pass the parameters to the 
ServerMediaSession::generateSDPDescription(), which is not virtual nor 
takes any parameters, so I'd probably have to create a new 
ServerMediaSessioN::generateSDPDescription that takes the parameters 
part of the URI and then re-implements much of what is in your 
ServerMediaSession::generateSDPDescription()  but simply passes the 
parameter string on to the subsessions sdpLines methods.
Then I'll need to over load the 
OnDemandServerMediaSubsession::sdpLines() method which is virtual but 
again I'll have to copy much of what is already there and I'll need a 
way to pass the parameters to sdpLines() so the fact that's it's virtual 
really doesn't matter. Of course the member variable fSDPLines which is 
used by sdpLines() is private so not available to a subclass but that's 
probably OK in this case, I just wont use it. I'm sure the problem goes 
a bit deeper in the class hierarchy and it's manageable in one form or 
another. I didn't say  I couldn't see how to do it, rather I was asking 
if anybody else had successfully done it and perhaps what there 
methodology was.



More information about the live-devel mailing list