mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-27 04:20:28 +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)]
|
||||
#[enum_type(name = "GstRsWebRTCICETransportPolicy")]
|
||||
#[non_exhaustive]
|
||||
pub enum GstRsWebRTCICETransportPolicy {
|
||||
pub enum IceTransportPolicy {
|
||||
#[enum_value(name = "All: get both STUN and TURN candidate pairs", nick = "all")]
|
||||
All = 0,
|
||||
#[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> {
|
||||
#[cfg(feature = "doc")]
|
||||
{
|
||||
GstRsWebRTCICETransportPolicy::static_type()
|
||||
IceTransportPolicy::static_type()
|
||||
.mark_as_plugin_api(gst::PluginAPIFlags::empty());
|
||||
}
|
||||
whipsink::register(plugin)?;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
use crate::utils::{
|
||||
build_reqwest_client, parse_redirect_location, set_ice_servers, wait, WaitError,
|
||||
};
|
||||
use crate::GstRsWebRTCICETransportPolicy;
|
||||
use crate::IceTransportPolicy;
|
||||
use bytes::Bytes;
|
||||
use futures::future;
|
||||
use gst::{glib, prelude::*, subclass::prelude::*, ErrorMessage};
|
||||
|
@ -30,8 +30,7 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
|||
)
|
||||
});
|
||||
|
||||
const DEFAULT_ICE_TRANSPORT_POLICY: GstRsWebRTCICETransportPolicy =
|
||||
GstRsWebRTCICETransportPolicy::All;
|
||||
const DEFAULT_ICE_TRANSPORT_POLICY: IceTransportPolicy = IceTransportPolicy::All;
|
||||
const MAX_REDIRECTS: u8 = 10;
|
||||
const DEFAULT_TIMEOUT: u32 = 15;
|
||||
|
||||
|
@ -44,7 +43,7 @@ struct Settings {
|
|||
whep_endpoint: Option<String>,
|
||||
auth_token: Option<String>,
|
||||
use_link_headers: bool,
|
||||
ice_transport_policy: GstRsWebRTCICETransportPolicy,
|
||||
ice_transport_policy: IceTransportPolicy,
|
||||
timeout: u32,
|
||||
}
|
||||
|
||||
|
@ -248,7 +247,7 @@ impl ObjectImpl for WhepSrc {
|
|||
.nick("Authorization Token")
|
||||
.blurb("Authentication token to use, will be sent in the HTTP Header as 'Bearer <auth-token>'")
|
||||
.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")
|
||||
.blurb("The policy to apply for ICE transport")
|
||||
.build(),
|
||||
|
@ -313,10 +312,10 @@ impl ObjectImpl for WhepSrc {
|
|||
"ice-transport-policy" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
settings.ice_transport_policy = value
|
||||
.get::<GstRsWebRTCICETransportPolicy>()
|
||||
.get::<IceTransportPolicy>()
|
||||
.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
|
||||
.set_property_from_str("ice-transport-policy", "relay");
|
||||
} else {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
use crate::utils::{
|
||||
build_reqwest_client, parse_redirect_location, set_ice_servers, wait, WaitError,
|
||||
};
|
||||
use crate::GstRsWebRTCICETransportPolicy;
|
||||
use crate::IceTransportPolicy;
|
||||
use futures::future;
|
||||
use gst::glib;
|
||||
use gst::prelude::*;
|
||||
|
@ -29,8 +29,8 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
|||
gst::DebugCategory::new("whipsink", gst::DebugColorFlags::empty(), Some("WHIP Sink"))
|
||||
});
|
||||
|
||||
const DEFAULT_ICE_TRANSPORT_POLICY: GstRsWebRTCICETransportPolicy =
|
||||
GstRsWebRTCICETransportPolicy::All;
|
||||
const DEFAULT_ICE_TRANSPORT_POLICY: IceTransportPolicy =
|
||||
IceTransportPolicy::All;
|
||||
const MAX_REDIRECTS: u8 = 10;
|
||||
const DEFAULT_TIMEOUT: u32 = 15;
|
||||
|
||||
|
@ -41,7 +41,7 @@ struct Settings {
|
|||
auth_token: Option<String>,
|
||||
turn_server: Option<String>,
|
||||
stun_server: Option<String>,
|
||||
ice_transport_policy: GstRsWebRTCICETransportPolicy,
|
||||
ice_transport_policy: IceTransportPolicy,
|
||||
timeout: u32,
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ impl ObjectImpl for WhipSink {
|
|||
.blurb("The TURN server of the form turn(s)://username:password@host:port.")
|
||||
.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")
|
||||
.blurb("The policy to apply for ICE transport")
|
||||
.build(),
|
||||
|
@ -287,10 +287,10 @@ impl ObjectImpl for WhipSink {
|
|||
"ice-transport-policy" => {
|
||||
let mut settings = self.settings.lock().unwrap();
|
||||
settings.ice_transport_policy = value
|
||||
.get::<GstRsWebRTCICETransportPolicy>()
|
||||
.get::<IceTransportPolicy>()
|
||||
.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
|
||||
.set_property_from_str("ice-transport-policy", "relay");
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue