piixishstream 0.0.0-stage → 1.0.2
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/README.md +124 -2
- package/dist/client/GatewayEvents.d.ts +30 -0
- package/dist/client/GatewayEvents.js +2 -0
- package/dist/client/GatewayEvents.js.map +1 -0
- package/dist/client/GatewayOpCodes.d.ts +40 -0
- package/dist/client/GatewayOpCodes.js +42 -0
- package/dist/client/GatewayOpCodes.js.map +1 -0
- package/dist/client/Streamer.d.ts +30 -0
- package/dist/client/Streamer.js +188 -0
- package/dist/client/Streamer.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/processing/AnnexBBitstreamReaderWriter.d.ts +23 -0
- package/dist/client/processing/AnnexBBitstreamReaderWriter.js +149 -0
- package/dist/client/processing/AnnexBBitstreamReaderWriter.js.map +1 -0
- package/dist/client/processing/AnnexBHelper.d.ts +93 -0
- package/dist/client/processing/AnnexBHelper.js +127 -0
- package/dist/client/processing/AnnexBHelper.js.map +1 -0
- package/dist/client/processing/SPSVUIRewriter.d.ts +1 -0
- package/dist/client/processing/SPSVUIRewriter.js +297 -0
- package/dist/client/processing/SPSVUIRewriter.js.map +1 -0
- package/dist/client/voice/BaseMediaConnection.d.ts +80 -0
- package/dist/client/voice/BaseMediaConnection.js +552 -0
- package/dist/client/voice/BaseMediaConnection.js.map +1 -0
- package/dist/client/voice/CodecPayloadType.d.ts +59 -0
- package/dist/client/voice/CodecPayloadType.js +60 -0
- package/dist/client/voice/CodecPayloadType.js.map +1 -0
- package/dist/client/voice/StreamConnection.d.ts +11 -0
- package/dist/client/voice/StreamConnection.js +34 -0
- package/dist/client/voice/StreamConnection.js.map +1 -0
- package/dist/client/voice/VoiceConnection.d.ts +8 -0
- package/dist/client/voice/VoiceConnection.js +15 -0
- package/dist/client/voice/VoiceConnection.js.map +1 -0
- package/dist/client/voice/VoiceMessageTypes.d.ts +178 -0
- package/dist/client/voice/VoiceMessageTypes.js +2 -0
- package/dist/client/voice/VoiceMessageTypes.js.map +1 -0
- package/dist/client/voice/VoiceOpCodes.d.ts +35 -0
- package/dist/client/voice/VoiceOpCodes.js +38 -0
- package/dist/client/voice/VoiceOpCodes.js.map +1 -0
- package/dist/client/voice/WebRtcWrapper.d.ts +23 -0
- package/dist/client/voice/WebRtcWrapper.js +159 -0
- package/dist/client/voice/WebRtcWrapper.js.map +1 -0
- package/dist/client/voice/index.d.ts +4 -0
- package/dist/client/voice/index.js +6 -0
- package/dist/client/voice/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/media/AudioStream.d.ts +7 -0
- package/dist/media/AudioStream.js +12 -0
- package/dist/media/AudioStream.js.map +1 -0
- package/dist/media/BaseMediaStream.d.ts +31 -0
- package/dist/media/BaseMediaStream.js +164 -0
- package/dist/media/BaseMediaStream.js.map +1 -0
- package/dist/media/LibavCodecId.d.ts +541 -0
- package/dist/media/LibavCodecId.js +553 -0
- package/dist/media/LibavCodecId.js.map +1 -0
- package/dist/media/LibavDecoder.d.ts +5 -0
- package/dist/media/LibavDecoder.js +43 -0
- package/dist/media/LibavDecoder.js.map +1 -0
- package/dist/media/LibavDemuxer.d.ts +44 -0
- package/dist/media/LibavDemuxer.js +231 -0
- package/dist/media/LibavDemuxer.js.map +1 -0
- package/dist/media/VideoStream.d.ts +7 -0
- package/dist/media/VideoStream.js +12 -0
- package/dist/media/VideoStream.js.map +1 -0
- package/dist/media/encoders/index.d.ts +26 -0
- package/dist/media/encoders/index.js +12 -0
- package/dist/media/encoders/index.js.map +1 -0
- package/dist/media/encoders/merge.d.ts +3 -0
- package/dist/media/encoders/merge.js +10 -0
- package/dist/media/encoders/merge.js.map +1 -0
- package/dist/media/encoders/nvenc.d.ts +10 -0
- package/dist/media/encoders/nvenc.js +23 -0
- package/dist/media/encoders/nvenc.js.map +1 -0
- package/dist/media/encoders/software.d.ts +17 -0
- package/dist/media/encoders/software.js +31 -0
- package/dist/media/encoders/software.js.map +1 -0
- package/dist/media/encoders/vaapi.d.ts +6 -0
- package/dist/media/encoders/vaapi.js +22 -0
- package/dist/media/encoders/vaapi.js.map +1 -0
- package/dist/media/index.d.ts +4 -0
- package/dist/media/index.js +5 -0
- package/dist/media/index.js.map +1 -0
- package/dist/media/newApi.d.ts +130 -0
- package/dist/media/newApi.js +409 -0
- package/dist/media/newApi.js.map +1 -0
- package/dist/utils.d.ts +25 -0
- package/dist/utils.js +65 -0
- package/dist/utils.js.map +1 -0
- package/package.json +82 -5
- package/src/client/GatewayEvents.ts +48 -0
- package/src/client/GatewayOpCodes.ts +40 -0
- package/src/client/Streamer.ts +259 -0
- package/src/client/index.ts +3 -0
- package/src/client/processing/AnnexBBitstreamReaderWriter.ts +148 -0
- package/src/client/processing/AnnexBHelper.ts +134 -0
- package/src/client/processing/SPSVUIRewriter.ts +332 -0
- package/src/client/voice/BaseMediaConnection.ts +639 -0
- package/src/client/voice/CodecPayloadType.ts +59 -0
- package/src/client/voice/MediaUdp.ts.bak +171 -0
- package/src/client/voice/StreamConnection.ts +38 -0
- package/src/client/voice/VoiceConnection.ts +19 -0
- package/src/client/voice/VoiceMessageTypes.ts +263 -0
- package/src/client/voice/VoiceOpCodes.ts +36 -0
- package/src/client/voice/WebRtcWrapper.ts +218 -0
- package/src/client/voice/index.ts +5 -0
- package/src/index.ts +3 -0
- package/src/media/AudioStream.ts +18 -0
- package/src/media/BaseMediaStream.ts +198 -0
- package/src/media/LibavCodecId.ts +564 -0
- package/src/media/LibavDecoder.ts +47 -0
- package/src/media/LibavDemuxer.ts +293 -0
- package/src/media/VideoStream.ts +17 -0
- package/src/media/encoders/index.ts +27 -0
- package/src/media/encoders/merge.ts +14 -0
- package/src/media/encoders/nvenc.ts +38 -0
- package/src/media/encoders/software.ts +76 -0
- package/src/media/encoders/vaapi.ts +29 -0
- package/src/media/index.ts +4 -0
- package/src/media/newApi.ts +642 -0
- package/src/utils.ts +101 -0
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
import Davey from "@snazzah/davey";
|
|
2
|
+
import EventEmitter from "node:events";
|
|
3
|
+
import { Log } from "debug-level";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
import { CodecPayloadType } from "./CodecPayloadType.js";
|
|
6
|
+
import { WebRtcConnWrapper } from "./WebRtcWrapper.js";
|
|
7
|
+
import { VoiceOpCodes, VoiceOpCodesBinary } from "./VoiceOpCodes.js";
|
|
8
|
+
import { STREAMS_SIMULCAST, } from "../../utils.js";
|
|
9
|
+
export class BaseMediaConnection extends EventEmitter {
|
|
10
|
+
interval = null;
|
|
11
|
+
guildId = null;
|
|
12
|
+
channelId;
|
|
13
|
+
botId;
|
|
14
|
+
ws = null;
|
|
15
|
+
status;
|
|
16
|
+
server = null; //websocket url
|
|
17
|
+
token = null;
|
|
18
|
+
session_id = null;
|
|
19
|
+
_webRtcWrapper;
|
|
20
|
+
_webRtcParams = null;
|
|
21
|
+
_closed = false;
|
|
22
|
+
ready;
|
|
23
|
+
_streamer;
|
|
24
|
+
_sequenceNumber = -1;
|
|
25
|
+
_daveSession;
|
|
26
|
+
_connectedUsers = new Set();
|
|
27
|
+
_daveProtocolVersion = 0;
|
|
28
|
+
_davePendingTransitions = new Map();
|
|
29
|
+
_daveDowngraded = false;
|
|
30
|
+
_logger = new Log("conn");
|
|
31
|
+
_loggerDave = new Log("conn:dave");
|
|
32
|
+
constructor(streamer, guildId, botId, channelId, callback) {
|
|
33
|
+
super();
|
|
34
|
+
this._streamer = streamer;
|
|
35
|
+
this.status = {
|
|
36
|
+
hasSession: false,
|
|
37
|
+
hasToken: false,
|
|
38
|
+
started: false,
|
|
39
|
+
resuming: false,
|
|
40
|
+
};
|
|
41
|
+
this.guildId = guildId;
|
|
42
|
+
this.channelId = channelId;
|
|
43
|
+
this.botId = botId;
|
|
44
|
+
this.ready = callback;
|
|
45
|
+
this._webRtcWrapper = new WebRtcConnWrapper(this);
|
|
46
|
+
}
|
|
47
|
+
get type() {
|
|
48
|
+
return this.guildId ? "guild" : "call";
|
|
49
|
+
}
|
|
50
|
+
get webRtcConn() {
|
|
51
|
+
return this._webRtcWrapper;
|
|
52
|
+
}
|
|
53
|
+
get webRtcParams() {
|
|
54
|
+
return this._webRtcParams;
|
|
55
|
+
}
|
|
56
|
+
get streamer() {
|
|
57
|
+
return this._streamer;
|
|
58
|
+
}
|
|
59
|
+
stop() {
|
|
60
|
+
this._closed = true;
|
|
61
|
+
this._webRtcWrapper.close();
|
|
62
|
+
this.ws?.close();
|
|
63
|
+
}
|
|
64
|
+
setSession(session_id) {
|
|
65
|
+
this.session_id = session_id;
|
|
66
|
+
this.status.hasSession = true;
|
|
67
|
+
this.start();
|
|
68
|
+
}
|
|
69
|
+
setTokens(server, token) {
|
|
70
|
+
this.token = token;
|
|
71
|
+
this.server = server;
|
|
72
|
+
this.status.hasToken = true;
|
|
73
|
+
this.start();
|
|
74
|
+
}
|
|
75
|
+
start() {
|
|
76
|
+
/*
|
|
77
|
+
** Connection can only start once both
|
|
78
|
+
** session description and tokens have been gathered
|
|
79
|
+
*/
|
|
80
|
+
if (this.status.hasSession && this.status.hasToken) {
|
|
81
|
+
if (this.status.started)
|
|
82
|
+
return;
|
|
83
|
+
this.status.started = true;
|
|
84
|
+
this.ws = new WebSocket(`wss://${this.server}/?v=8`);
|
|
85
|
+
this.ws.binaryType = "arraybuffer";
|
|
86
|
+
this.ws.addEventListener("open", () => {
|
|
87
|
+
if (this.status.resuming) {
|
|
88
|
+
this.status.resuming = false;
|
|
89
|
+
this.resume();
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
this.identify();
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
this.ws.addEventListener("error", (err) => {
|
|
96
|
+
console.error(err);
|
|
97
|
+
});
|
|
98
|
+
this.ws.addEventListener("close", (e) => {
|
|
99
|
+
const wasStarted = this.status.started;
|
|
100
|
+
this.interval && clearInterval(this.interval);
|
|
101
|
+
this.status.started = false;
|
|
102
|
+
const canResume = e.code === 4_015 || e.code < 4_000;
|
|
103
|
+
if (canResume && wasStarted) {
|
|
104
|
+
this.status.resuming = true;
|
|
105
|
+
this.start();
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
this._closed = true;
|
|
109
|
+
this._webRtcWrapper?.close();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
this.setupEvents();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
handleReady(d) {
|
|
116
|
+
// we hardcoded the STREAMS_SIMULCAST, which will always be array of 1
|
|
117
|
+
const stream = d.streams[0];
|
|
118
|
+
this._webRtcParams = {
|
|
119
|
+
address: d.ip,
|
|
120
|
+
port: d.port,
|
|
121
|
+
audioSsrc: d.ssrc,
|
|
122
|
+
videoSsrc: stream.ssrc,
|
|
123
|
+
rtxSsrc: stream.rtx_ssrc,
|
|
124
|
+
supportedEncryptionModes: d.modes,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
async handleProtocolAck(d) {
|
|
128
|
+
if (!("sdp" in d))
|
|
129
|
+
throw new Error("Only WebRTC connections are allowed");
|
|
130
|
+
this._daveProtocolVersion = d.dave_protocol_version;
|
|
131
|
+
this.initDave();
|
|
132
|
+
// Discord's SDP is absolute garbage...Generate one ourselves
|
|
133
|
+
let ip = "", port = "", iceUsername = "", icePassword = "", fingerprint = "", candidate = "";
|
|
134
|
+
for (const line of d.sdp.split("\n")) {
|
|
135
|
+
if (line.startsWith("c="))
|
|
136
|
+
ip = line;
|
|
137
|
+
else if (line.startsWith("a=rtcp"))
|
|
138
|
+
port = line.split(":")[1];
|
|
139
|
+
else if (line.startsWith("a=ice-ufrag"))
|
|
140
|
+
iceUsername = line;
|
|
141
|
+
else if (line.startsWith("a=ice-pwd"))
|
|
142
|
+
icePassword = line;
|
|
143
|
+
else if (line.startsWith("a=fingerprint"))
|
|
144
|
+
fingerprint = line;
|
|
145
|
+
else if (line.startsWith("a=candidate"))
|
|
146
|
+
candidate = line;
|
|
147
|
+
}
|
|
148
|
+
const audioPayloadType = CodecPayloadType.opus.payload_type;
|
|
149
|
+
const audioSection = `
|
|
150
|
+
m=audio ${port} UDP/TLS/RTP/SAVPF ${audioPayloadType}
|
|
151
|
+
${ip}
|
|
152
|
+
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
|
|
153
|
+
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
|
|
154
|
+
a=setup:passive
|
|
155
|
+
a=mid:0
|
|
156
|
+
a=maxptime:60
|
|
157
|
+
a=inactive
|
|
158
|
+
${iceUsername}
|
|
159
|
+
${icePassword}
|
|
160
|
+
${fingerprint}
|
|
161
|
+
${candidate}
|
|
162
|
+
a=rtcp-mux
|
|
163
|
+
a=rtpmap:${audioPayloadType} opus/48000/2
|
|
164
|
+
a=fmtp:${audioPayloadType} minptime=10;useinbandfec=1;usedtx=1
|
|
165
|
+
a=rtcp-fb:${audioPayloadType} transport-cc
|
|
166
|
+
a=rtcp-fb:${audioPayloadType} nack
|
|
167
|
+
a=ice-lite
|
|
168
|
+
`.trim();
|
|
169
|
+
const videoPayloads = Object.values(CodecPayloadType).filter((el) => el.type === "video");
|
|
170
|
+
const videoPayloadTypes = videoPayloads.flatMap((el) => [
|
|
171
|
+
el.payload_type,
|
|
172
|
+
el.rtx_payload_type,
|
|
173
|
+
]);
|
|
174
|
+
const videoSection = `
|
|
175
|
+
m=video ${port} UDP/TLS/RTP/SAVPF ${videoPayloadTypes.join(" ")}
|
|
176
|
+
${ip}
|
|
177
|
+
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
|
|
178
|
+
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
|
|
179
|
+
a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
|
|
180
|
+
a=extmap:13 urn:3gpp:video-orientation
|
|
181
|
+
a=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
|
|
182
|
+
a=setup:passive
|
|
183
|
+
a=mid:1
|
|
184
|
+
a=inactive
|
|
185
|
+
${iceUsername}
|
|
186
|
+
${icePassword}
|
|
187
|
+
${fingerprint}
|
|
188
|
+
${candidate}
|
|
189
|
+
a=rtcp-mux
|
|
190
|
+
a=ice-lite
|
|
191
|
+
`.trim();
|
|
192
|
+
const videoRtpMap = videoPayloads
|
|
193
|
+
.flatMap((el) => [
|
|
194
|
+
`a=rtpmap:${el.payload_type} ${el.name}/90000`,
|
|
195
|
+
`a=rtpmap:${el.rtx_payload_type} rtx/90000`,
|
|
196
|
+
`a=fmtp:${el.rtx_payload_type} apt=${el.payload_type}`,
|
|
197
|
+
`a=rtcp-fb:${el.payload_type} ccm fir`,
|
|
198
|
+
`a=rtcp-fb:${el.payload_type} nack`,
|
|
199
|
+
`a=rtcp-fb:${el.payload_type} nack pli`,
|
|
200
|
+
`a=rtcp-fb:${el.payload_type} goog-remb`,
|
|
201
|
+
`a=rtcp-fb:${el.payload_type} transport-cc`,
|
|
202
|
+
])
|
|
203
|
+
.join("\n");
|
|
204
|
+
this._webRtcWrapper.webRtcConn?.setRemoteDescription([audioSection, videoSection, videoRtpMap].join("\n"), "answer");
|
|
205
|
+
this.emit("select_protocol_ack");
|
|
206
|
+
}
|
|
207
|
+
initDave() {
|
|
208
|
+
if (this._daveProtocolVersion) {
|
|
209
|
+
if (this._daveSession) {
|
|
210
|
+
this._daveSession.reinit(this._daveProtocolVersion, this.botId, this.daveChannelId);
|
|
211
|
+
this._loggerDave.debug(`Reinitialized DAVE`, {
|
|
212
|
+
user_id: this.botId,
|
|
213
|
+
channel_id: this.daveChannelId,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
this._daveSession = new Davey.DAVESession(this._daveProtocolVersion, this.botId, this.daveChannelId);
|
|
218
|
+
this._loggerDave.debug(`Initialized DAVE`, {
|
|
219
|
+
user_id: this.botId,
|
|
220
|
+
channel_id: this.daveChannelId,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
this.sendOpcodeBinary(VoiceOpCodesBinary.MLS_KEY_PACKAGE, this._daveSession.getSerializedKeyPackage());
|
|
224
|
+
}
|
|
225
|
+
else if (this._daveSession) {
|
|
226
|
+
this._daveSession.reset();
|
|
227
|
+
this._daveSession.setPassthroughMode(true, 10);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
processInvalidCommit(transitionId) {
|
|
231
|
+
this._loggerDave.debug("Invalid commit received, reinitializing DAVE", {
|
|
232
|
+
transitionId,
|
|
233
|
+
});
|
|
234
|
+
this.sendOpcode(VoiceOpCodes.MLS_INVALID_COMMIT_WELCOME, {
|
|
235
|
+
transition_id: transitionId,
|
|
236
|
+
});
|
|
237
|
+
this.initDave();
|
|
238
|
+
}
|
|
239
|
+
executePendingTransition(transitionId) {
|
|
240
|
+
const newVersion = this._davePendingTransitions.get(transitionId);
|
|
241
|
+
if (newVersion === undefined) {
|
|
242
|
+
this._loggerDave.error("Unrecognized transition ID", { transitionId });
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const oldVersion = this._daveProtocolVersion;
|
|
246
|
+
this._daveProtocolVersion = newVersion;
|
|
247
|
+
if (oldVersion !== newVersion && newVersion === 0) {
|
|
248
|
+
// Downgraded
|
|
249
|
+
this._daveDowngraded = true;
|
|
250
|
+
this._loggerDave.debug("Downgraded to non-E2E voice call");
|
|
251
|
+
}
|
|
252
|
+
else if (transitionId > 0 && this._daveDowngraded) {
|
|
253
|
+
this._daveDowngraded = false;
|
|
254
|
+
this._daveSession?.setPassthroughMode(true, 10);
|
|
255
|
+
this._loggerDave.debug("Upgraded to E2E voice call");
|
|
256
|
+
}
|
|
257
|
+
this._davePendingTransitions.delete(transitionId);
|
|
258
|
+
this._loggerDave.debug(`Pending transition ID ${transitionId} executed`, {
|
|
259
|
+
transitionId,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
setupEvents() {
|
|
263
|
+
this.ws?.addEventListener("message", async (e) => {
|
|
264
|
+
if (e.data instanceof ArrayBuffer) {
|
|
265
|
+
this.handleBinaryMessages(Buffer.from(e.data));
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const { op, d, seq } = JSON.parse(e.data);
|
|
269
|
+
if (seq)
|
|
270
|
+
this._sequenceNumber = seq;
|
|
271
|
+
if (op === VoiceOpCodes.READY) {
|
|
272
|
+
// ready
|
|
273
|
+
this.handleReady(d);
|
|
274
|
+
this.setProtocols().then(() => this.ready(this._webRtcWrapper));
|
|
275
|
+
this.setVideoAttributes(false);
|
|
276
|
+
}
|
|
277
|
+
else if (op >= 4000) {
|
|
278
|
+
console.error(`Error ${this.constructor.name} connection`, d);
|
|
279
|
+
}
|
|
280
|
+
else if (op === VoiceOpCodes.HELLO) {
|
|
281
|
+
this.setupHeartbeat(d.heartbeat_interval);
|
|
282
|
+
}
|
|
283
|
+
else if (op === VoiceOpCodes.SELECT_PROTOCOL_ACK) {
|
|
284
|
+
// session description
|
|
285
|
+
this.handleProtocolAck(d);
|
|
286
|
+
}
|
|
287
|
+
else if (op === VoiceOpCodes.SPEAKING) {
|
|
288
|
+
// ignore speaking updates
|
|
289
|
+
}
|
|
290
|
+
else if (op === VoiceOpCodes.HEARTBEAT_ACK) {
|
|
291
|
+
// ignore heartbeat acknowledgements
|
|
292
|
+
}
|
|
293
|
+
else if (op === VoiceOpCodes.RESUMED) {
|
|
294
|
+
this.status.started = true;
|
|
295
|
+
}
|
|
296
|
+
else if (op === VoiceOpCodes.CLIENTS_CONNECT) {
|
|
297
|
+
d.user_ids.forEach((id) => {
|
|
298
|
+
this._connectedUsers.add(id);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
else if (op === VoiceOpCodes.CLIENT_DISCONNECT) {
|
|
302
|
+
this._connectedUsers.delete(d.user_id);
|
|
303
|
+
}
|
|
304
|
+
else if (op === VoiceOpCodes.DAVE_PREPARE_TRANSITION) {
|
|
305
|
+
this._loggerDave.debug("Preparing for DAVE transition", d);
|
|
306
|
+
this._davePendingTransitions.set(d.transition_id, d.protocol_version);
|
|
307
|
+
if (d.transition_id === 0) {
|
|
308
|
+
this.executePendingTransition(d.transition_id);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
if (d.protocol_version === 0)
|
|
312
|
+
this._daveSession?.setPassthroughMode(true, 120);
|
|
313
|
+
this.sendOpcode(VoiceOpCodes.DAVE_TRANSITION_READY, {
|
|
314
|
+
transition_id: d.transition_id,
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
else if (op === VoiceOpCodes.DAVE_EXECUTE_TRANSITION) {
|
|
319
|
+
this.executePendingTransition(d.transition_id);
|
|
320
|
+
}
|
|
321
|
+
else if (op === VoiceOpCodes.DAVE_PREPARE_EPOCH) {
|
|
322
|
+
this._loggerDave.debug("Preparing for DAVE epoch", d);
|
|
323
|
+
if (d.epoch === 1) {
|
|
324
|
+
this._daveProtocolVersion = d.protocol_version;
|
|
325
|
+
this.initDave();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
//console.log("unhandled voice event", {op, d});
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
handleBinaryMessages(msg) {
|
|
334
|
+
this._sequenceNumber = msg.readUint16BE(0);
|
|
335
|
+
const op = msg.readUint8(2);
|
|
336
|
+
this._logger.trace(`Handling binary message with op ${op}`, { op });
|
|
337
|
+
switch (op) {
|
|
338
|
+
case VoiceOpCodesBinary.MLS_EXTERNAL_SENDER: {
|
|
339
|
+
this._daveSession?.setExternalSender(msg.subarray(3));
|
|
340
|
+
this._loggerDave.debug("Set MLS external sender");
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
case VoiceOpCodesBinary.MLS_PROPOSALS: {
|
|
344
|
+
const optype = msg.readUint8(3);
|
|
345
|
+
const { commit, welcome } = this._daveSession.processProposals(optype, msg.subarray(4), [...this._connectedUsers]);
|
|
346
|
+
if (commit) {
|
|
347
|
+
this.sendOpcodeBinary(VoiceOpCodesBinary.MLS_COMMIT_WELCOME, welcome ? Buffer.concat([commit, welcome]) : commit);
|
|
348
|
+
}
|
|
349
|
+
this._loggerDave.debug("Processed MLS proposal");
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
case VoiceOpCodesBinary.MLS_ANNOUNCE_COMMIT_TRANSITION: {
|
|
353
|
+
const transitionId = msg.readUInt16BE(3);
|
|
354
|
+
try {
|
|
355
|
+
this._daveSession?.processCommit(msg.subarray(5));
|
|
356
|
+
if (transitionId) {
|
|
357
|
+
this._davePendingTransitions.set(transitionId, this._daveProtocolVersion);
|
|
358
|
+
this.sendOpcode(VoiceOpCodes.DAVE_TRANSITION_READY, {
|
|
359
|
+
transition_id: transitionId,
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
this._loggerDave.debug("MLS commit processed", { transitionId });
|
|
363
|
+
}
|
|
364
|
+
catch (e) {
|
|
365
|
+
this._loggerDave.debug("MLS commit errored", e);
|
|
366
|
+
this.processInvalidCommit(transitionId);
|
|
367
|
+
}
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
case VoiceOpCodesBinary.MLS_WELCOME: {
|
|
371
|
+
const transitionId = msg.readUInt16BE(3);
|
|
372
|
+
try {
|
|
373
|
+
this._daveSession?.processWelcome(msg.subarray(5));
|
|
374
|
+
if (transitionId) {
|
|
375
|
+
this._davePendingTransitions.set(transitionId, this._daveProtocolVersion);
|
|
376
|
+
this.sendOpcode(VoiceOpCodes.DAVE_TRANSITION_READY, {
|
|
377
|
+
transition_id: transitionId,
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
this._loggerDave.debug("MLS welcome processed", { transitionId });
|
|
381
|
+
}
|
|
382
|
+
catch (e) {
|
|
383
|
+
this._loggerDave.debug("MLS welcome errored", e);
|
|
384
|
+
this.processInvalidCommit(transitionId);
|
|
385
|
+
}
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
get daveReady() {
|
|
391
|
+
return this._daveProtocolVersion && this._daveSession?.ready;
|
|
392
|
+
}
|
|
393
|
+
get daveSession() {
|
|
394
|
+
return this._daveSession;
|
|
395
|
+
}
|
|
396
|
+
setupHeartbeat(interval) {
|
|
397
|
+
if (this.interval) {
|
|
398
|
+
clearInterval(this.interval);
|
|
399
|
+
}
|
|
400
|
+
this.interval = setInterval(() => {
|
|
401
|
+
try {
|
|
402
|
+
this.sendOpcode(VoiceOpCodes.HEARTBEAT, {
|
|
403
|
+
t: Date.now(),
|
|
404
|
+
seq_ack: this._sequenceNumber,
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
catch { }
|
|
408
|
+
}, interval);
|
|
409
|
+
}
|
|
410
|
+
sendOpcode(code, data) {
|
|
411
|
+
if (this.ws?.readyState !== WebSocket.OPEN)
|
|
412
|
+
return;
|
|
413
|
+
this.ws.send(JSON.stringify({
|
|
414
|
+
op: code,
|
|
415
|
+
d: data,
|
|
416
|
+
}));
|
|
417
|
+
}
|
|
418
|
+
sendOpcodeBinary(code, data) {
|
|
419
|
+
if (this.ws?.readyState !== WebSocket.OPEN)
|
|
420
|
+
return;
|
|
421
|
+
const buf = Buffer.allocUnsafe(data.length + 1);
|
|
422
|
+
buf.writeUInt8(code);
|
|
423
|
+
data.copy(buf, 1);
|
|
424
|
+
this.ws.send(buf);
|
|
425
|
+
}
|
|
426
|
+
/*
|
|
427
|
+
** identifies with media server with credentials
|
|
428
|
+
*/
|
|
429
|
+
identify() {
|
|
430
|
+
if (!this.serverId)
|
|
431
|
+
throw new Error("Server ID is null or empty");
|
|
432
|
+
if (!this.session_id)
|
|
433
|
+
throw new Error("Session ID is null or empty");
|
|
434
|
+
if (!this.token)
|
|
435
|
+
throw new Error("Token is null or empty");
|
|
436
|
+
this.sendOpcode(VoiceOpCodes.IDENTIFY, {
|
|
437
|
+
server_id: this.serverId,
|
|
438
|
+
user_id: this.botId,
|
|
439
|
+
session_id: this.session_id,
|
|
440
|
+
token: this.token,
|
|
441
|
+
video: true,
|
|
442
|
+
streams: STREAMS_SIMULCAST,
|
|
443
|
+
max_dave_protocol_version: Davey.DAVE_PROTOCOL_VERSION ?? 0,
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
resume() {
|
|
447
|
+
if (!this.serverId)
|
|
448
|
+
throw new Error("Server ID is null or empty");
|
|
449
|
+
if (!this.session_id)
|
|
450
|
+
throw new Error("Session ID is null or empty");
|
|
451
|
+
if (!this.token)
|
|
452
|
+
throw new Error("Token is null or empty");
|
|
453
|
+
this.sendOpcode(VoiceOpCodes.RESUME, {
|
|
454
|
+
server_id: this.serverId,
|
|
455
|
+
session_id: this.session_id,
|
|
456
|
+
token: this.token,
|
|
457
|
+
seq_ack: this._sequenceNumber,
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
/*
|
|
461
|
+
** Sets protocols and ip data used for video and audio.
|
|
462
|
+
** Uses vp8 for video
|
|
463
|
+
** Uses opus for audio
|
|
464
|
+
*/
|
|
465
|
+
async setProtocols() {
|
|
466
|
+
if (!this._webRtcParams)
|
|
467
|
+
throw new Error("WebRTC parameters not set");
|
|
468
|
+
// if (
|
|
469
|
+
// this._webRtcParams.supportedEncryptionModes.includes(SupportedEncryptionModes.AES256) &&
|
|
470
|
+
// !this._streamer.opts.forceChacha20Encryption
|
|
471
|
+
// ) {
|
|
472
|
+
// encryptionMode = SupportedEncryptionModes.AES256
|
|
473
|
+
// } else {
|
|
474
|
+
// encryptionMode = SupportedEncryptionModes.XCHACHA20
|
|
475
|
+
// }
|
|
476
|
+
const reconnect = () => {
|
|
477
|
+
const webRtcConn = this._webRtcWrapper.initWebRtc();
|
|
478
|
+
webRtcConn.onStateChange((state) => {
|
|
479
|
+
if (state === "closed" && !this._closed)
|
|
480
|
+
reconnect();
|
|
481
|
+
});
|
|
482
|
+
webRtcConn.onLocalDescription((sdp) => {
|
|
483
|
+
const rtc_connection_id = randomUUID();
|
|
484
|
+
this.sendOpcode(VoiceOpCodes.SELECT_PROTOCOL, {
|
|
485
|
+
protocol: "webrtc",
|
|
486
|
+
codecs: Object.values(CodecPayloadType),
|
|
487
|
+
data: sdp,
|
|
488
|
+
sdp: sdp,
|
|
489
|
+
rtc_connection_id,
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
webRtcConn.setLocalDescription();
|
|
493
|
+
};
|
|
494
|
+
reconnect();
|
|
495
|
+
return new Promise((resolve) => {
|
|
496
|
+
this.once("select_protocol_ack", () => resolve());
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
setVideoAttributes(enabled, attr) {
|
|
500
|
+
if (!this._webRtcParams)
|
|
501
|
+
throw new Error("WebRTC parameters not set");
|
|
502
|
+
const { audioSsrc, videoSsrc, rtxSsrc } = this._webRtcParams;
|
|
503
|
+
if (!enabled) {
|
|
504
|
+
this.sendOpcode(VoiceOpCodes.VIDEO, {
|
|
505
|
+
audio_ssrc: audioSsrc,
|
|
506
|
+
video_ssrc: 0,
|
|
507
|
+
rtx_ssrc: 0,
|
|
508
|
+
streams: [],
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
if (!attr)
|
|
513
|
+
throw new Error("Need to specify video attributes");
|
|
514
|
+
this.sendOpcode(VoiceOpCodes.VIDEO, {
|
|
515
|
+
audio_ssrc: audioSsrc,
|
|
516
|
+
video_ssrc: videoSsrc,
|
|
517
|
+
rtx_ssrc: rtxSsrc,
|
|
518
|
+
streams: [
|
|
519
|
+
{
|
|
520
|
+
type: "video",
|
|
521
|
+
rid: "100",
|
|
522
|
+
ssrc: videoSsrc,
|
|
523
|
+
active: true,
|
|
524
|
+
quality: 100,
|
|
525
|
+
rtx_ssrc: rtxSsrc,
|
|
526
|
+
max_bitrate: 10000 * 1000,
|
|
527
|
+
max_framerate: enabled ? attr.fps : 0,
|
|
528
|
+
max_resolution: {
|
|
529
|
+
type: "fixed",
|
|
530
|
+
width: attr.width,
|
|
531
|
+
height: attr.height,
|
|
532
|
+
},
|
|
533
|
+
},
|
|
534
|
+
],
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
/*
|
|
539
|
+
** Set speaking status
|
|
540
|
+
** speaking -> speaking status on or off
|
|
541
|
+
*/
|
|
542
|
+
setSpeaking(speaking) {
|
|
543
|
+
if (!this._webRtcParams)
|
|
544
|
+
throw new Error("WebRTC connection not ready");
|
|
545
|
+
this.sendOpcode(VoiceOpCodes.SPEAKING, {
|
|
546
|
+
delay: 0,
|
|
547
|
+
speaking: speaking ? 1 : 0,
|
|
548
|
+
ssrc: this._webRtcParams.audioSsrc,
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
//# sourceMappingURL=BaseMediaConnection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseMediaConnection.js","sourceRoot":"","sources":["../../../src/client/voice/BaseMediaConnection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,gBAAgB,CAAC;AACnC,OAAO,YAAY,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EACL,iBAAiB,GAElB,MAAM,gBAAgB,CAAC;AAoCxB,MAAM,OAAgB,mBAAoB,SAAQ,YAAY;IACpD,QAAQ,GAA0B,IAAI,CAAC;IACxC,OAAO,GAAkB,IAAI,CAAC;IAC9B,SAAS,CAAS;IAClB,KAAK,CAAS;IACd,EAAE,G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,EAAE,OAAO;gBACjB,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,OAAO;wBACb,GAAG,EAAE,KAAK;wBACV,IAAI,EAAE,SAAS;wBACf,MAAM,EAAE,IAAI;wBACZ,OAAO,EAAE,GAAG;wBACZ,QAAQ,EAAE,OAAO;wBACjB,+DAA+D;wBAC/D,WAAW,EAAE,KAAK,GAAG,IAAI;wBACzB,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;wBACrC,cAAc,EAAE;4BACd,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,IAAI,CAAC,KAAK;4BACjB,MAAM,EAAE,IAAI,CAAC,MAAM;yBACpB;qBACF;iBACF;aACF,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,WAAW,CAAC,QAAiB;QAClC,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACxE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,EAAE;YACrC,KAAK,EAAE,CAAC;YACR,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC1B,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,SAAS;SACnC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export declare const CodecPayloadType: {
|
|
2
|
+
readonly opus: {
|
|
3
|
+
readonly name: "opus";
|
|
4
|
+
readonly type: "audio";
|
|
5
|
+
readonly clockRate: 48000;
|
|
6
|
+
readonly priority: 1000;
|
|
7
|
+
readonly payload_type: 120;
|
|
8
|
+
};
|
|
9
|
+
readonly H264: {
|
|
10
|
+
readonly name: "H264";
|
|
11
|
+
readonly type: "video";
|
|
12
|
+
readonly clockRate: 90000;
|
|
13
|
+
readonly priority: 1000;
|
|
14
|
+
readonly payload_type: 101;
|
|
15
|
+
readonly rtx_payload_type: 102;
|
|
16
|
+
readonly encode: true;
|
|
17
|
+
readonly decode: true;
|
|
18
|
+
};
|
|
19
|
+
readonly H265: {
|
|
20
|
+
readonly name: "H265";
|
|
21
|
+
readonly type: "video";
|
|
22
|
+
readonly clockRate: 90000;
|
|
23
|
+
readonly priority: 1000;
|
|
24
|
+
readonly payload_type: 103;
|
|
25
|
+
readonly rtx_payload_type: 104;
|
|
26
|
+
readonly encode: true;
|
|
27
|
+
readonly decode: true;
|
|
28
|
+
};
|
|
29
|
+
readonly VP8: {
|
|
30
|
+
readonly name: "VP8";
|
|
31
|
+
readonly type: "video";
|
|
32
|
+
readonly clockRate: 90000;
|
|
33
|
+
readonly priority: 1000;
|
|
34
|
+
readonly payload_type: 105;
|
|
35
|
+
readonly rtx_payload_type: 106;
|
|
36
|
+
readonly encode: true;
|
|
37
|
+
readonly decode: true;
|
|
38
|
+
};
|
|
39
|
+
readonly VP9: {
|
|
40
|
+
readonly name: "VP9";
|
|
41
|
+
readonly type: "video";
|
|
42
|
+
readonly clockRate: 90000;
|
|
43
|
+
readonly priority: 1000;
|
|
44
|
+
readonly payload_type: 107;
|
|
45
|
+
readonly rtx_payload_type: 108;
|
|
46
|
+
readonly encode: true;
|
|
47
|
+
readonly decode: true;
|
|
48
|
+
};
|
|
49
|
+
readonly AV1: {
|
|
50
|
+
readonly name: "AV1";
|
|
51
|
+
readonly type: "video";
|
|
52
|
+
readonly clockRate: 90000;
|
|
53
|
+
readonly priority: 1000;
|
|
54
|
+
readonly payload_type: 109;
|
|
55
|
+
readonly rtx_payload_type: 110;
|
|
56
|
+
readonly encode: true;
|
|
57
|
+
readonly decode: true;
|
|
58
|
+
};
|
|
59
|
+
};
|