mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-15 23:01:02 +00:00
webrtc: conditional compile for features with 1_22 dependency
Few features being used in webrtcsink like the signal `request-aux-sender` are introduced to webrtcbin in gstreamer release 1.22. Rename the feature gst1_22 to v1_22 for uniformity. Add v1_22 to default features. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1457>
This commit is contained in:
parent
58c22120c2
commit
9fcd63222d
2 changed files with 14 additions and 4 deletions
|
@ -69,9 +69,10 @@ path = "src/lib.rs"
|
|||
gst-plugin-version-helper = { path = "../../version-helper", version = "0.8" }
|
||||
|
||||
[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]
|
||||
|
|
|
@ -51,8 +51,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;
|
||||
|
@ -60,6 +63,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)]
|
||||
|
@ -235,6 +239,7 @@ struct Session {
|
|||
|
||||
pipeline: gst::Pipeline,
|
||||
webrtcbin: gst::Element,
|
||||
#[cfg(feature = "v1_22")]
|
||||
rtprtxsend: Option<gst::Element>,
|
||||
webrtc_pads: HashMap<u32, WebRTCPad>,
|
||||
peer_id: String,
|
||||
|
@ -506,7 +511,7 @@ impl Default for Settings {
|
|||
stun_server: DEFAULT_STUN_SERVER.map(String::from),
|
||||
turn_servers: gst::Array::new(Vec::new() as Vec<glib::SendValue>),
|
||||
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,
|
||||
|
@ -1148,6 +1153,7 @@ impl Session {
|
|||
webrtcbin,
|
||||
peer_id,
|
||||
cc_info,
|
||||
#[cfg(feature = "v1_22")]
|
||||
rtprtxsend: None,
|
||||
congestion_controller,
|
||||
rtpgccbwe,
|
||||
|
@ -2219,6 +2225,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) => {
|
||||
|
@ -2730,6 +2737,7 @@ impl BaseWebRTCSink {
|
|||
webrtcbin.emit_by_name::<()>("get-stats", &[&None::<gst::Pad>, &promise]);
|
||||
}
|
||||
|
||||
#[cfg(feature = "v1_22")]
|
||||
fn set_rtptrxsend(
|
||||
&self,
|
||||
element: &super::BaseWebRTCSink,
|
||||
|
@ -2743,6 +2751,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();
|
||||
|
|
Loading…
Reference in a new issue