diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 3879e8b7255..8965d29ac5e 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1098,6 +1098,7 @@ RtcPeerConnectionState = [] RtcPriorityType = [] RtcRtcpParameters = [] RtcRtpCapabilities = [] +RtcRtpCodec = [] RtcRtpCodecCapability = [] RtcRtpCodecParameters = [] RtcRtpContributingSource = [] diff --git a/crates/web-sys/src/features/gen_RtcRtpCodec.rs b/crates/web-sys/src/features/gen_RtcRtpCodec.rs new file mode 100644 index 00000000000..370bf9e49b8 --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcRtpCodec.rs @@ -0,0 +1,96 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCRtpCodec)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RtcRtpCodec` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodec`*"] + pub type RtcRtpCodec; +} +impl RtcRtpCodec { + #[doc = "Construct a new `RtcRtpCodec`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodec`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `channels` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodec`*"] + pub fn channels(&mut self, val: u16) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("channels"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `clockRate` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodec`*"] + pub fn clock_rate(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("clockRate"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `mimeType` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodec`*"] + pub fn mime_type(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("mimeType"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `sdpFmtpLine` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodec`*"] + pub fn sdp_fmtp_line(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("sdpFmtpLine"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for RtcRtpCodec { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs b/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs index 1b8730d70b9..6d71009508f 100644 --- a/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs +++ b/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs @@ -15,11 +15,9 @@ impl RtcRtpCodecCapability { #[doc = "Construct a new `RtcRtpCodecCapability`."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] - pub fn new(clock_rate: u32, mime_type: &str) -> Self { + pub fn new() -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.clock_rate(clock_rate); - ret.mime_type(mime_type); ret } #[doc = "Change the `channels` field of this object."] @@ -91,3 +89,8 @@ impl RtcRtpCodecCapability { self } } +impl Default for RtcRtpCodecCapability { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs b/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs index 35d31c23db6..f3d3bf6b2b9 100644 --- a/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs @@ -71,14 +71,14 @@ impl RtcRtpCodecParameters { let _ = r; self } - #[doc = "Change the `payloadType` field of this object."] + #[doc = "Change the `sdpFmtpLine` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] - pub fn payload_type(&mut self, val: u16) -> &mut Self { + pub fn sdp_fmtp_line(&mut self, val: &str) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( self.as_ref(), - &JsValue::from("payloadType"), + &JsValue::from("sdpFmtpLine"), &JsValue::from(val), ); debug_assert!( @@ -88,14 +88,14 @@ impl RtcRtpCodecParameters { let _ = r; self } - #[doc = "Change the `sdpFmtpLine` field of this object."] + #[doc = "Change the `payloadType` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`*"] - pub fn sdp_fmtp_line(&mut self, val: &str) -> &mut Self { + pub fn payload_type(&mut self, val: u16) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( self.as_ref(), - &JsValue::from("sdpFmtpLine"), + &JsValue::from("payloadType"), &JsValue::from(val), ); debug_assert!( diff --git a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs index a872f8a33f0..a5208f0445d 100644 --- a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs @@ -34,6 +34,45 @@ impl RtcRtpEncodingParameters { let _ = r; self } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `adaptivePtime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn adaptive_ptime(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("adaptivePtime"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "RtcRtpCodec")] + #[doc = "Change the `codec` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodec`, `RtcRtpEncodingParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn codec(&mut self, val: &RtcRtpCodec) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("codec"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } #[cfg(feature = "RtcDegradationPreference")] #[doc = "Change the `degradationPreference` field of this object."] #[doc = ""] @@ -101,6 +140,23 @@ impl RtcRtpEncodingParameters { let _ = r; self } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `ptime` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn ptime(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("ptime"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } #[doc = "Change the `rid` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] @@ -128,6 +184,27 @@ impl RtcRtpEncodingParameters { let _ = r; self } + #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `scalabilityMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn scalability_mode(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("scalabilityMode"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } #[doc = "Change the `scaleResolutionDownBy` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 93d5a0a8aa9..52c6d0ace52 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -6400,6 +6400,12 @@ mod gen_RtcRtpCapabilities; #[cfg(feature = "RtcRtpCapabilities")] pub use gen_RtcRtpCapabilities::*; +#[cfg(feature = "RtcRtpCodec")] +#[allow(non_snake_case)] +mod gen_RtcRtpCodec; +#[cfg(feature = "RtcRtpCodec")] +pub use gen_RtcRtpCodec::*; + #[cfg(feature = "RtcRtpCodecCapability")] #[allow(non_snake_case)] mod gen_RtcRtpCodecCapability; diff --git a/crates/web-sys/webidls/enabled/RTCRtpSender.webidl b/crates/web-sys/webidls/enabled/RTCRtpSender.webidl index fffb4ca175a..dce5da683bd 100644 --- a/crates/web-sys/webidls/enabled/RTCRtpSender.webidl +++ b/crates/web-sys/webidls/enabled/RTCRtpSender.webidl @@ -51,14 +51,19 @@ dictionary RTCRtcpParameters { boolean reducedSize; }; -dictionary RTCRtpCodecParameters { - unsigned short payloadType; +dictionary RTCRtpCodec { DOMString mimeType; unsigned long clockRate; unsigned short channels = 1; DOMString sdpFmtpLine; }; +dictionary RTCRtpCodecParameters : RTCRtpCodec { + unsigned short payloadType; +}; + +dictionary RTCRtpCodecCapability : RTCRtpCodec {}; + dictionary RTCRtpParameters { sequence encodings; sequence headerExtensions; @@ -66,13 +71,6 @@ dictionary RTCRtpParameters { sequence codecs; }; -dictionary RTCRtpCodecCapability { - required DOMString mimeType; - required unsigned long clockRate; - unsigned short channels; - DOMString sdpFmtpLine; -}; - dictionary RTCRtpHeaderExtensionCapability { required DOMString uri; }; diff --git a/crates/web-sys/webidls/unstable/RTCRtpEncodingParametersCodec.webidl b/crates/web-sys/webidls/unstable/RTCRtpEncodingParametersCodec.webidl new file mode 100644 index 00000000000..1d6f1149df2 --- /dev/null +++ b/crates/web-sys/webidls/unstable/RTCRtpEncodingParametersCodec.webidl @@ -0,0 +1,9 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* Source https://w3c.github.io/webrtc-extensions/#rtcrtpencodingparameters + */ + +partial dictionary RTCRtpEncodingParameters { + unsigned long ptime; + boolean adaptivePtime = false; + RTCRtpCodec codec; +}; \ No newline at end of file diff --git a/crates/web-sys/webidls/unstable/RTCRtpEncodingParametersScalabilityMode.webidl b/crates/web-sys/webidls/unstable/RTCRtpEncodingParametersScalabilityMode.webidl new file mode 100644 index 00000000000..2fcfc836e28 --- /dev/null +++ b/crates/web-sys/webidls/unstable/RTCRtpEncodingParametersScalabilityMode.webidl @@ -0,0 +1,7 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* Source https://w3.org/TR/webrtc-svc/#rtcrtpencodingparameters + */ + +partial dictionary RTCRtpEncodingParameters { + DOMString scalabilityMode; +}; \ No newline at end of file