RtpTransceiver bindings & requirements for publishing tracks (#39)

- RtpSender
- RtpReceiver
- RtpTransceiver
- RtpParameters
- VideoFrameBuilder
- Interior mutability on c++ side
- Cleanup bindings ( Use #pragma once instead of include guards )
     - webrtc-sys/src/* headers are now used in only one place 
     - Avoid confusion between generated headers and our headers
- AdaptedVideoTrackSource
- Cleanup the workaround with unsupported Vec<Shared<T>>
    - Put everything inside one file
This commit is contained in:
Théo Monnom
2023-02-12 19:44:04 +01:00
committed by GitHub
parent 4411f88b68
commit 16ea02075f
64 changed files with 3357 additions and 670 deletions
+14 -15
View File
@@ -1,10 +1,10 @@
use crate::impl_thread_safety;
use cxx::UniquePtr;
use std::error::Error;
use std::fmt::{Debug, Display, Formatter};
use std::fmt::{Display, Formatter};
use std::mem::ManuallyDrop;
use std::str::FromStr;
use cxx::UniquePtr;
use crate::rtc_error::ffi::RTCError;
#[cxx::bridge(namespace = "livekit")]
@@ -39,11 +39,15 @@ pub mod ffi {
fn on_set_remote_description_complete(self: &SetRemoteSdpObserverWrapper, error: RTCError);
}
unsafe extern "C++" {
include!("webrtc-sys/src/rtc_error.rs.h");
include!("livekit/jsep.h");
extern "C++" {
include!("livekit/rtc_error.h");
type RTCError = crate::rtc_error::ffi::RTCError;
}
unsafe extern "C++" {
include!("livekit/jsep.h");
type IceCandidate;
type SessionDescription;
type NativeCreateSdpObserverHandle;
@@ -72,13 +76,13 @@ pub mod ffi {
sdp_mid: String,
sdp_mline_index: i32,
sdp: String,
) -> Result<UniquePtr<IceCandidate>>;
) -> Result<SharedPtr<IceCandidate>>;
fn create_session_description(
sdp_type: SdpType,
sdp: String,
) -> Result<UniquePtr<SessionDescription>>;
fn _unique_ice_candidate() -> UniquePtr<IceCandidate>; // Ignore
fn _shared_ice_candidate() -> SharedPtr<IceCandidate>; // Ignore
fn _unique_session_description() -> UniquePtr<SessionDescription>; // Ignore
}
}
@@ -95,13 +99,8 @@ impl Display for ffi::SdpParseError {
}
}
unsafe impl Send for ffi::SessionDescription {}
unsafe impl Sync for ffi::SessionDescription {}
unsafe impl Send for ffi::IceCandidate {}
unsafe impl Sync for ffi::IceCandidate {}
impl_thread_safety!(ffi::SessionDescription, Send + Sync);
impl_thread_safety!(ffi::IceCandidate, Send + Sync);
impl ffi::SdpParseError {
/// # Safety