Skip to content

Commit

Permalink
Add client timeout option in the RTMP Source
Browse files Browse the repository at this point in the history
  • Loading branch information
varsill committed Feb 14, 2025
1 parent de85843 commit b645caf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/membrane_rtmp_plugin/rtmp/source/source.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ defmodule Membrane.RTMP.Source do
An URL on which the client is expected to connect, for example:
rtmp://127.0.0.1:1935/app/stream_key
"""
],
client_timeout: [
default: Membrane.Time.seconds(5),
spec: Membrane.Time.t(),
description: """
Time after which an unused client connection is automatically closed. Defaults to 5 seconds.
"""
]

defguardp is_builtin_server(opts)
Expand All @@ -54,7 +61,8 @@ defmodule Membrane.RTMP.Source do
url: opts.url,
mode: :builtin_server,
client_ref: nil,
use_ssl?: nil
use_ssl?: nil,
client_timeout: opts.client_timeout
}

{[], state}
Expand Down Expand Up @@ -94,7 +102,7 @@ defmodule Membrane.RTMP.Source do
port: port,
use_ssl?: use_ssl?,
handle_new_client: handle_new_client,
client_timeout: Membrane.Time.milliseconds(100)
client_timeout: state.client_timeout
)

state = %{state | app: app, stream_key: stream_key, server: server_pid}
Expand Down

0 comments on commit b645caf

Please sign in to comment.