Hi,

I was wondering whether createNewSomething methods may return NULL. The
library itself appears to be inconsistent here as a quick survey of
random functions turned out:

Some invocations are not checked for whether a createNew returns NULL.
* OnDemandServerMediaSubsession:getStreamParameters does not check 
createNewStreamSource for NULL result.
* ClientTrickPlayState::updateStateOnScaleChange does not check 
MPEG2TransportStreamFromESSource::createNew for NULL result.
* 
RTSPServerSupportingHTTPStreaming::RTSPClientConnectionSupportingHTTPStreaming::handleHTTPCmd_StreamingGET
 does not check TCPStreamSink::createNew for NULL result.
* GenericMediaServer::createNewClientSessionWithId does not check 
createNewClientSession for NULL result.

But other invocations are checked:
* OnDemandServerMediaSubsession::sdpLines checks the result of 
createNewStreamSource and createNewRTPSink.
* OnDemandServerMediaSubsession:getStreamParameters checks the result of 
createNewRTPSink.
* MediaSession::initializeWithSDP checks the result of createNewMediaSubsession.
* MediaSubsession::initiate checks the result of RTCPInstance::createNew.
* H265VideoFileServerMediaSubsession::createNewStreamSource checks the result 
of ByteStreamFileSource::createNew.

Another interesting aspect is which of these actually can return NULL
(as C++ new cannot return NULL and throws std::bad_alloc instead). The
following functions have some path that yields a NULL return:
* AVIFileSink::createNew 
* ByteStreamMemoryBufferSource::createNew 
* ADUFromMP3Source::createNew 
* MP3FromADUSource::createNew 
* MPEG1or2DemuxedServerMediaSubsession::createNewStreamSource 
* MPEG1or2DemuxedServerMediaSubsession::createNewRTPSink 
* MPEG2TransportStreamIndexFile::createNew 
* ByteStreamFileSource::createNew 
* MPEG2TransportFileServerMediaSubsession 
* RTSPServerSupportingHTTPStreaming::createNew 
* MP3Transcoder::createNew 
* H265VideoFileServerMediaSubsession::createNewStreamSource 

In particular, some implementations of createNewStreamSource appear to
potentiall return NULL, but not all consumers check for that.

I am particularly interested in the expected semantics for
GenericMediaServer::createNewClientSession as it currently is not
checked by GenericMediaServer::createNewClientSessionWithId. Thus we can
assume that the latter also never returns NULL, but consumers of it do
check for NULL. Either those checks are unnecessary or the result of
GenericMediaServer::createNewClientSession should indeed be checked.

So when I ask whether createNewSomething may return NULL, I ask for the
intention. I already know that the practical answer is "maybe".

Helmut
_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to