<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Dear all,<br>
<br>
we are trying to use the live555MediaServer to stream MPEG2
transport stream files which size grow continuously due to a
separated process that appends data to both transport stream (.ts)
and transport stream index files (.tsx).<br>
<br>
After the first RTSP request (DESCRIBE or PLAY) the server seems to
parse the tsx file and saves the transport stream duration (inside a
Server Media Session?). All the <span id="result_box"
class="short_text" lang="en"><span class="hps">subsequent DESCRIBE
requests return the saved time range</span></span> even if the
file duration is <span id="result_box" class="short_text" lang="en"><span
class="hps">grown. If a PLAY request with npt > duration </span></span>is
generated the server seek only to the last saved duration ignoring
the actual npt.<br>
<br>
We know that this is the desired behavior but we need the media
server to dynamically update the file duration. Does anyone know if
this is possible?<br>
In order to do so, we have tried to modify DynamicRTSPServer.cpp in
function lookupServerMediaSession: instead of using pre existent
Server Media Session we remove and recreate it at each incoming RTSP
request.<br>
<br>
The original code was:<br>
<br>
<blockquote><small>ServerMediaSession* </small><br>
<small>DynamicRTSPServer::lookupServerMediaSession(char const*
streamName) { </small><br>
<small> // First, check whether the specified "streamName" exists
as a local file: </small><br>
<small> FILE* fid = fopen(streamName, "rb"); </small><br>
<small> Boolean fileExists = fid != NULL; </small><br>
<small> </small><br>
<small> // Next, check whether we already have a
"ServerMediaSession" for this file: </small><br>
<small> ServerMediaSession* sms =
RTSPServer::lookupServerMediaSession(streamName); </small><br>
<small> Boolean smsExists = sms != NULL; </small><br>
<small> </small><br>
<small> // Handle the four possibilities for "fileExists" and
"smsExists": </small><br>
<small> if (!fileExists) { </small><br>
<small> if (smsExists) { </small><br>
<small> // "sms" was created for a file that no longer
exists. Remove it: </small><br>
<small> removeServerMediaSession(sms); </small><br>
<small> } </small><br>
<small> return NULL; </small><br>
<small> } else { </small><br>
<small> if (!smsExists) { </small><br>
<small> // Create a new "ServerMediaSession" object for
streaming from the named file. </small><br>
<small> sms = createNewSMS(envir(), streamName, fid); </small><br>
<small> addServerMediaSession(sms); </small><br>
<small> } </small><br>
<small> fclose(fid); </small><br>
<small> return sms; </small><br>
<small> } </small><br>
<small>} </small><br>
</blockquote>
<br>
Our modified version is:<br>
<br>
<blockquote><small>ServerMediaSession* </small><br>
<small>DynamicRTSPServer::lookupServerMediaSession(char const*
streamName) { </small><br>
<small> // First, check whether the specified "streamName" exists
as a local file: </small><br>
<small> FILE* fid = fopen(streamName, "rb"); </small><br>
<small> Boolean fileExists = fid != NULL; </small><br>
<small> </small><br>
<small> // Next, check whether we already have a
"ServerMediaSession" for this file: </small><br>
<small> ServerMediaSession* sms =
RTSPServer::lookupServerMediaSession(streamName); </small><br>
<small> Boolean smsExists = sms != NULL; </small><br>
<small> </small><br>
<small> // Handle the four possibilities for "fileExists" and
"smsExists": </small><br>
<small> if (!fileExists) { </small><br>
<small> if (smsExists) { </small><br>
<small> // "sms" was created for a file that no longer
exists. Remove it: </small><br>
<small> removeServerMediaSession(sms); </small><br>
<small> } </small><br>
<small> return NULL; </small><br>
<small> } else { </small><br>
<small><font color="#ff0000"> if(smsExists) { </font></small><br>
<small><font color="#ff0000">
removeServerMediaSession(sms); </font></small><br>
<small><font color="#ff0000"> sms=NULL; </font></small><br>
<small><font color="#ff0000"> } </font></small><br>
<small><font color="#ff0000"> sms = createNewSMS(envir(),
streamName, fid); </font></small><br>
<small> <font color="#ff0000">addServerMediaSession(sms); </font></small><br>
<small> fclose(fid); </small><br>
<small> return sms; </small><br>
<small> } </small><br>
<small>} </small><br>
</blockquote>
<br>
This way it seems to work, but we are not sure if we did it in the
right way. Actually we are worried about possible concurrency issues
(e.g. what if a new request deleting a previous session that is
still in use?). Do you think we can go on using this little hack or
we should approach the problem in another way?<br>
<br>
Thanks in advance<br>
Nadir<br>
<br>
<br>
<br>
</body>
</html>