[Live-devel] H264or5VideoStreamParser::parse() from a FramedSource

Ross Finlayson finlayson at live555.com
Fri Oct 24 10:36:24 PDT 2014


> After creating my own class's
> ·         class myRTSPSinkOndemandMediaSubsession : public OnDemandServerMediaSubsession
> ·         class myFrameSource : public FramedSource

If your “myFrameSource” class delivers discrete H.264 NAL units (i.e., one at a time), rather than an unstructured byte stream, then you MUST feed this into a “H264VideoStreamDiscreteFramer”, NOT a “H264VideoStreamFramer”.

In particular, your “myRTSPSinkOndemandMediaSubsession” class’s implementation of the "createNewStreamSource()” virtual function should look something like this: 

//////////
FramedSource* myRTSPSinkOndemandMediaSubsession::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate) {
  estBitrate = 500; // in kbps; set this to an appropriate estimate of your stream’s bitrate

  // Create the video source:
  FramedSource* videoSource = myFrameSource::createNew(envir(), params);

  // Create a framer for the video stream:
  return H264VideoStreamDiscreteFramer::createNew(envir(), videoSource);
}
//////////

Note also that - because you’re feeding into a “H264VideoStreamDiscreteFramer” - each H.264 NAL unit delivered by your “myFrameSource” object MUST NOT begin with a ‘start code’ (0x00 0x00 0x00 0x01).

Also, if your encoder doesn’t automatically do so, then you should arrange for the first two NAL units delivered by your “myFrameSource” object to be a SPS and a PPS NAL unit.  (Alternatively, in your implementation of the “createNewRTPSink()” virtual function, you can use one of the forms of “H264VideoRTPSink::createNew()” that takes SPS and PPS NAL unit information as parameters.)


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/20141024/61918d79/attachment.html>


More information about the live-devel mailing list