[Live-devel] OnDemandServerMediaSubsession with reusing issues

Ross Finlayson finlayson at live555.com
Wed Mar 21 09:53:23 PDT 2007


>Initially I thought that in a such case
>OnDemandServerMediaSubsession::createNewStreamSource will be called
>only once so I can perform on-demand initialization there. But it
>turned out that it is called twice with the first time just to get sdp
>lines.

This is unfortunate, but unavoidable.  The SDP data has to be 
returned (in the RTSP "DESCRIBE" response) before streaming can 
begin, and unfortunately (for MPEG-4 video only) the SDP data 
includes configuration data that can only be obtained (in general) by 
reading part of the stream

>  Moreover, this first call will then close the source. Since for
>the source I use isMPEG4VideoStreamDiscreteFramer, that would close
>the original source as well. And that is expensive to construct.

If this is a major problem for you, then you could overcome it by 
inserting a new 'filter' object (that you would write) between the 
MPEG-4 video source and the "MPEG4VideoStreamDiscreteFramer".  This 
filter object would know that it is being open/read twice.  The first 
time, it would cache (in allocated memory) each MPEG-4 frame that 
gets read (usually only a few).  The second time, it would first 
deliver frames that had previously been stored in the cache.  After 
that, it would read from the input source, as usual.

In this way, you'd need only open/read the actual MPEG-4 video source once.
-- 

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


More information about the live-devel mailing list