cancellable SignalClient & tracing

This commit is contained in:
Théo Monnom
2022-10-02 21:22:12 +02:00
parent 9361b7e256
commit 2213a70142
19 changed files with 408 additions and 1472 deletions
+2 -3
View File
@@ -18,7 +18,7 @@ pub struct DataChannel {
impl Debug for DataChannel {
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
write!(f, "DataChannel [{:?}]", self.label())
write!(f, "DataChannel[{}]", self.label())
}
}
@@ -100,8 +100,7 @@ impl DataChannel {
}
pub type OnStateChangeHandler = Box<dyn FnMut() + Send + Sync>;
pub type OnMessageHandler = Box<dyn FnMut(&[u8], bool) + Send + Sync>;
// data, is_binary
pub type OnMessageHandler = Box<dyn FnMut(&[u8], bool) + Send + Sync>; // data, is_binary
pub type OnBufferedAmountChangeHandler = Box<dyn FnMut(u64) + Send + Sync>;
struct InternalDataChannelObserver {
+13 -2
View File
@@ -1,14 +1,20 @@
use std::fmt::{Debug, Display, Formatter, write};
use cxx::UniquePtr;
use libwebrtc_sys::jsep as sys_jsep;
pub use sys_jsep::ffi::{SdpType, SdpParseError};
// TODO Maybe we can replace that by a serialized IceCandidateInit
#[derive(Debug)]
pub struct IceCandidate {
cxx_handle: UniquePtr<sys_jsep::ffi::IceCandidate>,
}
impl Debug for IceCandidate {
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
write!(f, "IceCandidate[{}]", self.to_string())
}
}
impl IceCandidate {
pub fn from(sdp_mid: &str, sdp_mline_index: i32, sdp: &str) -> Result<IceCandidate, SdpParseError> {
let res = sys_jsep::ffi::create_ice_candidate(sdp_mid.to_string(), sdp_mline_index, sdp.to_string());
@@ -46,11 +52,16 @@ impl ToString for IceCandidate {
}
}
#[derive(Debug)]
pub struct SessionDescription {
cxx_handle: UniquePtr<sys_jsep::ffi::SessionDescription>,
}
impl Debug for SessionDescription {
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
write!(f, "SessionDescription[{}]", self.to_string())
}
}
impl SessionDescription {
pub fn from(sdp_type: SdpType, description: &str) -> Result<SessionDescription, SdpParseError> {
let res = sys_jsep::ffi::create_session_description(sdp_type, description.to_string());