mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-26 13:31:00 +00:00
webrtchttp: Use a proper Rust type name for ICE transport policy
We don't need to namespace here but can just use the Rust namespaces. Only the GType name has to stay like it is. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/949>
This commit is contained in:
parent
2eba3b321e
commit
d18761892e
3 changed files with 15 additions and 16 deletions
|
@ -23,7 +23,7 @@ mod whipsink;
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
#[enum_type(name = "GstRsWebRTCICETransportPolicy")]
|
#[enum_type(name = "GstRsWebRTCICETransportPolicy")]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum GstRsWebRTCICETransportPolicy {
|
pub enum IceTransportPolicy {
|
||||||
#[enum_value(name = "All: get both STUN and TURN candidate pairs", nick = "all")]
|
#[enum_value(name = "All: get both STUN and TURN candidate pairs", nick = "all")]
|
||||||
All = 0,
|
All = 0,
|
||||||
#[enum_value(name = "Relay: get only TURN candidate pairs", nick = "relay")]
|
#[enum_value(name = "Relay: get only TURN candidate pairs", nick = "relay")]
|
||||||
|
@ -33,7 +33,7 @@ pub enum GstRsWebRTCICETransportPolicy {
|
||||||
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
||||||
#[cfg(feature = "doc")]
|
#[cfg(feature = "doc")]
|
||||||
{
|
{
|
||||||
GstRsWebRTCICETransportPolicy::static_type()
|
IceTransportPolicy::static_type()
|
||||||
.mark_as_plugin_api(gst::PluginAPIFlags::empty());
|
.mark_as_plugin_api(gst::PluginAPIFlags::empty());
|
||||||
}
|
}
|
||||||
whipsink::register(plugin)?;
|
whipsink::register(plugin)?;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
use crate::utils::{
|
use crate::utils::{
|
||||||
build_reqwest_client, parse_redirect_location, set_ice_servers, wait, WaitError,
|
build_reqwest_client, parse_redirect_location, set_ice_servers, wait, WaitError,
|
||||||
};
|
};
|
||||||
use crate::GstRsWebRTCICETransportPolicy;
|
use crate::IceTransportPolicy;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use futures::future;
|
use futures::future;
|
||||||
use gst::{glib, prelude::*, subclass::prelude::*, ErrorMessage};
|
use gst::{glib, prelude::*, subclass::prelude::*, ErrorMessage};
|
||||||
|
@ -30,8 +30,7 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
const DEFAULT_ICE_TRANSPORT_POLICY: GstRsWebRTCICETransportPolicy =
|
const DEFAULT_ICE_TRANSPORT_POLICY: IceTransportPolicy = IceTransportPolicy::All;
|
||||||
GstRsWebRTCICETransportPolicy::All;
|
|
||||||
const MAX_REDIRECTS: u8 = 10;
|
const MAX_REDIRECTS: u8 = 10;
|
||||||
const DEFAULT_TIMEOUT: u32 = 15;
|
const DEFAULT_TIMEOUT: u32 = 15;
|
||||||
|
|
||||||
|
@ -44,7 +43,7 @@ struct Settings {
|
||||||
whep_endpoint: Option<String>,
|
whep_endpoint: Option<String>,
|
||||||
auth_token: Option<String>,
|
auth_token: Option<String>,
|
||||||
use_link_headers: bool,
|
use_link_headers: bool,
|
||||||
ice_transport_policy: GstRsWebRTCICETransportPolicy,
|
ice_transport_policy: IceTransportPolicy,
|
||||||
timeout: u32,
|
timeout: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +247,7 @@ impl ObjectImpl for WhepSrc {
|
||||||
.nick("Authorization Token")
|
.nick("Authorization Token")
|
||||||
.blurb("Authentication token to use, will be sent in the HTTP Header as 'Bearer <auth-token>'")
|
.blurb("Authentication token to use, will be sent in the HTTP Header as 'Bearer <auth-token>'")
|
||||||
.build(),
|
.build(),
|
||||||
glib::ParamSpecEnum::builder::<GstRsWebRTCICETransportPolicy>("ice-transport-policy", DEFAULT_ICE_TRANSPORT_POLICY)
|
glib::ParamSpecEnum::builder::<IceTransportPolicy>("ice-transport-policy", DEFAULT_ICE_TRANSPORT_POLICY)
|
||||||
.nick("ICE transport policy")
|
.nick("ICE transport policy")
|
||||||
.blurb("The policy to apply for ICE transport")
|
.blurb("The policy to apply for ICE transport")
|
||||||
.build(),
|
.build(),
|
||||||
|
@ -313,10 +312,10 @@ impl ObjectImpl for WhepSrc {
|
||||||
"ice-transport-policy" => {
|
"ice-transport-policy" => {
|
||||||
let mut settings = self.settings.lock().unwrap();
|
let mut settings = self.settings.lock().unwrap();
|
||||||
settings.ice_transport_policy = value
|
settings.ice_transport_policy = value
|
||||||
.get::<GstRsWebRTCICETransportPolicy>()
|
.get::<IceTransportPolicy>()
|
||||||
.expect("ice-transport-policy should be an enum value");
|
.expect("ice-transport-policy should be an enum value");
|
||||||
|
|
||||||
if settings.ice_transport_policy == GstRsWebRTCICETransportPolicy::Relay {
|
if settings.ice_transport_policy == IceTransportPolicy::Relay {
|
||||||
self.webrtcbin
|
self.webrtcbin
|
||||||
.set_property_from_str("ice-transport-policy", "relay");
|
.set_property_from_str("ice-transport-policy", "relay");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
use crate::utils::{
|
use crate::utils::{
|
||||||
build_reqwest_client, parse_redirect_location, set_ice_servers, wait, WaitError,
|
build_reqwest_client, parse_redirect_location, set_ice_servers, wait, WaitError,
|
||||||
};
|
};
|
||||||
use crate::GstRsWebRTCICETransportPolicy;
|
use crate::IceTransportPolicy;
|
||||||
use futures::future;
|
use futures::future;
|
||||||
use gst::glib;
|
use gst::glib;
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
@ -29,8 +29,8 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
gst::DebugCategory::new("whipsink", gst::DebugColorFlags::empty(), Some("WHIP Sink"))
|
gst::DebugCategory::new("whipsink", gst::DebugColorFlags::empty(), Some("WHIP Sink"))
|
||||||
});
|
});
|
||||||
|
|
||||||
const DEFAULT_ICE_TRANSPORT_POLICY: GstRsWebRTCICETransportPolicy =
|
const DEFAULT_ICE_TRANSPORT_POLICY: IceTransportPolicy =
|
||||||
GstRsWebRTCICETransportPolicy::All;
|
IceTransportPolicy::All;
|
||||||
const MAX_REDIRECTS: u8 = 10;
|
const MAX_REDIRECTS: u8 = 10;
|
||||||
const DEFAULT_TIMEOUT: u32 = 15;
|
const DEFAULT_TIMEOUT: u32 = 15;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ struct Settings {
|
||||||
auth_token: Option<String>,
|
auth_token: Option<String>,
|
||||||
turn_server: Option<String>,
|
turn_server: Option<String>,
|
||||||
stun_server: Option<String>,
|
stun_server: Option<String>,
|
||||||
ice_transport_policy: GstRsWebRTCICETransportPolicy,
|
ice_transport_policy: IceTransportPolicy,
|
||||||
timeout: u32,
|
timeout: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ impl ObjectImpl for WhipSink {
|
||||||
.blurb("The TURN server of the form turn(s)://username:password@host:port.")
|
.blurb("The TURN server of the form turn(s)://username:password@host:port.")
|
||||||
.build(),
|
.build(),
|
||||||
|
|
||||||
glib::ParamSpecEnum::builder::<GstRsWebRTCICETransportPolicy>("ice-transport-policy", DEFAULT_ICE_TRANSPORT_POLICY)
|
glib::ParamSpecEnum::builder::<IceTransportPolicy>("ice-transport-policy", DEFAULT_ICE_TRANSPORT_POLICY)
|
||||||
.nick("ICE transport policy")
|
.nick("ICE transport policy")
|
||||||
.blurb("The policy to apply for ICE transport")
|
.blurb("The policy to apply for ICE transport")
|
||||||
.build(),
|
.build(),
|
||||||
|
@ -287,10 +287,10 @@ impl ObjectImpl for WhipSink {
|
||||||
"ice-transport-policy" => {
|
"ice-transport-policy" => {
|
||||||
let mut settings = self.settings.lock().unwrap();
|
let mut settings = self.settings.lock().unwrap();
|
||||||
settings.ice_transport_policy = value
|
settings.ice_transport_policy = value
|
||||||
.get::<GstRsWebRTCICETransportPolicy>()
|
.get::<IceTransportPolicy>()
|
||||||
.expect("ice-transport-policy should be an enum value");
|
.expect("ice-transport-policy should be an enum value");
|
||||||
|
|
||||||
if settings.ice_transport_policy == GstRsWebRTCICETransportPolicy::Relay {
|
if settings.ice_transport_policy == IceTransportPolicy::Relay {
|
||||||
self.webrtcbin
|
self.webrtcbin
|
||||||
.set_property_from_str("ice-transport-policy", "relay");
|
.set_property_from_str("ice-transport-policy", "relay");
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue