[Live-devel] Having trouble implementing a live unicast stream

Ross Finlayson finlayson at live555.com
Fri Apr 26 02:00:36 PDT 2013


> When I create a new ByteSteamFileSource/H264VideoStreamFramer inside the 'createNewStreamSource' method ala H264FileServerMediaSubsession it works as expected.

You should continue to do this.


> From this I take it that each call to 'createNewStreamSource' should return a pointer to a different object, but then I'm unsure how this works when there is only a single source, I thought that using reuseFirstSource = True would mean that I could use a single source object.

Not quite.  Setting "reuseFirstSource" to "True" means that only one source object exists - *at a time*.  However, the server code (when streaming H.264 video) initializes by creating a dummy source object, then destroys it, then creates another source object that it will use for subsequent streaming.  This source object may also get destroyed later, if all clients that are using it end up doing a RTSP "TEARDOWN" on the stream.  If that happens, the next client (if any) will end up causing a new source object to be created.  And so on...

So, in summary: You need to be prepared for "createNewStreamSource()" to be called multiple times, and for the resulting source object to be destroyed multiple times.  (However, because you've set "reuseFirstSource" to "True", you can expect no more than one such source object to be in existence at any one time.)

Also, because you're streaming H.264 video, you may wish (in your "createNewRTPSink()" virtual function implementation) to use one of the alternative forms of "H264VideoRTPSink::createNew()" that take the stream's SPS and PPS NAL units - if you know them - as parameter.  See "liveMedia/include/H264VideoRTPSink.hh".  If you instead use the regular "H264VideoRTPSink::createNew()" (that doesn't take these extra parameters), then your code will still work, but only if your H.264 encoder generates SPS and PPS NAL units 'in band', and these occur frequently.


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/20130426/3ff9978b/attachment.html>


More information about the live-devel mailing list