[Live-devel] streaming H.264 with changing resolution

Ross Finlayson finlayson at live555.com
Fri Dec 11 05:31:25 PST 2009


>I use Live555 to stream H.264 from the embedded borad and find a bug:
>
>for my borad, user could change video's resolution,  at beginning 
>user recive H.264 from the borad , it plays well, but if user 
>disconnect then reconnect with different resolution, client player 
>does not decode frames correctly because SPS and PPS are not the 
>same as previous caused by fSPLines is not NULL (see below code) and 
>media field of SDP doesn't be set again.

Unfortunately, for most servers, the current behavior - setting up 
"fSDPLines" only once, when the first client connects - will be the 
desired behavior, because (for most servers) the stream's SDP 
parameters will not change from client to client.  Also, in some 
cases, it might be costly to figure out the SDP parameters (e.g., it 
might involve doing some reading/parsing of the input source), so we 
would not want to generate these more than once.  Therefore the 
current default behavior should remain.

What you can do, however, is reimplement the "sdpLines()" virtual 
function in your "OnDemandServerMediaSubsession" subclass, as follows:

char const* yourSubclass::sdpLines() {
	delete[] fSDPLines; fSDPLines = NULL;

	return OnDemandServerMediaSubsession::sdpLines();
}

Alternatively, you could just add
	delete[] fSDPLines; fSDPLines = NULL;
to your implementation of the "createNewRTPSink()" virtual function.

For either of these solutions to work, the definition of "fSDPLines" 
in "liveMedia/include/OnDemandServerMediaSubsession.hh" will need to 
be changed from "private" to protected".  (I'll make this change in 
the next release of the software.)

I'm curious, though.  You talk about the user "reconnect(ing) with a 
different resolution".  How are you doing this in the RTSP protocol? 
Because you must be creating your "H264VideoRTPSink" with a different 
"sprop_parameter_sets_str" parameter each time (in order for its SDP 
description to change), you must be making the 
"sprop_parameter_sets_str" parameter be somehow dependent upon the 
client-desired resolution.  How are you doing this?
-- 

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


More information about the live-devel mailing list