@gjsify/webrtc 0.3.13 → 0.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/get-user-media.js +95 -80
- package/lib/esm/gst-enum-maps.js +55 -59
- package/lib/esm/gst-init.js +19 -22
- package/lib/esm/gst-stats-parser.js +94 -67
- package/lib/esm/gst-utils.js +24 -13
- package/lib/esm/index.js +13 -43
- package/lib/esm/media-device-info.js +23 -22
- package/lib/esm/media-devices.js +150 -139
- package/lib/esm/media-stream-track.js +136 -139
- package/lib/esm/media-stream.js +76 -75
- package/lib/esm/register/data-channel.js +7 -3
- package/lib/esm/register/error.js +6 -2
- package/lib/esm/register/media-devices.js +6 -2
- package/lib/esm/register/media.js +8 -4
- package/lib/esm/register/peer-connection.js +9 -5
- package/lib/esm/rtc-certificate.js +62 -66
- package/lib/esm/rtc-data-channel.js +240 -251
- package/lib/esm/rtc-dtls-transport.js +40 -39
- package/lib/esm/rtc-dtmf-sender.js +92 -100
- package/lib/esm/rtc-error.js +24 -22
- package/lib/esm/rtc-events.js +33 -33
- package/lib/esm/rtc-ice-candidate.js +71 -72
- package/lib/esm/rtc-ice-transport.js +95 -94
- package/lib/esm/rtc-peer-connection.js +796 -845
- package/lib/esm/rtc-rtp-receiver.js +89 -87
- package/lib/esm/rtc-rtp-sender.js +282 -290
- package/lib/esm/rtc-rtp-transceiver.js +92 -93
- package/lib/esm/rtc-sctp-transport.js +38 -38
- package/lib/esm/rtc-session-description.js +47 -51
- package/lib/esm/rtc-stats-report.js +39 -34
- package/lib/esm/rtc-track-event.js +29 -27
- package/lib/esm/rtp-capabilities.js +81 -35
- package/lib/esm/tee-multiplexer.js +58 -60
- package/lib/esm/wpt-helpers.js +128 -112
- package/package.json +13 -13
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,97 +1,96 @@
|
|
|
1
1
|
import { gstDirectionToW3C, w3cDirectionToGst } from "./gst-enum-maps.js";
|
|
2
2
|
import { RTCRtpSender } from "./rtc-rtp-sender.js";
|
|
3
3
|
import { RTCRtpReceiver } from "./rtc-rtp-receiver.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
export {
|
|
96
|
-
RTCRtpTransceiver
|
|
4
|
+
|
|
5
|
+
//#region src/rtc-rtp-transceiver.ts
|
|
6
|
+
var RTCRtpTransceiver = class {
|
|
7
|
+
_gstTrans;
|
|
8
|
+
sender;
|
|
9
|
+
receiver;
|
|
10
|
+
_stopped = false;
|
|
11
|
+
_codecPreferences = [];
|
|
12
|
+
constructor(gstTrans, sender, receiver) {
|
|
13
|
+
this._gstTrans = gstTrans;
|
|
14
|
+
this.sender = sender;
|
|
15
|
+
this.receiver = receiver;
|
|
16
|
+
}
|
|
17
|
+
get mid() {
|
|
18
|
+
if (this._stopped) return null;
|
|
19
|
+
const m = this._gstTrans.mid;
|
|
20
|
+
return m === "" || m == null ? null : String(m);
|
|
21
|
+
}
|
|
22
|
+
get direction() {
|
|
23
|
+
if (this._stopped) return "stopped";
|
|
24
|
+
return gstDirectionToW3C(this._gstTrans.direction);
|
|
25
|
+
}
|
|
26
|
+
set direction(d) {
|
|
27
|
+
if (this._stopped) {
|
|
28
|
+
throw new DOMException("Cannot set direction on a stopped transceiver", "InvalidStateError");
|
|
29
|
+
}
|
|
30
|
+
if (d === "stopped") {
|
|
31
|
+
throw new TypeError("The provided value 'stopped' is not a valid enum value of type RTCRtpTransceiverDirection.");
|
|
32
|
+
}
|
|
33
|
+
const valid = [
|
|
34
|
+
"sendrecv",
|
|
35
|
+
"sendonly",
|
|
36
|
+
"recvonly",
|
|
37
|
+
"inactive"
|
|
38
|
+
];
|
|
39
|
+
if (!valid.includes(d)) {
|
|
40
|
+
throw new TypeError(`The provided value '${d}' is not a valid enum value of type RTCRtpTransceiverDirection.`);
|
|
41
|
+
}
|
|
42
|
+
this._gstTrans.direction = w3cDirectionToGst(d);
|
|
43
|
+
}
|
|
44
|
+
get currentDirection() {
|
|
45
|
+
if (this._stopped) return null;
|
|
46
|
+
const cd = this._gstTrans.current_direction ?? this._gstTrans.currentDirection;
|
|
47
|
+
if (cd == null) return null;
|
|
48
|
+
const w3c = gstDirectionToW3C(cd);
|
|
49
|
+
return w3c === "inactive" ? null : w3c;
|
|
50
|
+
}
|
|
51
|
+
get stopped() {
|
|
52
|
+
return this._stopped;
|
|
53
|
+
}
|
|
54
|
+
stop() {
|
|
55
|
+
if (this._stopped) return;
|
|
56
|
+
this._stopped = true;
|
|
57
|
+
}
|
|
58
|
+
setCodecPreferences(codecs) {
|
|
59
|
+
if (!Array.isArray(codecs)) {
|
|
60
|
+
throw new TypeError("codecs must be an array");
|
|
61
|
+
}
|
|
62
|
+
if (codecs.length === 0) {
|
|
63
|
+
this._codecPreferences = [];
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const kind = this.receiver.track.kind;
|
|
67
|
+
const recvCaps = RTCRtpReceiver.getCapabilities(kind);
|
|
68
|
+
const sendCaps = RTCRtpSender.getCapabilities(kind);
|
|
69
|
+
if (!recvCaps || !sendCaps) {
|
|
70
|
+
throw new DOMException("No capabilities available", "InvalidModificationError");
|
|
71
|
+
}
|
|
72
|
+
const allCaps = [...recvCaps.codecs, ...sendCaps.codecs];
|
|
73
|
+
for (const codec of codecs) {
|
|
74
|
+
if (!codec || typeof codec !== "object") {
|
|
75
|
+
throw new TypeError("Each codec must be an object");
|
|
76
|
+
}
|
|
77
|
+
if (typeof codec.mimeType !== "string" || typeof codec.clockRate !== "number") {
|
|
78
|
+
throw new TypeError("codec must have mimeType (string) and clockRate (number)");
|
|
79
|
+
}
|
|
80
|
+
const isResiliency = /\/(rtx|red|ulpfec)$/i.test(codec.mimeType);
|
|
81
|
+
if (isResiliency) continue;
|
|
82
|
+
const match = allCaps.find((c) => c.mimeType.toLowerCase() === codec.mimeType.toLowerCase() && c.clockRate === codec.clockRate && (codec.channels === undefined || c.channels === codec.channels) && (codec.sdpFmtpLine === undefined || c.sdpFmtpLine === codec.sdpFmtpLine));
|
|
83
|
+
if (!match) {
|
|
84
|
+
throw new DOMException(`Codec ${codec.mimeType} ${codec.clockRate} is not in capabilities`, "InvalidModificationError");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
this._codecPreferences = [...codecs];
|
|
88
|
+
}
|
|
89
|
+
/** @internal */
|
|
90
|
+
get _nativeTransceiver() {
|
|
91
|
+
return this._gstTrans;
|
|
92
|
+
}
|
|
97
93
|
};
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
export { RTCRtpTransceiver };
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import "@gjsify/dom-events/register/event-target";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
RTCSctpTransport
|
|
2
|
+
|
|
3
|
+
//#region src/rtc-sctp-transport.ts
|
|
4
|
+
var RTCSctpTransport = class extends EventTarget {
|
|
5
|
+
transport;
|
|
6
|
+
_state = "connecting";
|
|
7
|
+
_maxMessageSize = 262144;
|
|
8
|
+
_maxChannels = 65535;
|
|
9
|
+
_onstatechange = null;
|
|
10
|
+
constructor(dtlsTransport) {
|
|
11
|
+
super();
|
|
12
|
+
this.transport = dtlsTransport;
|
|
13
|
+
}
|
|
14
|
+
get state() {
|
|
15
|
+
return this._state;
|
|
16
|
+
}
|
|
17
|
+
get maxMessageSize() {
|
|
18
|
+
return this._maxMessageSize;
|
|
19
|
+
}
|
|
20
|
+
get maxChannels() {
|
|
21
|
+
return this._maxChannels;
|
|
22
|
+
}
|
|
23
|
+
get onstatechange() {
|
|
24
|
+
return this._onstatechange;
|
|
25
|
+
}
|
|
26
|
+
set onstatechange(v) {
|
|
27
|
+
this._onstatechange = v;
|
|
28
|
+
}
|
|
29
|
+
/** @internal */
|
|
30
|
+
_setState(state) {
|
|
31
|
+
if (this._state === state) return;
|
|
32
|
+
this._state = state;
|
|
33
|
+
const ev = new Event("statechange");
|
|
34
|
+
this._onstatechange?.call(this, ev);
|
|
35
|
+
this.dispatchEvent(ev);
|
|
36
|
+
}
|
|
40
37
|
};
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { RTCSctpTransport };
|
|
@@ -1,57 +1,53 @@
|
|
|
1
|
-
import GstSdp from "gi://GstSdp?version=1.0";
|
|
2
1
|
import GstWebRTC from "gi://GstWebRTC?version=1.0";
|
|
2
|
+
import GstSdp from "gi://GstSdp?version=1.0";
|
|
3
|
+
|
|
4
|
+
//#region src/rtc-session-description.ts
|
|
3
5
|
function sdpTypeToGst(type) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return GstWebRTC.WebRTCSDPType.ANSWER;
|
|
11
|
-
case "rollback":
|
|
12
|
-
return GstWebRTC.WebRTCSDPType.ROLLBACK;
|
|
13
|
-
}
|
|
6
|
+
switch (type) {
|
|
7
|
+
case "offer": return GstWebRTC.WebRTCSDPType.OFFER;
|
|
8
|
+
case "pranswer": return GstWebRTC.WebRTCSDPType.PRANSWER;
|
|
9
|
+
case "answer": return GstWebRTC.WebRTCSDPType.ANSWER;
|
|
10
|
+
case "rollback": return GstWebRTC.WebRTCSDPType.ROLLBACK;
|
|
11
|
+
}
|
|
14
12
|
}
|
|
15
13
|
function sdpTypeFromGst(type) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
case GstWebRTC.WebRTCSDPType.ROLLBACK:
|
|
24
|
-
return "rollback";
|
|
25
|
-
default:
|
|
26
|
-
return "offer";
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
class RTCSessionDescription {
|
|
30
|
-
type;
|
|
31
|
-
sdp;
|
|
32
|
-
constructor(init) {
|
|
33
|
-
this.type = init?.type ?? "offer";
|
|
34
|
-
this.sdp = init?.sdp ?? "";
|
|
35
|
-
}
|
|
36
|
-
toJSON() {
|
|
37
|
-
return { type: this.type, sdp: this.sdp };
|
|
38
|
-
}
|
|
39
|
-
/** Build a GstWebRTC.WebRTCSessionDescription for use with webrtcbin signals. */
|
|
40
|
-
toGstDesc() {
|
|
41
|
-
const [ret, sdp] = GstSdp.SDPMessage.new_from_text(this.sdp);
|
|
42
|
-
if (ret !== GstSdp.SDPResult.OK) {
|
|
43
|
-
throw new Error(`Failed to parse SDP text (GstSDPResult=${ret})`);
|
|
44
|
-
}
|
|
45
|
-
return GstWebRTC.WebRTCSessionDescription.new(sdpTypeToGst(this.type), sdp);
|
|
46
|
-
}
|
|
47
|
-
static fromGstDesc(desc) {
|
|
48
|
-
const sdpText = desc.sdp?.as_text?.() ?? "";
|
|
49
|
-
return new RTCSessionDescription({
|
|
50
|
-
type: sdpTypeFromGst(desc.type),
|
|
51
|
-
sdp: sdpText
|
|
52
|
-
});
|
|
53
|
-
}
|
|
14
|
+
switch (type) {
|
|
15
|
+
case GstWebRTC.WebRTCSDPType.OFFER: return "offer";
|
|
16
|
+
case GstWebRTC.WebRTCSDPType.PRANSWER: return "pranswer";
|
|
17
|
+
case GstWebRTC.WebRTCSDPType.ANSWER: return "answer";
|
|
18
|
+
case GstWebRTC.WebRTCSDPType.ROLLBACK: return "rollback";
|
|
19
|
+
default: return "offer";
|
|
20
|
+
}
|
|
54
21
|
}
|
|
55
|
-
|
|
56
|
-
|
|
22
|
+
var RTCSessionDescription = class RTCSessionDescription {
|
|
23
|
+
type;
|
|
24
|
+
sdp;
|
|
25
|
+
constructor(init) {
|
|
26
|
+
this.type = init?.type ?? "offer";
|
|
27
|
+
this.sdp = init?.sdp ?? "";
|
|
28
|
+
}
|
|
29
|
+
toJSON() {
|
|
30
|
+
return {
|
|
31
|
+
type: this.type,
|
|
32
|
+
sdp: this.sdp
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** Build a GstWebRTC.WebRTCSessionDescription for use with webrtcbin signals. */
|
|
36
|
+
toGstDesc() {
|
|
37
|
+
const [ret, sdp] = GstSdp.SDPMessage.new_from_text(this.sdp);
|
|
38
|
+
if (ret !== GstSdp.SDPResult.OK) {
|
|
39
|
+
throw new Error(`Failed to parse SDP text (GstSDPResult=${ret})`);
|
|
40
|
+
}
|
|
41
|
+
return GstWebRTC.WebRTCSessionDescription.new(sdpTypeToGst(this.type), sdp);
|
|
42
|
+
}
|
|
43
|
+
static fromGstDesc(desc) {
|
|
44
|
+
const sdpText = desc.sdp?.as_text?.() ?? "";
|
|
45
|
+
return new RTCSessionDescription({
|
|
46
|
+
type: sdpTypeFromGst(desc.type),
|
|
47
|
+
sdp: sdpText
|
|
48
|
+
});
|
|
49
|
+
}
|
|
57
50
|
};
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export { RTCSessionDescription };
|
|
@@ -1,35 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
//#region src/rtc-stats-report.ts
|
|
2
|
+
/**
|
|
3
|
+
* Read-only Map-like collection of stats entries keyed by id.
|
|
4
|
+
* W3C requires iteration support but not mutation.
|
|
5
|
+
*/
|
|
6
|
+
var RTCStatsReport = class {
|
|
7
|
+
_map;
|
|
8
|
+
constructor(entries) {
|
|
9
|
+
this._map = new Map(entries);
|
|
10
|
+
}
|
|
11
|
+
get size() {
|
|
12
|
+
return this._map.size;
|
|
13
|
+
}
|
|
14
|
+
get(key) {
|
|
15
|
+
return this._map.get(key);
|
|
16
|
+
}
|
|
17
|
+
has(key) {
|
|
18
|
+
return this._map.has(key);
|
|
19
|
+
}
|
|
20
|
+
forEach(callbackfn, thisArg) {
|
|
21
|
+
this._map.forEach((value, key) => {
|
|
22
|
+
callbackfn.call(thisArg, value, key, this);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
entries() {
|
|
26
|
+
return this._map.entries();
|
|
27
|
+
}
|
|
28
|
+
keys() {
|
|
29
|
+
return this._map.keys();
|
|
30
|
+
}
|
|
31
|
+
values() {
|
|
32
|
+
return this._map.values();
|
|
33
|
+
}
|
|
34
|
+
[Symbol.iterator]() {
|
|
35
|
+
return this._map.entries();
|
|
36
|
+
}
|
|
35
37
|
};
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { RTCStatsReport };
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import "@gjsify/dom-events/register/event-target";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
RTCTrackEvent
|
|
2
|
+
|
|
3
|
+
//#region src/rtc-track-event.ts
|
|
4
|
+
var RTCTrackEvent = class extends Event {
|
|
5
|
+
receiver;
|
|
6
|
+
track;
|
|
7
|
+
streams;
|
|
8
|
+
transceiver;
|
|
9
|
+
constructor(type, init) {
|
|
10
|
+
super(type, init);
|
|
11
|
+
if (!init || typeof init !== "object") {
|
|
12
|
+
throw new TypeError("RTCTrackEventInit is required");
|
|
13
|
+
}
|
|
14
|
+
if (!("receiver" in init)) {
|
|
15
|
+
throw new TypeError("Failed to construct 'RTCTrackEvent': required member receiver is not provided.");
|
|
16
|
+
}
|
|
17
|
+
if (!("track" in init)) {
|
|
18
|
+
throw new TypeError("Failed to construct 'RTCTrackEvent': required member track is not provided.");
|
|
19
|
+
}
|
|
20
|
+
if (!("transceiver" in init)) {
|
|
21
|
+
throw new TypeError("Failed to construct 'RTCTrackEvent': required member transceiver is not provided.");
|
|
22
|
+
}
|
|
23
|
+
this.receiver = init.receiver;
|
|
24
|
+
this.track = init.track;
|
|
25
|
+
this.streams = Object.freeze(init.streams ? [...init.streams] : []);
|
|
26
|
+
this.transceiver = init.transceiver;
|
|
27
|
+
}
|
|
29
28
|
};
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { RTCTrackEvent };
|
|
@@ -1,41 +1,87 @@
|
|
|
1
|
+
//#region src/rtp-capabilities.ts
|
|
1
2
|
const AUDIO_CAPABILITIES = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
codecs: [
|
|
4
|
+
{
|
|
5
|
+
mimeType: "audio/opus",
|
|
6
|
+
clockRate: 48e3,
|
|
7
|
+
channels: 2,
|
|
8
|
+
sdpFmtpLine: "minptime=10;useinbandfec=1"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
mimeType: "audio/G722",
|
|
12
|
+
clockRate: 8e3,
|
|
13
|
+
channels: 1
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
mimeType: "audio/PCMU",
|
|
17
|
+
clockRate: 8e3,
|
|
18
|
+
channels: 1
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
mimeType: "audio/PCMA",
|
|
22
|
+
clockRate: 8e3,
|
|
23
|
+
channels: 1
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
mimeType: "audio/telephone-event",
|
|
27
|
+
clockRate: 8e3,
|
|
28
|
+
channels: 1
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
mimeType: "audio/red",
|
|
32
|
+
clockRate: 48e3,
|
|
33
|
+
channels: 2
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
headerExtensions: [
|
|
37
|
+
{ uri: "urn:ietf:params:rtp-hdrext:ssrc-audio-level" },
|
|
38
|
+
{ uri: "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time" },
|
|
39
|
+
{ uri: "urn:ietf:params:rtp-hdrext:sdes:mid" }
|
|
40
|
+
]
|
|
15
41
|
};
|
|
16
42
|
const VIDEO_CAPABILITIES = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
43
|
+
codecs: [
|
|
44
|
+
{
|
|
45
|
+
mimeType: "video/VP8",
|
|
46
|
+
clockRate: 9e4
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
mimeType: "video/rtx",
|
|
50
|
+
clockRate: 9e4
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
mimeType: "video/H264",
|
|
54
|
+
clockRate: 9e4,
|
|
55
|
+
sdpFmtpLine: "level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
mimeType: "video/VP9",
|
|
59
|
+
clockRate: 9e4
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
mimeType: "video/red",
|
|
63
|
+
clockRate: 9e4
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
mimeType: "video/ulpfec",
|
|
67
|
+
clockRate: 9e4
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
headerExtensions: [
|
|
71
|
+
{ uri: "urn:ietf:params:rtp-hdrext:toffset" },
|
|
72
|
+
{ uri: "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time" },
|
|
73
|
+
{ uri: "urn:3gpp:video-orientation" },
|
|
74
|
+
{ uri: "urn:ietf:params:rtp-hdrext:sdes:mid" },
|
|
75
|
+
{ uri: "urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id" },
|
|
76
|
+
{ uri: "urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id" }
|
|
77
|
+
]
|
|
33
78
|
};
|
|
79
|
+
/** Shared implementation for RTCRtpSender.getCapabilities / RTCRtpReceiver.getCapabilities. */
|
|
34
80
|
function getRtpCapabilities(kind) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
81
|
+
if (kind === "audio") return AUDIO_CAPABILITIES;
|
|
82
|
+
if (kind === "video") return VIDEO_CAPABILITIES;
|
|
83
|
+
return null;
|
|
38
84
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
85
|
+
|
|
86
|
+
//#endregion
|
|
87
|
+
export { getRtpCapabilities };
|