From a50d6a21f9d63d739d606a884179ef06d2bc1e58 Mon Sep 17 00:00:00 2001 From: logist322 Date: Thu, 7 Dec 2023 08:39:37 +0100 Subject: [PATCH 1/6] Init --- crates/web-sys/Cargo.toml | 1 + .../src/features/gen_RtcRtpCapabilities.rs | 59 +++++++++++++++++++ .../web-sys/src/features/gen_RtcRtpSender.rs | 8 +++ crates/web-sys/src/features/mod.rs | 6 ++ .../webidls/enabled/RTCRtpSender.webidl | 7 +++ 5 files changed, 81 insertions(+) create mode 100644 crates/web-sys/src/features/gen_RtcRtpCapabilities.rs diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index baa3d3529c6..bda9552b7f0 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1097,6 +1097,7 @@ RtcPeerConnectionIceEventInit = [] RtcPeerConnectionState = [] RtcPriorityType = [] RtcRtcpParameters = [] +RtcRtpCapabilities = [] RtcRtpCodecParameters = [] RtcRtpContributingSource = [] RtcRtpEncodingParameters = [] diff --git a/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs b/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs new file mode 100644 index 00000000000..1b9327bf4ad --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs @@ -0,0 +1,59 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCRtpCapabilities)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RtcRtpCapabilities` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] + pub type RtcRtpCapabilities; +} +impl RtcRtpCapabilities { + #[doc = "Construct a new `RtcRtpCapabilities`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `codecs` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] + pub fn codecs(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("codecs"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `headerExtensions` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] + pub fn header_extensions(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("headerExtensions"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for RtcRtpCapabilities { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_RtcRtpSender.rs b/crates/web-sys/src/features/gen_RtcRtpSender.rs index 714521c0d3e..0d00be4c316 100644 --- a/crates/web-sys/src/features/gen_RtcRtpSender.rs +++ b/crates/web-sys/src/features/gen_RtcRtpSender.rs @@ -28,6 +28,14 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpSender`, `RtcdtmfSender`*"] pub fn dtmf(this: &RtcRtpSender) -> Option; + #[cfg(feature = "RtcRtpCapabilities")] + # [wasm_bindgen (method , structural , js_class = "RTCRtpSender" , js_name = getCapabilities)] + #[doc = "The `getCapabilities()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/getCapabilities)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`, `RtcRtpSender`*"] + pub fn get_capabilities(this: &RtcRtpSender, kind: &str) -> RtcRtpCapabilities; #[cfg(feature = "RtcRtpParameters")] # [wasm_bindgen (method , structural , js_class = "RTCRtpSender" , js_name = getParameters)] #[doc = "The `getParameters()` method."] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 8333053be51..adf2be08116 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -6394,6 +6394,12 @@ mod gen_RtcRtcpParameters; #[cfg(feature = "RtcRtcpParameters")] pub use gen_RtcRtcpParameters::*; +#[cfg(feature = "RtcRtpCapabilities")] +#[allow(non_snake_case)] +mod gen_RtcRtpCapabilities; +#[cfg(feature = "RtcRtpCapabilities")] +pub use gen_RtcRtpCapabilities::*; + #[cfg(feature = "RtcRtpCodecParameters")] #[allow(non_snake_case)] mod gen_RtcRtpCodecParameters; diff --git a/crates/web-sys/webidls/enabled/RTCRtpSender.webidl b/crates/web-sys/webidls/enabled/RTCRtpSender.webidl index 3b1c49c7bc2..6db399b796d 100644 --- a/crates/web-sys/webidls/enabled/RTCRtpSender.webidl +++ b/crates/web-sys/webidls/enabled/RTCRtpSender.webidl @@ -38,6 +38,7 @@ dictionary RTCRtpEncodingParameters { RTCDegradationPreference degradationPreference = "balanced"; DOMString rid; float scaleResolutionDownBy = 1.0; + codec RTCRtpCodecParameters; }; dictionary RTCRtpHeaderExtensionParameters { @@ -66,6 +67,11 @@ dictionary RTCRtpParameters { sequence codecs; }; +dictionary RTCRtpCapabilities { + sequence codecs; + sequence headerExtensions; +}; + [Pref="media.peerconnection.enabled", JSImplementation="@mozilla.org/dom/rtpsender;1"] interface RTCRtpSender { @@ -74,6 +80,7 @@ interface RTCRtpSender { RTCRtpParameters getParameters(); Promise replaceTrack(MediaStreamTrack? withTrack); Promise getStats(); + RTCRtpCapabilities getCapabilities(DOMString kind); [Pref="media.peerconnection.dtmf.enabled"] readonly attribute RTCDTMFSender? dtmf; // Ugh, can't use a ChromeOnly attribute sequence... From 35831b756e9a671cf77d14729dae7057665fa70c Mon Sep 17 00:00:00 2001 From: logist322 Date: Thu, 7 Dec 2023 09:24:22 +0100 Subject: [PATCH 2/6] Fix --- .../features/gen_RtcRtpEncodingParameters.rs | 31 +++++++++++++++++++ .../webidls/enabled/RTCRtpSender.webidl | 3 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs index a872f8a33f0..274b38f90f8 100644 --- a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs @@ -34,6 +34,20 @@ impl RtcRtpEncodingParameters { let _ = r; self } + #[cfg(feature = "RtcRtpCodecParameters")] + #[doc = "Change the `codec` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`, `RtcRtpEncodingParameters`*"] + pub fn codec(&mut self, val: &RtcRtpCodecParameters) -> &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 = ""] @@ -128,6 +142,23 @@ impl RtcRtpEncodingParameters { let _ = r; self } + #[doc = "Change the `scalabilityMode` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] + 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/webidls/enabled/RTCRtpSender.webidl b/crates/web-sys/webidls/enabled/RTCRtpSender.webidl index 6db399b796d..2ca5419641c 100644 --- a/crates/web-sys/webidls/enabled/RTCRtpSender.webidl +++ b/crates/web-sys/webidls/enabled/RTCRtpSender.webidl @@ -38,7 +38,8 @@ dictionary RTCRtpEncodingParameters { RTCDegradationPreference degradationPreference = "balanced"; DOMString rid; float scaleResolutionDownBy = 1.0; - codec RTCRtpCodecParameters; + DOMString scalabilityMode; + RTCRtpCodecParameters codec; }; dictionary RTCRtpHeaderExtensionParameters { From 6f98526cf52de3a0560f0c17c20306454d110af2 Mon Sep 17 00:00:00 2001 From: logist322 Date: Thu, 7 Dec 2023 09:37:08 +0100 Subject: [PATCH 3/6] WIP --- crates/web-sys/src/features/gen_RtcRtpSender.rs | 4 ++-- crates/web-sys/webidls/enabled/RTCRtpSender.webidl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/web-sys/src/features/gen_RtcRtpSender.rs b/crates/web-sys/src/features/gen_RtcRtpSender.rs index 0d00be4c316..59fc6917350 100644 --- a/crates/web-sys/src/features/gen_RtcRtpSender.rs +++ b/crates/web-sys/src/features/gen_RtcRtpSender.rs @@ -29,13 +29,13 @@ extern "C" { #[doc = "*This API requires the following crate features to be activated: `RtcRtpSender`, `RtcdtmfSender`*"] pub fn dtmf(this: &RtcRtpSender) -> Option; #[cfg(feature = "RtcRtpCapabilities")] - # [wasm_bindgen (method , structural , js_class = "RTCRtpSender" , js_name = getCapabilities)] + # [wasm_bindgen (static_method_of = RtcRtpSender , js_class = "RTCRtpSender" , js_name = getCapabilities)] #[doc = "The `getCapabilities()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/getCapabilities)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`, `RtcRtpSender`*"] - pub fn get_capabilities(this: &RtcRtpSender, kind: &str) -> RtcRtpCapabilities; + pub fn get_capabilities(kind: &str) -> RtcRtpCapabilities; #[cfg(feature = "RtcRtpParameters")] # [wasm_bindgen (method , structural , js_class = "RTCRtpSender" , js_name = getParameters)] #[doc = "The `getParameters()` method."] diff --git a/crates/web-sys/webidls/enabled/RTCRtpSender.webidl b/crates/web-sys/webidls/enabled/RTCRtpSender.webidl index 2ca5419641c..fb128066fa0 100644 --- a/crates/web-sys/webidls/enabled/RTCRtpSender.webidl +++ b/crates/web-sys/webidls/enabled/RTCRtpSender.webidl @@ -81,7 +81,7 @@ interface RTCRtpSender { RTCRtpParameters getParameters(); Promise replaceTrack(MediaStreamTrack? withTrack); Promise getStats(); - RTCRtpCapabilities getCapabilities(DOMString kind); + static RTCRtpCapabilities getCapabilities(DOMString kind); [Pref="media.peerconnection.dtmf.enabled"] readonly attribute RTCDTMFSender? dtmf; // Ugh, can't use a ChromeOnly attribute sequence... From 75847e9f1625af3608063727a85bdb138986a15c Mon Sep 17 00:00:00 2001 From: logist322 Date: Thu, 7 Dec 2023 11:48:41 +0100 Subject: [PATCH 4/6] Add CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a246ee6f2f..3cf57403135 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ ### Added +* Add bindings for `RTCRtpSender.getCapabilities(DOMString)` method, `RTCRtpCapabilities` dictionary, `RTCRtpEncodingParameters.codec` and `RTCRtpEncodingParameters.scalabilityMode` fields. + [#3737](https://github.com/rustwasm/wasm-bindgen/pull/3737) + * Add bindings for `UserActivation`. [#3719](https://github.com/rustwasm/wasm-bindgen/pull/3719) From 2f1ce25ac47294e331954d5855934f1215d98d8f Mon Sep 17 00:00:00 2001 From: logist322 Date: Fri, 8 Dec 2023 17:17:38 +0100 Subject: [PATCH 5/6] Fix --- crates/web-sys/Cargo.toml | 2 + .../src/features/gen_RtcRtpCapabilities.rs | 12 +-- .../src/features/gen_RtcRtpCodecCapability.rs | 93 +++++++++++++++++++ .../features/gen_RtcRtpEncodingParameters.rs | 31 ------- .../gen_RtcRtpHeaderExtensionCapability.rs | 37 ++++++++ .../web-sys/src/features/gen_RtcRtpSender.rs | 2 +- crates/web-sys/src/features/mod.rs | 12 +++ .../webidls/enabled/RTCRtpSender.webidl | 19 +++- 8 files changed, 165 insertions(+), 43 deletions(-) create mode 100644 crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs create mode 100644 crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index bda9552b7f0..3879e8b7255 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -1098,9 +1098,11 @@ RtcPeerConnectionState = [] RtcPriorityType = [] RtcRtcpParameters = [] RtcRtpCapabilities = [] +RtcRtpCodecCapability = [] RtcRtpCodecParameters = [] RtcRtpContributingSource = [] RtcRtpEncodingParameters = [] +RtcRtpHeaderExtensionCapability = [] RtcRtpHeaderExtensionParameters = [] RtcRtpParameters = [] RtcRtpReceiver = [] diff --git a/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs b/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs index 1b9327bf4ad..872d90d0bd6 100644 --- a/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs +++ b/crates/web-sys/src/features/gen_RtcRtpCapabilities.rs @@ -15,9 +15,14 @@ impl RtcRtpCapabilities { #[doc = "Construct a new `RtcRtpCapabilities`."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`*"] - pub fn new() -> Self { + pub fn new( + codecs: &::wasm_bindgen::JsValue, + header_extensions: &::wasm_bindgen::JsValue, + ) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.codecs(codecs); + ret.header_extensions(header_extensions); ret } #[doc = "Change the `codecs` field of this object."] @@ -52,8 +57,3 @@ impl RtcRtpCapabilities { self } } -impl Default for RtcRtpCapabilities { - 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 new file mode 100644 index 00000000000..1b8730d70b9 --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs @@ -0,0 +1,93 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCRtpCodecCapability)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RtcRtpCodecCapability` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] + pub type RtcRtpCodecCapability; +} +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 { + #[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."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecCapability`*"] + 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: `RtcRtpCodecCapability`*"] + 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: `RtcRtpCodecCapability`*"] + 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: `RtcRtpCodecCapability`*"] + 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 + } +} diff --git a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs index 274b38f90f8..a872f8a33f0 100644 --- a/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs +++ b/crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs @@ -34,20 +34,6 @@ impl RtcRtpEncodingParameters { let _ = r; self } - #[cfg(feature = "RtcRtpCodecParameters")] - #[doc = "Change the `codec` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpCodecParameters`, `RtcRtpEncodingParameters`*"] - pub fn codec(&mut self, val: &RtcRtpCodecParameters) -> &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 = ""] @@ -142,23 +128,6 @@ impl RtcRtpEncodingParameters { let _ = r; self } - #[doc = "Change the `scalabilityMode` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `RtcRtpEncodingParameters`*"] - 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/gen_RtcRtpHeaderExtensionCapability.rs b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs new file mode 100644 index 00000000000..de9ec55990f --- /dev/null +++ b/crates/web-sys/src/features/gen_RtcRtpHeaderExtensionCapability.rs @@ -0,0 +1,37 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCRtpHeaderExtensionCapability)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `RtcRtpHeaderExtensionCapability` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionCapability`*"] + pub type RtcRtpHeaderExtensionCapability; +} +impl RtcRtpHeaderExtensionCapability { + #[doc = "Construct a new `RtcRtpHeaderExtensionCapability`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionCapability`*"] + pub fn new(uri: &str) -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.uri(uri); + ret + } + #[doc = "Change the `uri` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `RtcRtpHeaderExtensionCapability`*"] + pub fn uri(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("uri"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} diff --git a/crates/web-sys/src/features/gen_RtcRtpSender.rs b/crates/web-sys/src/features/gen_RtcRtpSender.rs index 59fc6917350..8cdd9d5d66b 100644 --- a/crates/web-sys/src/features/gen_RtcRtpSender.rs +++ b/crates/web-sys/src/features/gen_RtcRtpSender.rs @@ -35,7 +35,7 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/getCapabilities)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `RtcRtpCapabilities`, `RtcRtpSender`*"] - pub fn get_capabilities(kind: &str) -> RtcRtpCapabilities; + pub fn get_capabilities(kind: &str) -> Option; #[cfg(feature = "RtcRtpParameters")] # [wasm_bindgen (method , structural , js_class = "RTCRtpSender" , js_name = getParameters)] #[doc = "The `getParameters()` method."] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index adf2be08116..93d5a0a8aa9 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 = "RtcRtpCodecCapability")] +#[allow(non_snake_case)] +mod gen_RtcRtpCodecCapability; +#[cfg(feature = "RtcRtpCodecCapability")] +pub use gen_RtcRtpCodecCapability::*; + #[cfg(feature = "RtcRtpCodecParameters")] #[allow(non_snake_case)] mod gen_RtcRtpCodecParameters; @@ -6418,6 +6424,12 @@ mod gen_RtcRtpEncodingParameters; #[cfg(feature = "RtcRtpEncodingParameters")] pub use gen_RtcRtpEncodingParameters::*; +#[cfg(feature = "RtcRtpHeaderExtensionCapability")] +#[allow(non_snake_case)] +mod gen_RtcRtpHeaderExtensionCapability; +#[cfg(feature = "RtcRtpHeaderExtensionCapability")] +pub use gen_RtcRtpHeaderExtensionCapability::*; + #[cfg(feature = "RtcRtpHeaderExtensionParameters")] #[allow(non_snake_case)] mod gen_RtcRtpHeaderExtensionParameters; diff --git a/crates/web-sys/webidls/enabled/RTCRtpSender.webidl b/crates/web-sys/webidls/enabled/RTCRtpSender.webidl index fb128066fa0..fffb4ca175a 100644 --- a/crates/web-sys/webidls/enabled/RTCRtpSender.webidl +++ b/crates/web-sys/webidls/enabled/RTCRtpSender.webidl @@ -38,8 +38,6 @@ dictionary RTCRtpEncodingParameters { RTCDegradationPreference degradationPreference = "balanced"; DOMString rid; float scaleResolutionDownBy = 1.0; - DOMString scalabilityMode; - RTCRtpCodecParameters codec; }; dictionary RTCRtpHeaderExtensionParameters { @@ -68,9 +66,20 @@ dictionary RTCRtpParameters { sequence codecs; }; +dictionary RTCRtpCodecCapability { + required DOMString mimeType; + required unsigned long clockRate; + unsigned short channels; + DOMString sdpFmtpLine; +}; + +dictionary RTCRtpHeaderExtensionCapability { + required DOMString uri; +}; + dictionary RTCRtpCapabilities { - sequence codecs; - sequence headerExtensions; + required sequence codecs; + required sequence headerExtensions; }; [Pref="media.peerconnection.enabled", @@ -81,7 +90,7 @@ interface RTCRtpSender { RTCRtpParameters getParameters(); Promise replaceTrack(MediaStreamTrack? withTrack); Promise getStats(); - static RTCRtpCapabilities getCapabilities(DOMString kind); + static RTCRtpCapabilities? getCapabilities(DOMString kind); [Pref="media.peerconnection.dtmf.enabled"] readonly attribute RTCDTMFSender? dtmf; // Ugh, can't use a ChromeOnly attribute sequence... From 6184e3fda90694d01bc4fda8c2b5144b9e269677 Mon Sep 17 00:00:00 2001 From: logist322 Date: Fri, 8 Dec 2023 17:21:44 +0100 Subject: [PATCH 6/6] Fix CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cf57403135..f83e91261fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ ### Added -* Add bindings for `RTCRtpSender.getCapabilities(DOMString)` method, `RTCRtpCapabilities` dictionary, `RTCRtpEncodingParameters.codec` and `RTCRtpEncodingParameters.scalabilityMode` fields. +* Add bindings for `RTCRtpSender.getCapabilities(DOMString)` method, `RTCRtpCapabilities`, `RTCRtpCodecCapability` and `RTCRtpHeaderExtensionCapability`. [#3737](https://github.com/rustwasm/wasm-bindgen/pull/3737) * Add bindings for `UserActivation`.