[Live-devel] Please help: I have difficulties implementing the right classes

Ross Finlayson finlayson at live555.com
Fri Sep 5 00:28:04 PDT 2014


>> Could it be that calling deliverFrame() multiple times might be wrong?
> 
> Yes, that's wrong.  Your "doGetNextFrame()" function should deliver one, and only one, H.264 NAL unit (note, not a H.264 'frame') each time it's called. 
> [Fabrice] All right, that's good to know. From time to time, the encoder sends an SPS and a PPS NALU before the data NALU (all in one "frame"). So when that's the case, I need to somehow have the doGetNextFrame() method being called a 2nd and a 3rd time... What's the best way to do this?

You're thinking about this the wrong way.  "doGetNextFrame()" gets called automatically (by the downstream, 'transmitting' object) whenever it needs a new NAL unit to transmit.  So you should just deliver the next NAL unit (just one!) whenever "doGetNextFrame()" is called.  If your encoder can generate more than one NAL unit at a time, then you'll need to enqueue them in some way.


> BTW, what would happen if the monitor thread signal the trigger twice because 2 frames arrived almost simultaneously (and doGetNextFrame() hadn't been called yet for the first frame)?

The triggered event might end up getting handled just once.  But that should be OK, as long as you are enqueuing incoming NAL units.  (The next time "doGetNextFrame()" gets called, it'll see whatever NAL unit(s) are left in the queue.)


> [Fabrice] I am using an MPEG4VideoStreamDiscreteFramer, as in wis-streamer. Is that wrong?

No, that's right.  Just make sure that the NAL units that you feed to it do *not* begin with a 0x00 0x00 0x00 0x01 start code.


> Finally, because you're delivering from a live source (rather than a prerecorded source like a file), you don't need to set "fDurationInMicroseconds".
> [Fabrice] Is is bad if I do?

No, as long as you're not setting it to a value that's larger than it should be.

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/20140905/85c578eb/attachment.html>


More information about the live-devel mailing list