Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RTCRtpCodec #3742

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/web-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,7 @@ RtcPeerConnectionState = []
RtcPriorityType = []
RtcRtcpParameters = []
RtcRtpCapabilities = []
RtcRtpCodec = []
RtcRtpCodecCapability = []
RtcRtpCodecParameters = []
RtcRtpContributingSource = []
Expand Down
96 changes: 96 additions & 0 deletions crates/web-sys/src/features/gen_RtcRtpCodec.rs
Original file line number Diff line number Diff line change
@@ -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()
}
}
9 changes: 6 additions & 3 deletions crates/web-sys/src/features/gen_RtcRtpCodecCapability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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."]
Expand Down Expand Up @@ -91,3 +89,8 @@ impl RtcRtpCodecCapability {
self
}
}
impl Default for RtcRtpCodecCapability {
fn default() -> Self {
Self::new()
}
}
12 changes: 6 additions & 6 deletions crates/web-sys/src/features/gen_RtcRtpCodecParameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand All @@ -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!(
Expand Down
77 changes: 77 additions & 0 deletions crates/web-sys/src/features/gen_RtcRtpEncodingParameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""]
Expand Down Expand Up @@ -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`*"]
Expand Down Expand Up @@ -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`*"]
Expand Down
6 changes: 6 additions & 0 deletions crates/web-sys/src/features/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 7 additions & 9 deletions crates/web-sys/webidls/enabled/RTCRtpSender.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,26 @@ dictionary RTCRtcpParameters {
boolean reducedSize;
};

dictionary RTCRtpCodecParameters {
unsigned short payloadType;
dictionary RTCRtpCodec {
DOMString mimeType;
unsigned long clockRate;
Comment on lines 55 to 56
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, I think these two have to be required after all.
You should take a look yourself and see what causes a breaking change in the API or not.

unsigned short channels = 1;
DOMString sdpFmtpLine;
};

dictionary RTCRtpCodecParameters : RTCRtpCodec {
unsigned short payloadType;
};

dictionary RTCRtpCodecCapability : RTCRtpCodec {};

dictionary RTCRtpParameters {
sequence<RTCRtpEncodingParameters> encodings;
sequence<RTCRtpHeaderExtensionParameters> headerExtensions;
RTCRtcpParameters rtcp;
sequence<RTCRtpCodecParameters> codecs;
};

dictionary RTCRtpCodecCapability {
required DOMString mimeType;
required unsigned long clockRate;
unsigned short channels;
DOMString sdpFmtpLine;
};

dictionary RTCRtpHeaderExtensionCapability {
required DOMString uri;
};
Expand Down
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a newline at the end of this file and the other as well?

Original file line number Diff line number Diff line change
@@ -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;
};
Original file line number Diff line number Diff line change
@@ -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;
};