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

Richard Lince Richard.Lince at datapath.co.uk
Tue Oct 28 10:35:06 PDT 2014


Thanks Ross, that has worked well.
Richard.

From: live-devel [mailto:live-devel-bounces at ns.live555.com] On Behalf Of Ross Finlayson
Sent: 24 October 2014 18:36
To: LIVE555 Streaming Media - development & use
Subject: Re: [Live-devel] H264or5VideoStreamParser::parse() from a FramedSource

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/


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20141028/7f5835f8/attachment.html>


More information about the live-devel mailing list