script/dom/webrtc/
rtcrtpsender.rs1use std::rc::Rc;
6
7use dom_struct::dom_struct;
8use js::context::JSContext;
9use script_bindings::reflector::{Reflector, reflect_dom_object_with_cx};
10
11use crate::dom::bindings::codegen::Bindings::RTCRtpSenderBinding::{
12 RTCRtcpParameters, RTCRtpParameters, RTCRtpSendParameters, RTCRtpSenderMethods,
13};
14use crate::dom::bindings::reflector::DomGlobal;
15use crate::dom::bindings::root::DomRoot;
16use crate::dom::bindings::str::DOMString;
17use crate::dom::globalscope::GlobalScope;
18use crate::dom::promise::Promise;
19
20#[dom_struct]
21pub(crate) struct RTCRtpSender {
22 reflector_: Reflector,
23}
24
25impl RTCRtpSender {
26 fn new_inherited() -> Self {
27 Self {
28 reflector_: Reflector::new(),
29 }
30 }
31
32 pub(crate) fn new(cx: &mut JSContext, global: &GlobalScope) -> DomRoot<Self> {
33 reflect_dom_object_with_cx(Box::new(Self::new_inherited()), global, cx)
34 }
35}
36
37impl RTCRtpSenderMethods<crate::DomTypeHolder> for RTCRtpSender {
38 fn GetParameters(&self) -> RTCRtpSendParameters {
40 RTCRtpSendParameters {
41 parent: RTCRtpParameters {
42 headerExtensions: vec![],
43 rtcp: RTCRtcpParameters {
44 cname: None,
45 reducedSize: None,
46 },
47 codecs: vec![],
48 },
49 transactionId: DOMString::new(),
50 encodings: vec![],
51 }
52 }
53
54 fn SetParameters(&self, cx: &mut JSContext, _parameters: &RTCRtpSendParameters) -> Rc<Promise> {
56 Promise::new_resolved(cx, &self.global(), ())
57 }
58}