[Live-devel] multi file read in testOnDemandRTSPServer

Ross Finlayson finlayson at live555.com
Tue Jan 19 01:38:17 PST 2010

>I am developing a rtsp server which is based on
>testOnDemandRTSPServer/mpeg4ESVideoTest. The video source is from a
>camera instead of files so that I can implement a live video server.
>I found When streaming video MPEG4VideoFileServerMediaSubsession reads
>files from the beginning for several times. It looks like the first
>time it reads in the header, and next times it reads and really
>streams the data. If reuseFirstSource is set to True then the file
>will be opened and read twice.

Yes, this is unavoidable, unfortunately.  The server needs to read 
the MPEG-4 video data initially, so it can parse it to figure out the 
stream-specific 'config' information (the SDP "a=fmtp:..." line) that 
gets returned as part of the RTSP "DESCRIBE" response.  It then needs 
to read the data a second time when it later gets delivered to the 
client (in response to RTSP "PLAY").

If the input data is a file (as it is with the unmodified 
"testOnDemandRTSPServer"), then the server actually rereads the same 
data (i.e., from the beginning of the file).  However, if the input 
data is a live source, then it's not necessary that the second read 
return the same data as the first read.  Instead, you can treat the 
input data as being an unseekable object.  You don't need to buffer 
the data from the first read.

Ross Finlayson
Live Networks, Inc.

More information about the live-devel mailing list