[Live-devel] I can not stream live video with my own framedSource
Ross Finlayson
finlayson at live555.com
Tue Dec 4 07:09:15 PST 2012
There is so much wrong here that I barely know where to begin. But the big mistake in your code is that you are trying to create 'source' and 'sink' objects and start streaming from them yourself, in your own code. This is completely wrong. Our RTSP server implementation (specifically, our "OnDemandServerMediaSubsession" class, which you are subclassing) does all of this for you (when clients ask to play a stream). All you need to do is define and implement your own subclass of "OnDemandServerMediaSubsession" (by implementing the "createNewStreamSource()" and "createNewRTPSink()" virtual functions.
For illustration, I suggest that you look at the code in "liveMedia/AMRAudioFileServerMediaSubsession.cpp". Your "OnDemandServerMediaSubsessionMarina" class should be just about as simple as this.
In particular:
1/ The body of your "OnDemandServerMediaSubsessionMarina" constructor should probably be completely empty. In particular, you should *not* be creating any source or sink (or groupsock) objects here. (Also, because you will be streaming from a live input source, the "reuseFirstSource" parameter that you pass to the base class ("OnDemandServerMediaSubsession") constructor should be True.
2/ Your "createNewStreamSource()" implementation should create a new "FramedSourceMarina" object, as you do now, but it should then feed it into a new "MPEG4VideoStreamDiscreteFramer" object (note, *not* a "MPEG4VideoStreamFramer"), and you should return that object as the result of the function. (If, instead, you want to stream H.264, then you would create a "H264VideoStreamDiscreteFramer" instead.) You should also set the "estBitrate" result parameter (the stream's estimated bit rate in kbps).
3/ Most of your code in "RTPService::RTPService()" and "RTPService::StartStreaming()" is wrong. In particular, you should not be creating *any* source, sink, or groupsock objects here. And you should not be calling "startPlaying()" (or "stopPlaying()) *anywhere* in your code. (Again, our RTSP server implementation does this for you.) The only things that you should be doing here are (in order):
- create a "TaskScheduler" and "UsageEnvironment".
- create a "RTSPServer".
- create a "ServerMediaSession" object.
- create a "OnDemandServerMediaSubsessionMarina" object, and add this to the "ServerMediaSession" object.
- add the "ServerMediaSession" object to the "RTSPServer". (Note: *Do not* create or use a "PassiveServerMediaSubsession" object at all; that's used only for multicast streaming, which you're not doing here.)
- call "doEventLoop()", to enter the LIVE555 event loop.
For illustration, I suggest that you look at the code for the "testOnDemandRTSPServer" demo application (see "testProgs/testOnDemandRTSPServer.cpp"), and understand how that works.
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20121204/d8bc129f/attachment-0001.html>
More information about the live-devel
mailing list