mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-22 19:41:00 +00:00
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:
parent
2642410702
commit
6b11284e8a
2 changed files with 24 additions and 21 deletions
|
@ -5840,16 +5840,15 @@
|
||||||
"type": "gchararray",
|
"type": "gchararray",
|
||||||
"writable": true
|
"writable": true
|
||||||
},
|
},
|
||||||
"turn-server": {
|
"turn-servers": {
|
||||||
"blurb": "The TURN server of the form turn(s)://username:password@host:port.",
|
"blurb": "The TURN servers of the form <\"turn(s)://username:password@host:port\", \"turn(s)://username1:password1@host1:port1\">",
|
||||||
"conditionally-available": false,
|
"conditionally-available": false,
|
||||||
"construct": false,
|
"construct": false,
|
||||||
"construct-only": false,
|
"construct-only": false,
|
||||||
"controllable": false,
|
"controllable": false,
|
||||||
"default": "NULL",
|
"mutable": "ready",
|
||||||
"mutable": "null",
|
|
||||||
"readable": true,
|
"readable": true,
|
||||||
"type": "gchararray",
|
"type": "GstValueArray",
|
||||||
"writable": true
|
"writable": true
|
||||||
},
|
},
|
||||||
"video-caps": {
|
"video-caps": {
|
||||||
|
|
|
@ -67,7 +67,7 @@ struct CCInfo {
|
||||||
struct Settings {
|
struct Settings {
|
||||||
video_caps: gst::Caps,
|
video_caps: gst::Caps,
|
||||||
audio_caps: gst::Caps,
|
audio_caps: gst::Caps,
|
||||||
turn_server: Option<String>,
|
turn_servers: gst::Array,
|
||||||
stun_server: Option<String>,
|
stun_server: Option<String>,
|
||||||
cc_info: CCInfo,
|
cc_info: CCInfo,
|
||||||
do_fec: bool,
|
do_fec: bool,
|
||||||
|
@ -271,7 +271,7 @@ impl Default for Settings {
|
||||||
.map(|s| gst::Structure::new_empty(s))
|
.map(|s| gst::Structure::new_empty(s))
|
||||||
.collect::<gst::Caps>(),
|
.collect::<gst::Caps>(),
|
||||||
stun_server: DEFAULT_STUN_SERVER.map(String::from),
|
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 {
|
cc_info: CCInfo {
|
||||||
heuristic: WebRTCSinkCongestionControl::GoogleCongestionControl,
|
heuristic: WebRTCSinkCongestionControl::GoogleCongestionControl,
|
||||||
min_bitrate: DEFAULT_MIN_BITRATE,
|
min_bitrate: DEFAULT_MIN_BITRATE,
|
||||||
|
@ -1420,8 +1420,8 @@ impl WebRTCSink {
|
||||||
webrtcbin.set_property("stun-server", stun_server);
|
webrtcbin.set_property("stun-server", stun_server);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(turn_server) = settings.turn_server.as_ref() {
|
for turn_server in settings.turn_servers.iter() {
|
||||||
webrtcbin.set_property("turn-server", turn_server);
|
webrtcbin.emit_by_name::<bool>("add-turn-server", &[&turn_server]);
|
||||||
}
|
}
|
||||||
|
|
||||||
let rtpgccbwe = match settings.cc_info.heuristic {
|
let rtpgccbwe = match settings.cc_info.heuristic {
|
||||||
|
@ -2372,12 +2372,18 @@ impl ObjectImpl for WebRTCSink {
|
||||||
DEFAULT_STUN_SERVER,
|
DEFAULT_STUN_SERVER,
|
||||||
glib::ParamFlags::READWRITE,
|
glib::ParamFlags::READWRITE,
|
||||||
),
|
),
|
||||||
glib::ParamSpecString::new(
|
gst::ParamSpecArray::new(
|
||||||
"turn-server",
|
"turn-servers",
|
||||||
"TURN Server",
|
"List of TURN Servers to user",
|
||||||
"The TURN server of the form turn(s)://username:password@host:port.",
|
"The TURN servers of the form <\"turn(s)://username:password@host:port\", \"turn(s)://username1:password1@host1:port1\">",
|
||||||
None,
|
Some(&glib::ParamSpecString::new(
|
||||||
glib::ParamFlags::READWRITE,
|
"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(
|
glib::ParamSpecEnum::new(
|
||||||
"congestion-control",
|
"congestion-control",
|
||||||
|
@ -2477,11 +2483,9 @@ impl ObjectImpl for WebRTCSink {
|
||||||
.get::<Option<String>>()
|
.get::<Option<String>>()
|
||||||
.expect("type checked upstream")
|
.expect("type checked upstream")
|
||||||
}
|
}
|
||||||
"turn-server" => {
|
"turn-servers" => {
|
||||||
let mut settings = self.settings.lock().unwrap();
|
let mut settings = self.settings.lock().unwrap();
|
||||||
settings.turn_server = value
|
settings.turn_servers = value.get::<gst::Array>().expect("type checked upstream")
|
||||||
.get::<Option<String>>()
|
|
||||||
.expect("type checked upstream")
|
|
||||||
}
|
}
|
||||||
"congestion-control" => {
|
"congestion-control" => {
|
||||||
let mut settings = self.settings.lock().unwrap();
|
let mut settings = self.settings.lock().unwrap();
|
||||||
|
@ -2542,9 +2546,9 @@ impl ObjectImpl for WebRTCSink {
|
||||||
let settings = self.settings.lock().unwrap();
|
let settings = self.settings.lock().unwrap();
|
||||||
settings.stun_server.to_value()
|
settings.stun_server.to_value()
|
||||||
}
|
}
|
||||||
"turn-server" => {
|
"turn-servers" => {
|
||||||
let settings = self.settings.lock().unwrap();
|
let settings = self.settings.lock().unwrap();
|
||||||
settings.turn_server.to_value()
|
settings.turn_servers.to_value()
|
||||||
}
|
}
|
||||||
"min-bitrate" => {
|
"min-bitrate" => {
|
||||||
let settings = self.settings.lock().unwrap();
|
let settings = self.settings.lock().unwrap();
|
||||||
|
|
Loading…
Reference in a new issue