diff --git a/net/webrtc/Cargo.toml b/net/webrtc/Cargo.toml index 27968107..7d7a4f51 100644 --- a/net/webrtc/Cargo.toml +++ b/net/webrtc/Cargo.toml @@ -74,9 +74,10 @@ path = "src/lib.rs" gst-plugin-version-helper = { path = "../../version-helper" } [features] +default = ["v1_22"] static = [] capi = [] -gst1_22 = ["gst/v1_22", "gst-app/v1_22", "gst-video/v1_22", "gst-webrtc/v1_22", "gst-sdp/v1_22", "gst-rtp/v1_22"] +v1_22 = ["gst/v1_22", "gst-app/v1_22", "gst-video/v1_22", "gst-webrtc/v1_22", "gst-sdp/v1_22", "gst-rtp/v1_22"] doc = [] [package.metadata.capi] diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs index 3d8aa8af..54e41a96 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -52,8 +52,11 @@ const DEFAULT_MIN_BITRATE: u32 = 1000; * my local network, possibly related to chrome's pretty low UDP * buffer sizes */ const DEFAULT_MAX_BITRATE: u32 = 8192000; -const DEFAULT_CONGESTION_CONTROL: WebRTCSinkCongestionControl = - WebRTCSinkCongestionControl::GoogleCongestionControl; +const DEFAULT_CONGESTION_CONTROL: WebRTCSinkCongestionControl = if cfg!(feature = "v1_22") { + WebRTCSinkCongestionControl::GoogleCongestionControl +} else { + WebRTCSinkCongestionControl::Disabled +}; const DEFAULT_DO_FEC: bool = true; const DEFAULT_DO_RETRANSMISSION: bool = true; const DEFAULT_ENABLE_DATA_CHANNEL_NAVIGATION: bool = false; @@ -61,6 +64,7 @@ const DEFAULT_ICE_TRANSPORT_POLICY: WebRTCICETransportPolicy = WebRTCICETranspor const DEFAULT_START_BITRATE: u32 = 2048000; /* Start adding some FEC when the bitrate > 2Mbps as we found experimentally * that it is not worth it below that threshold */ +#[cfg(feature = "v1_22")] const DO_FEC_THRESHOLD: u32 = 2000000; #[derive(Debug, Clone, Copy)] @@ -236,6 +240,7 @@ struct Session { pipeline: gst::Pipeline, webrtcbin: gst::Element, + #[cfg(feature = "v1_22")] rtprtxsend: Option, webrtc_pads: HashMap, peer_id: String, @@ -500,7 +505,7 @@ impl Default for Settings { stun_server: DEFAULT_STUN_SERVER.map(String::from), turn_servers: gst::Array::new(Vec::new() as Vec), cc_info: CCInfo { - heuristic: WebRTCSinkCongestionControl::GoogleCongestionControl, + heuristic: DEFAULT_CONGESTION_CONTROL, min_bitrate: DEFAULT_MIN_BITRATE, max_bitrate: DEFAULT_MAX_BITRATE, start_bitrate: DEFAULT_START_BITRATE, @@ -1141,6 +1146,7 @@ impl Session { webrtcbin, peer_id, cc_info, + #[cfg(feature = "v1_22")] rtprtxsend: None, congestion_controller, rtpgccbwe, @@ -2365,6 +2371,7 @@ impl BaseWebRTCSink { } let rtpgccbwe = match settings.cc_info.heuristic { + #[cfg(feature = "v1_22")] WebRTCSinkCongestionControl::GoogleCongestionControl => { let rtpgccbwe = match gst::ElementFactory::make("rtpgccbwe").build() { Err(err) => { @@ -2877,6 +2884,7 @@ impl BaseWebRTCSink { webrtcbin.emit_by_name::<()>("get-stats", &[&None::, &promise]); } + #[cfg(feature = "v1_22")] fn set_rtptrxsend( &self, element: &super::BaseWebRTCSink, @@ -2890,6 +2898,7 @@ impl BaseWebRTCSink { } } + #[cfg(feature = "v1_22")] fn set_bitrate(&self, element: &super::BaseWebRTCSink, session_id: &str, bitrate: u32) { let settings = element.imp().settings.lock().unwrap(); let mut state = element.imp().state.lock().unwrap();