Skip to content

Commit

Permalink
update(deps): webrtc version
Browse files Browse the repository at this point in the history
Break change! Remove RTCIceCredentialType
webrtc-rs/webrtc@d6b1d34
  • Loading branch information
a-wing committed Jul 1, 2024
1 parent 3e9f3a9 commit 97a2d76
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 71 deletions.
47 changes: 24 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ members = [
"liveman",
]
[workspace.dependencies]
webrtc = { git = "https://github.com/webrtc-rs/webrtc", rev = "ae93e81" }
webrtc = { git = "https://github.com/webrtc-rs/webrtc", rev = "40642c8" }

anyhow = "1.0"
clap = "4.5"
Expand Down
1 change: 0 additions & 1 deletion conf/live777.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ urls = [
# urls = [ "turn:turn.22333.fun", "turn:cn.22333.fun" ]
# username = "live777"
# credential = "live777"
# credential_type = "password"

# WHIP/WHEP auth token
# Headers["Authorization"] = "Bearer {token}"
Expand Down
13 changes: 1 addition & 12 deletions libs/libwish/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,6 @@ impl Client {
urls: vec![link.raw_uri.to_string().replacen("://", ":", 1)],
username: link.params.remove("username").unwrap_or("".to_owned()),
credential: link.params.remove("credential").unwrap_or("".to_owned()),
credential_type: link
.params
.remove("credential-type")
.unwrap_or("".to_owned())
.as_str()
.into(),
})
}
}
Expand Down Expand Up @@ -174,7 +168,6 @@ mod tests {
use http::header;
use http::response::Builder;
use reqwest::Response;
use webrtc::ice_transport::ice_credential_type::RTCIceCredentialType;

use crate::Client;

Expand All @@ -183,7 +176,7 @@ mod tests {
let response = Builder::new()
.header(header::LINK, r#"<stun:stun.22333.fun>; rel="ice-server""#)
.header(header::LINK, r#"<stun:stun.l.google.com:19302>; rel="ice-server""#)
.header(header::LINK, r#"<turn:turn.22333.fun>; rel="ice-server"; username="live777"; credential="live777"; credential-type="password""#)
.header(header::LINK, r#"<turn:turn.22333.fun>; rel="ice-server"; username="live777"; credential="live777""#)
.body("")
.unwrap();
let response = Response::from(response);
Expand All @@ -205,10 +198,6 @@ mod tests {
);
assert_eq!(ice_servers.get(2).unwrap().username, "live777");
assert_eq!(ice_servers.get(2).unwrap().credential, "live777");
assert_eq!(
ice_servers.get(2).unwrap().credential_type,
RTCIceCredentialType::Password
);

println!("{:?}", ice_servers);
}
Expand Down
24 changes: 1 addition & 23 deletions liveion/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ use base64::engine::general_purpose::STANDARD;
use base64::Engine;
use serde::{Deserialize, Serialize};
use std::{env, fs, net::SocketAddr, str::FromStr};
use webrtc::{
ice,
ice_transport::{ice_credential_type::RTCIceCredentialType, ice_server::RTCIceServer},
Error,
};
use webrtc::{ice, ice_transport::ice_server::RTCIceServer, Error};

#[derive(Debug, Default, Clone, Deserialize, Serialize)]
pub struct Config {
Expand Down Expand Up @@ -200,24 +196,7 @@ impl IceServer {
return Err(Error::ErrNoTurnCredentials);
}
url.username.clone_from(&self.username);

match self.credential_type.as_str().into() {
RTCIceCredentialType::Password => {
// https://www.w3.org/TR/webrtc/#set-the-configuration (step #11.3.3)
url.password.clone_from(&self.credential);
}
RTCIceCredentialType::Oauth => {
// https://www.w3.org/TR/webrtc/#set-the-configuration (step #11.3.4)
/*if _, ok: = s.Credential.(OAuthCredential); !ok {
return nil,
&rtcerr.InvalidAccessError{Err: ErrTurnCredentials
}
}*/
}
_ => return Err(Error::ErrTurnCredentials),
};
}

urls.push(url);
}

Expand All @@ -231,7 +210,6 @@ impl From<IceServer> for RTCIceServer {
urls: val.urls,
username: val.username,
credential: val.credential,
credential_type: val.credential_type.as_str().into(),
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions tools/whepfrom/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use tokio::{
sync::mpsc::{unbounded_channel, UnboundedSender},
};
use tracing::{debug, info, trace, warn, Level};
use webrtc::ice_transport::ice_credential_type::RTCIceCredentialType;
use webrtc::{
api::{interceptor_registry::register_default_interceptors, media_engine::*, APIBuilder},
ice_transport::ice_server::RTCIceServer,
Expand Down Expand Up @@ -190,7 +189,6 @@ async fn new_peer(
urls: vec!["stun:stun.l.google.com:19302".to_string()],
username: "".to_string(),
credential: "".to_string(),
credential_type: RTCIceCredentialType::Unspecified,
}
}],
..Default::default()
Expand Down
3 changes: 1 addition & 2 deletions tools/whipinto/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use tokio::{
use tracing::{debug, info, trace, warn, Level};
use webrtc::{
api::{interceptor_registry::register_default_interceptors, media_engine::*, APIBuilder},
ice_transport::{ice_credential_type::RTCIceCredentialType, ice_server::RTCIceServer},
ice_transport::ice_server::RTCIceServer,
interceptor::registry::Registry,
peer_connection::{
configuration::RTCConfiguration, peer_connection_state::RTCPeerConnectionState,
Expand Down Expand Up @@ -180,7 +180,6 @@ async fn new_peer(
urls: vec!["stun:stun.l.google.com:19302".to_string()],
username: "".to_string(),
credential: "".to_string(),
credential_type: RTCIceCredentialType::Unspecified,
}
}],
..Default::default()
Expand Down
7 changes: 0 additions & 7 deletions tools/whipinto/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ mod tests {
};

use std::sync::Arc;
use webrtc::ice_transport::ice_credential_type::RTCIceCredentialType;
use webrtc::peer_connection::policy::bundle_policy::RTCBundlePolicy;
use webrtc::peer_connection::policy::ice_transport_policy::RTCIceTransportPolicy;
use webrtc::peer_connection::policy::rtcp_mux_policy::RTCRtcpMuxPolicy;
Expand All @@ -35,7 +34,6 @@ mod tests {
urls: vec!["stun:stun.l.google.com:19302".to_string()],
username: "".to_string(),
credential: "".to_string(),
credential_type: RTCIceCredentialType::Unspecified,
}],
..Default::default()
};
Expand All @@ -55,7 +53,6 @@ mod tests {
],
username: "live777".to_string(),
credential: "live777".to_string(),
credential_type: RTCIceCredentialType::Password,
}],
..Default::default()
};
Expand All @@ -77,10 +74,6 @@ mod tests {
);
assert_eq!(updated_config.ice_servers[0].username, "live777");
assert_eq!(updated_config.ice_servers[0].credential, "live777");
assert_eq!(
updated_config.ice_servers[0].credential_type,
RTCIceCredentialType::Password
);
assert_eq!(
updated_config.ice_transport_policy,
RTCIceTransportPolicy::Unspecified
Expand Down

0 comments on commit 97a2d76

Please sign in to comment.