SetLiveLatency Method

Summary
Sets the LiveLatency settings for a source folder or the whole server.
Syntax
C#
C++/CLI
public void SetLiveLatency( 
   int index, 
   double latency 
) 
public: 
void SetLiveLatency(  
   int index, 
   double latency 
)  

Parameters

index
0-based index of the source folder whose live latency should be set. Use -1 to set the default RTSP Server LiveLatency setting.

latency
The live latency value in seconds.

Remarks

The RTSP server treats growing DVR buffers as a live stream. When an RTSP client connects and requests playing a growing DVR buffer, the RTSP server starts playing from the current position in this live stream. For performance purposes, it starts a little bit behind the live stream. The amount by which it is behind the is called "live stream latency" and its amount is set using this function. The live stream latency is a double value and is measured in seconds.

If  index is between 0 and SourceCount - 1 (where SourceCount is the number of folders in the list, as indicated by SourceCount), this method sets the LiveLatency settings for the source with the index equal to  index.

If  index is set to -1, this method sets the default LiveLatency setting for the RTSP server. All the current folders are set to this LiveLatency setting. Also, all future folders added with SetSourceFolder will use the default LiveLatency setting.

If you never set the LiveLatency setting for the RTSP server, the default value is 0.5 (for 0.5 seconds behind live).

A DVR buffer is considered to be growing if it is still being written to by the DVR engine when an RTSP client requests it. See Creating a LEADTOOLS Multimedia Capture Application using LEADTOOLS DVR for more information on DVR files.

If the source DVR buffer is using a compression compatible to the RTSP server, the streaming will start from the first key frame found before the "Live Stream Position" - "LiveLatency". This is done for performance purposes, because the streaming must start with a key frame.

Example
C#
using Leadtools; 
using Leadtools.Multimedia; 
using LeadtoolsMultimediaExamples.Fixtures; 
 
 
RTSPServer _server = null; 
public void StartServer() 
{ 
   // create the server instance 
   _server = new RTSPServer(); 
   // specify c:\MyFiles as the source folder 
   _server.SetSourceFolder(0, @"c:\MyFiles"); 
   // will listen on 127.0.0.1 
   _server.TargetAddress = "127.0.0.1"; 
   // start listening on port 554 
   _server.StartServer(554); 
   // set the latency 
   _server.SetLiveLatency(-1, 0.7); 
} 
 
public void StopServer() 
{ 
   _server.StopServer(554); 
   _server.Dispose(); 
   _server = null; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Multimedia Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.