Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making the timeout parameters for streaming plugin for RTSP play out configurable #2598

Merged
merged 11 commits into from
Mar 25, 2021
264 changes: 264 additions & 0 deletions conf/janus.plugin.streaming.jcfg.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
# stream-name: {
# type = rtp|live|ondemand|rtsp
# rtp = stream originated by an external tool (e.g., gstreamer or
# ffmpeg) and sent to the plugin via RTP
# live = local file streamed live to multiple listeners
# (multiple listeners = same streaming context)
# ondemand = local file streamed on-demand to a single listener
# (multiple listeners = different streaming contexts)
# rtsp = stream originated by an external RTSP feed (only
# available if libcurl support was compiled)
# id = <unique numeric ID> (if missing, a random one will be generated)
# description = This is my awesome stream
# metadata = An optional string that can contain any metadata (e.g., JSON)
# associated with the stream you want users to receive
# is_private = true|false (private streams don't appear when you do a 'list'
# request)
# secret = <optional password needed for manipulating (e.g., destroying
# or enabling/disabling) the stream>
# pin = <optional password needed for watching the stream>
# filename = path to the local file to stream (only for live/ondemand)
# audio = true|false (do/don't stream audio)
# video = true|false (do/don't stream video)
# The following options are only valid for the 'rtp' type:
# data = true|false (do/don't stream text via datachannels)
# audioport = local port for receiving audio frames
# audiortcpport = local port, if any, for receiving and sending audio RTCP feedback
# audiomcast = multicast group port for receiving audio frames, if any
# audioiface = network interface or IP address to bind to, if any (binds to all otherwise)
# audiopt = <audio RTP payload type> (e.g., 111)
# audiortpmap = RTP map of the audio codec (e.g., opus/48000/2)
# audioskew = true|false (whether the plugin should perform skew
# analisys and compensation on incoming audio RTP stream, EXPERIMENTAL)
# videoport = local port for receiving video frames
# videortcpport = local port, if any, for receiving and sending video RTCP feedback
# videomcast = multicast group port for receiving video frames, if any
# videoiface = network interface or IP address to bind to, if any (binds to all otherwise)
# videopt = <video RTP payload type> (e.g., 100)
# videortpmap = RTP map of the video codec (e.g., VP8/90000)
# videobufferkf = true|false (whether the plugin should store the latest
# keyframe and send it immediately for new viewers, EXPERIMENTAL)
# videosimulcast = true|false (do|don't enable video simulcasting)
# videoport2 = second local port for receiving video frames (only for rtp, and simulcasting)
# videoport3 = third local port for receiving video frames (only for rtp, and simulcasting)
# videoskew = true|false (whether the plugin should perform skew
# analisys and compensation on incoming video RTP stream, EXPERIMENTAL)
# videosvc = true|false (whether the video will have SVC support; works only for VP9-SVC, default=false)
# collision = in case of collision (more than one SSRC hitting the same port), the plugin
# will discard incoming RTP packets with a new SSRC unless this many milliseconds
# passed, which would then change the current SSRC (0=disabled)
# dataport = local port for receiving data messages to relay
# dataiface = network interface or IP address to bind to, if any (binds to all otherwise)
# datatype = text|binary (type of data this mountpoint will relay, default=text)
# databuffermsg = true|false (whether the plugin should store the latest
# message and send it immediately for new viewers)
# threads = number of threads to assist with the relaying part, which can help
# if you expect a lot of viewers that may cause the RTP receiving part
# in the Streaming plugin to slow down and fail to catch up (default=0)
#
# In case you want to use SRTP for your RTP-based mountpoint, you'll need
# to configure the SRTP-related properties as well, namely the suite to
# use for hashing (32 or 80) and the crypto information for decrypting
# the stream (as a base64 encoded string the way SDES does it). Notice
# that with SRTP involved you'll have to pay extra attention to what you
# feed the mountpoint, as you may risk getting SRTP decrypt errors:
# srtpsuite = 32
# srtpcrypto = WbTBosdVUZqEb6Htqhn+m3z7wUh4RJVR8nE15GbN
#
# The Streaming plugin can also be used to (re)stream media that has been
# encrypted using something that can be consumed via Insertable Streams.
# In that case, we only need to be aware of it, so that we can send the
# info along with the SDP. How to decrypt the media is out of scope, and
# up to the application since, again, this is end-to-end encryption and
# so neither Janus nor the Streaming plugin have access to anything.
# DO NOT SET THIS PROPERTY IF YOU DON'T KNOW WHAT YOU'RE DOING!
# e2ee = true
#
# The following options are only valid for the 'rstp' type:
# url = RTSP stream URL (only for restreaming RTSP)
# rtsp_user = RTSP authorization username (only if type=rtsp)
# rtsp_pwd = RTSP authorization password (only if type=rtsp)
# rtspiface = network interface or IP address to bind to, if any (binds to all otherwise), when receiving RTSP streams
# rtsp_failcheck = whether an error should be returned if connecting to the RTSP server fails (default=true)
# rtsp_reconnect_delay = after n seconds passed and no media assumed, the RTSP server has gone and schedule a reconnect (default=5s)
# rtsp_session_timeout = by default the sreaming plugin will check the RTSP connection with an OPTIONS query,
# the value of the timeout is came from the RTSP session initializer and by default
# this session timeout is the half of this value In some cases this value is can be too high (for example more than one minute)
# because of the media server. In that case this plugin will calculate the timeout with this
# formula: timeout = min(session_timeout, rtsp_session_timeout / 2). (default=0s)
# rtsp_timeout = communication timeout (CURLOPT_TIMEOUT) for cURL call gathering the RTSP information (default=10s)
# rtsp_conn_timeout = connection timeout for cURL (CURLOPT_CONNECTTIMEOUT) call gathering the RTSP information (default=5s)
#
# Notice that, for 'rtsp' mountpoints, normally the plugin uses the exact
# SDP rtpmap and fmtp attributes the remote camera or RTSP server sent.
# In case the values set remotely are known to conflict with WebRTC viewers,
# you can override both using the settings introduced above.
#
# To test the 'gstreamer-sample' example, check the test_gstreamer.sh
# script in the plugins/streams folder. The live and on-demand audio
# file streams, use a couple of files (radio.alaw, music.mulaw) that are
# provided in the plugins/streams folder.
#}

general: {
#admin_key = "supersecret" # If set, mountpoints can be created via API
# only if this key is provided in the request
#rtp_port_range = "20000-40000" # Range of ports to use for RTP/RTCP when '0' is
# passed as port for a mountpoint (default=10000-60000)
#events = false # Whether events should be sent to event
# handlers (default=true)

# By default, integers are used as a unique ID for both mountpoints. In case
# you want to use strings instead (e.g., a UUID), set string_ids to true.
#string_ids = true
}

#
# This is an example of an RTP source stream, which is what you'll need
# in the vast majority of cases: here, the Streaming plugin will bind to
# some ports, and expect media to be sent by an external source (e.g.,
# FFmpeg or Gstreamer). This sample listens on 5002 for audio (Opus) and
# 5004 for video (VP8), which is what the sample gstreamer script in the
# plugins/streams folder sends to. Whatever is sent to those ports will
# be the source of a WebRTC broadcast users can subscribe to.
#
rtp-sample: {
type = "rtp"
id = 1
description = "Opus/VP8 live stream coming from external source"
metadata = "You can use this metadata section to put any info you want!"
audio = true
video = true
audioport = 5002
audiopt = 111
audiortpmap = "opus/48000/2"
videoport = 5004
videopt = 100
videortpmap = "VP8/90000"
secret = "adminpwd"
}

#
# This is a sample of the file-based streaming support. Specifically,
# this simulates a radio broadcast by streaming (in a loop) raw a-Law
# (that is, G.711) frames. Since type is "live", anyone subscribing to
# this mountpoint will listen to the same broadcast as if it were live.
# Notice that file-based streaming supports Opus files too, but no video.
#
file-live-sample: {
type = "live"
id = 2
description = "a-law file source (radio broadcast)"
filename = "/Users/zoltan.ponekker/Code/Janus/root/share/janus/streams/radio.alaw"
audio = true
video = false
secret = "adminpwd"
}

#
# This is another sample of the file-based streaming support, but using
# the "ondemand" type instead. In this case, the file we're streaming
# contains raw mu-Law (still G.711) frames. Since this is "ondemand",
# anyone subscribing to this mountpoint will listen to their own version
# of the stream, meaning that it will start from the beginning and then
# loop when it's over. On-demand streaming supports Opus files as well.
#
file-ondemand-sample: {
type = "ondemand"
id = 3
description = "mu-law file source (music)"
filename = "/Users/zoltan.ponekker/Code/Janus/root/share/janus/streams/music.mulaw"
audio = true
video = false
secret = "adminpwd"
}

#
# All browsers also support H.264, often through Cisco's OpenH264 plugin.
# The only profile that is definitely supported is the baseline one, which
# means that if you try a higher one it might or might not work. No matter
# which profile you encode, though, you can put a custom one in the SDP if
# you override the fmtp SDP attribute via 'videofmtp'. The following is an
# example of how to create a simple H.264 mountpoint: you can feed it via
# an x264enc+rtph264pay pipeline in gstreamer, an ffmpeg script or other.
#
#h264-sample: {
#type = "rtp"
#id = 10
#description = "H.264 live stream coming from gstreamer"
#audio = false
#video = true
#videoport = 8004
#videopt = 126
#videortpmap = "H264/90000"
#videofmtp = "profile-level-id=42e01f;packetization-mode=1"
#secret = "adminpwd"
#}

#
# The Streaming plugin also supports the broadcasting of datachannel
# messages, either by themselves or along other audio/video streams (e.g.,
# to add a subtitle to a stream you're sending). The following is an
# example of how you can create a datachannel-only mountpoint: you can
# feed it with any tool that can send UDP datagrams, e.g., netcat.
# Notice that the 'rtp' type just indicates this is a live mountpoint:
# datachannel messages will be sent as usual, and not use RTP at all.
#
#data-example: {
#type = "rtp"
#id = 15
#description = "Datachannel stream from an UDP source"
#audio = false
#video = false
#data = true
#dataport = 5008
#datatype = "text"
#secret = "adminpwd"
#}

#
# This is a variation of the rtp-sample configuration for Opus/VP8 shown
# before, where multicast support is used to receive the streams. You
# need an external script to feed data on those ports, of course.
#
#rtp-multicast: {
#type = "rtp"
#id = 20
#description = "Opus/VP8 live multicast stream sample"
#audio = true
#video = true
#audioport = 5002
#audiomcast = "232.3.4.5"
#audiopt = 111
#audiortpmap = "opus/48000/2"
#videoport = 5004
#videomcast = "232.3.4.5"
#videopt = 100
#videortpmap = "VP8/90000"
#secret = "adminpwd"
#}

#
# This is a sample configuration for an RTSP stream: you can specify
# the url to connect to and whether or not authentication is needed
# using the url/rtsp_user/rtsp_pwd settings (but notice that digest
# authentication will only work if you installed libcurl >= 7.45.0)
# NOTE WELL: the plugin does NOT transcode, so the RTSP stream MUST be
# in a format the browser can digest (e.g., VP8 or H.264 baseline for video)
# Again, you can override payload type, rtpmap and/or fmtp, if needed.
#
#rtsp-test: {
#type = "rtsp"
#id = 99
#description = "RTSP Test"
#audio = false
#video = true
#url = "rtsp://127.0.0.1:8554/unicast"
#rtsp_user = "username"
#rtsp_pwd = "password"
#secret = "adminpwd"
#rtsp_reconnect_delay = 5
#rtsp_session_timeout = 0
#rtsp_timeout = 10
#rtsp_conn_timeout = 5
#}
pontscho marked this conversation as resolved.
Show resolved Hide resolved
27 changes: 27 additions & 0 deletions conf/janus.plugin.streaming.jcfg.sample.in
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,31 @@ file-ondemand-sample: {
#rtsp_user = "username"
#rtsp_pwd = "password"
#secret = "adminpwd"

pontscho marked this conversation as resolved.
Show resolved Hide resolved
# After n seconds passed and no media assumed, the RTSP server has
# gone and schedule a reconnect.
#
# Default value is 5 seconds.
#reconnect_delay = 5
pontscho marked this conversation as resolved.
Show resolved Hide resolved

# By default the sreaming plugin will check the RTSP connection with an OPTIONS query,
pontscho marked this conversation as resolved.
Show resolved Hide resolved
# the value of the timeout is came from the RTSP session initializer and by default
pontscho marked this conversation as resolved.
Show resolved Hide resolved
# this session timeout is the half of this value.
#
# In some cases this value is can be too high (for example more than one minute)
pontscho marked this conversation as resolved.
Show resolved Hide resolved
# because of the media server. In that case this plugin will calculate the timeout
# with this formula: timeout = min(session_timeout, rtsp_session_timeout / 2).
#
# Default value is 0 seconds, then it doesn't override the RTSP server's session timeout..
#session_timeout = 0
pontscho marked this conversation as resolved.
Show resolved Hide resolved

# Communication timeout for cURL call gathering the RTSP information.
#
# Default value is 10 seconds.
# rtsp_timeout = 10
pontscho marked this conversation as resolved.
Show resolved Hide resolved

# Connection timeout for cURL call gathering the RTSP information.
#
# Default value is 5 seconds.
# rtsp_conn_timeout = 5
pontscho marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the stuff you added to the rtsp-test sample can be removed, as it's already documented on top.

Copy link
Contributor Author

@pontscho pontscho Mar 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S***. I've added a wrong config file earlier and I lost in that changes. I've fixed it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem! 😄 Thanks for the quick fixes!

#}
Loading