@@ -9,6 +9,7 @@ defmodule ExLibSRT.Server do
99 * `start/3` - starts the server with password authentication
1010 * `start_link/2` - starts the server and links to current process
1111 * `start_link/3` - starts the server with password authentication and links to current process
12+ * `start_link/4` - starts the server with password authentication, sets SRT latency and links to current process
1213 * `stop/1` - stops the server
1314 * `accept_awaiting_connect_request/1` - accepts next incoming connection
1415 * `reject_awaiting_connect_request/1` - rejects next incoming connection
@@ -69,13 +70,16 @@ defmodule ExLibSRT.Server do
6970 If a password is provided, it must be between 10 and 79 characters long according to SRT specification.
7071 An empty string means no password authentication will be used.
7172 """
72- @ spec start_link ( address :: String . t ( ) , port :: non_neg_integer ( ) ) ::
73+ @ spec start_link (
74+ address :: String . t ( ) ,
75+ port :: non_neg_integer ( ) ,
76+ password :: String . t ( ) ,
77+ latency_ms :: integer ( )
78+ ) ::
7379 { :ok , t ( ) } | { :error , reason :: String . t ( ) , error_code :: integer ( ) }
74- @ spec start_link ( address :: String . t ( ) , port :: non_neg_integer ( ) , password :: String . t ( ) ) ::
75- { :ok , t ( ) } | { :error , reason :: String . t ( ) , error_code :: integer ( ) }
76- def start_link ( address , port , password \\ "" ) do
80+ def start_link ( address , port , password \\ "" , latency_ms \\ - 1 ) do
7781 with :ok <- validate_password ( password ) ,
78- { :ok , server_ref } <- ExLibSRT.Native . start_server ( address , port , password , - 1 ) do
82+ { :ok , server_ref } <- ExLibSRT.Native . start_server ( address , port , password , latency_ms ) do
7983 Agent . start_link ( fn -> server_ref end )
8084 else
8185 { :error , reason , error_code } -> { :error , reason , error_code }
0 commit comments