webrtcsink: Make the turn-server prop a turn-servers list

So that we can simply specify several turn servers at once

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/973>
This commit is contained in:
Thibault Saunier 2022-11-09 15:44:02 -03:00 committed by GStreamer Marge Bot
parent 2642410702
commit 6b11284e8a
2 changed files with 24 additions and 21 deletions

View file

@ -5840,16 +5840,15 @@
"type": "gchararray",
"writable": true
},
"turn-server": {
"blurb": "The TURN server of the form turn(s)://username:password@host:port.",
"turn-servers": {
"blurb": "The TURN servers of the form <\"turn(s)://username:password@host:port\", \"turn(s)://username1:password1@host1:port1\">",
"conditionally-available": false,
"construct": false,
"construct-only": false,
"controllable": false,
"default": "NULL",
"mutable": "null",
"mutable": "ready",
"readable": true,
"type": "gchararray",
"type": "GstValueArray",
"writable": true
},
"video-caps": {

View file

@ -67,7 +67,7 @@ struct CCInfo {
struct Settings {
video_caps: gst::Caps,
audio_caps: gst::Caps,
turn_server: Option<String>,
turn_servers: gst::Array,
stun_server: Option<String>,
cc_info: CCInfo,
do_fec: bool,
@ -271,7 +271,7 @@ impl Default for Settings {
.map(|s| gst::Structure::new_empty(s))
.collect::<gst::Caps>(),
stun_server: DEFAULT_STUN_SERVER.map(String::from),
turn_server: None,
turn_servers: gst::Array::new(Vec::new() as Vec<glib::SendValue>),
cc_info: CCInfo {
heuristic: WebRTCSinkCongestionControl::GoogleCongestionControl,
min_bitrate: DEFAULT_MIN_BITRATE,
@ -1420,8 +1420,8 @@ impl WebRTCSink {
webrtcbin.set_property("stun-server", stun_server);
}
if let Some(turn_server) = settings.turn_server.as_ref() {
webrtcbin.set_property("turn-server", turn_server);
for turn_server in settings.turn_servers.iter() {
webrtcbin.emit_by_name::<bool>("add-turn-server", &[&turn_server]);
}
let rtpgccbwe = match settings.cc_info.heuristic {
@ -2372,12 +2372,18 @@ impl ObjectImpl for WebRTCSink {
DEFAULT_STUN_SERVER,
glib::ParamFlags::READWRITE,
),
glib::ParamSpecString::new(
"turn-server",
"TURN Server",
"The TURN server of the form turn(s)://username:password@host:port.",
None,
glib::ParamFlags::READWRITE,
gst::ParamSpecArray::new(
"turn-servers",
"List of TURN Servers to user",
"The TURN servers of the form <\"turn(s)://username:password@host:port\", \"turn(s)://username1:password1@host1:port1\">",
Some(&glib::ParamSpecString::new(
"turn-server",
"TURN Server",
"The TURN server of the form turn(s)://username:password@host:port.",
None,
glib::ParamFlags::READWRITE,
)),
glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
),
glib::ParamSpecEnum::new(
"congestion-control",
@ -2477,11 +2483,9 @@ impl ObjectImpl for WebRTCSink {
.get::<Option<String>>()
.expect("type checked upstream")
}
"turn-server" => {
"turn-servers" => {
let mut settings = self.settings.lock().unwrap();
settings.turn_server = value
.get::<Option<String>>()
.expect("type checked upstream")
settings.turn_servers = value.get::<gst::Array>().expect("type checked upstream")
}
"congestion-control" => {
let mut settings = self.settings.lock().unwrap();
@ -2542,9 +2546,9 @@ impl ObjectImpl for WebRTCSink {
let settings = self.settings.lock().unwrap();
settings.stun_server.to_value()
}
"turn-server" => {
"turn-servers" => {
let settings = self.settings.lock().unwrap();
settings.turn_server.to_value()
settings.turn_servers.to_value()
}
"min-bitrate" => {
let settings = self.settings.lock().unwrap();