[Live-devel] H.264 PPS/SPS for the second client
Ross Finlayson
finlayson at live555.com
Mon May 17 14:50:35 PDT 2021
>>>>> Is it absolutely impossible to
>>>>> discard all NALs for the given RTP stream on the server side until
>>>>> SPS/PPS arrive?
>>>>
>>>> If your server is using our “H264VideoFileServerMediaSubsession” class, then it’s already doing this. However, the problem is that - for many H.264 video sources - the PPS and SPS NAL units appear only at the very start of the stream, and never thereafter. That’s why - if you set “reuseFirstSource” to True - the second and subsequent receivers will not get the SPS/PPS NAL units in the media stream. But, as I’ve already noted, this is not something that receivers should be relying on anyway.
>>>
>>> No, it's based on H264LiveServerMediaSubsession
>>
>> I don’t know what “H264LiveServerMediaSubsession” is. We have no class with that name,.
>
> Sorry, copy/paste error. Actually H264LiveServerMediaSubsession is my
> subclass of OnDemandServerMediaSubsession with createNewRTPSink()
> creating H264VideoRTPSink instance.
If you know - in advance - the H.264 PPS and SPS NAL units, then your “createNewRTPSink()” implementation should pass them as parameters to the call to “H264VideoRTPSink::createNew()”. If you do this, then the proper "a=fmtp:” line containing "sprop-parameter-sets” will automatically appear in your SDP description.
If, however, you don’t know the H.264 PPS and SPS NAL units in advance, but you do know that they will appear at or near the start of the encoded video source, then you will also need to reimplement the “getAuxSDPLine()” virtual function, as we do in our implementation of “H264VideoFileServerMediaSubsession”. However, the simplest way for you to do this will be to make your “H264LiveServerMediaSubsession” class a subclass of “H264VideoFileServerMediaSubsession”, rather than “OnDemandServerMediaSubsession”. If you do this, then you won’t need to reimplement “createNewRTPSink()” or “getAuxSDPLine()”; but you will need to reimplement “createNewStreamSource()”.
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
More information about the live-devel
mailing list