[Live-devel] OnDemandServerMediaSubsession and FramedSource subclassing

Wiser, Tyson TWiser at logostech.net
Thu Dec 9 10:03:47 PST 2010


I am trying to use the live555 library in a project of mine, but I am running into some issues I haven't been able to figure out despite reading the FAQ and searching the mailing list archives.

Basically, I need a server that streams data on demand from a live source to a client.  The stream needs to be able to be sent using either unicast or multicast to an address and port combination dictated by the client in the SETUP message.  The format of the stream data is non-standard, but can be thought of as a binary blob for each frame.

Based on what I have gathered from looking at the FAQ, the source code, and the mailing list archives, I have subclassed FramedSource to be able to get data from my source.  Unfortunately, my source cannot be treated as a file, so I have used the watch variable method as suggested in the FAQ and the messages it references.

I then tried using PassiveServerMediaSubsession but realized that it only created multicast streams and the destination address and port needed to be set up before the client ever sent a SETUP message.  My next thought was OnDemandServerMediaSubsession.  With the exception of two things, it seems to do almost exactly what I need.

First, if I wanted to subclass OnDemandServerMediaSubsession to handle multicast as well as unicast, is it sufficient to change getStreamParameters() so that it doesn't automatically set isMulticast to False, but instead sets it based on the destination address?

Second, in using the watch variable method to indicate to my source when a new frame is available I have basically done the following:
    while(running) {
        env->taskScheduler().doEventLoop(&frameAvailable);
        if (frameAvailable != 0) {
            mySource->doGetNextFrame();
            frameAvailable = 0;
        }
    }
The problem, when using OnDemandServerMediaSubsession, is that I don't know how to get a reference to my source object.  That object, as the name of the class implies, is created on demand and I have not found any functions that return to me a FramedSource* or a RTPSink*.  I have made sure that I set reuseFirstSource to True when creating the OnDemandServerMediaSubsession subclass, which I understand to mean that there will only ever be one source.  Is there a way to get a reference to that source?

I appreciate your help and think that this is a great library.

Thanks,
Tyson Wiser
Logos Technologies, Inc.



More information about the live-devel mailing list