Discussion:
Endless h264 streaming
Philippe Spat
2014-10-10 14:17:46 UTC
Permalink
Hi,

I am using live555 dynamic server to stream endlessly on rtp/rtsp port. My
idea was to create my own classes which work exactly the same as the
testProgs, but with instances of my created objects (rtsp server, sms,
...). It works wonderful just not for h264 elementaries.

For h264: When I reboot (or boot) my pc and start my server, connect to it
using VLC or MPlayer, it works perfeclty. But when I stop it and restart
it, connect to it using VLC or MPlayer again, at the first loop I get
"non-existing PPS referenced" errors (no video displayed) but it starts
streaming perfectly (and endless) at the 2nd loop again. In other words, i
have to reboot after each launch of the server to see my h264 streaming
working fine...

Note that this is a test application, I do not care if client gets
disconnected, the server still streams endlessly till I stop it.

Any idea without any source code? I was thinking about SPS and PPS units
problems, but in this case I don't understand why it works one time and not
many.

Regards,
Philippe
Ross Finlayson
2014-10-11 14:48:21 UTC
Permalink
For h264: When I reboot (or boot) my pc and start my server, connect to it using VLC or MPlayer, it works perfeclty. But when I stop it and restart it, connect to it using VLC or MPlayer again, at the first loop I get "non-existing PPS referenced" errors (no video displayed) but it starts streaming perfectly (and endless) at the 2nd loop again. In other words, i have to reboot after each launch of the server to see my h264 streaming working fine...
The problem here, I think, is that - in your H.264 video stream - SPS and PPS NAL units are occurring only at the start of the stream. Therefore, if a client tries to connect to the stream in some position other than the start, the server is having trouble finding the SPS and PPS NAL units.

First, you should make sure that when your "OnDemandServerMediaSubsession" subclass's constructor calls the "OnDemandServerMediaSubsession" constructor, it sets the "reuseFirstSource" parameter to True. That way, if more than one client connects concurrently, the server won't try to read the stream again for the second (and other) clients.

Second, in your implementation of the "createNewRTPSink()" virtual function, you may need to use one of the versions of "H264VideoRTPSink::createNew()" that specify the SPS and PPS NAL units.

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

Loading...