summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-02-09 23:34:32 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-02-09 23:34:32 +1100
commite849d24a7a551c54ea15049c04a4d62345c5a63e (patch)
tree7a58097823b3381dd012f226e3880adad97eda67
parentstill doesn't work lol (diff)
downloadserver-e849d24a7a551c54ea15049c04a4d62345c5a63e.tar.xz
crap
-rw-r--r--src/webrtc/opcodes/Identify.ts16
-rw-r--r--src/webrtc/opcodes/SelectProtocol.ts52
2 files changed, 18 insertions, 50 deletions
diff --git a/src/webrtc/opcodes/Identify.ts b/src/webrtc/opcodes/Identify.ts

index adb0d882..f3d7825e 100644 --- a/src/webrtc/opcodes/Identify.ts +++ b/src/webrtc/opcodes/Identify.ts
@@ -73,14 +73,14 @@ export async function onIdentify(this: WebSocket, data: Payload) { op: VoiceOPCodes.READY, d: { streams: [ - { - type: "video", - ssrc: this.webrtcClient.in.video_ssrc + 1, - rtx_ssrc: this.webrtcClient.in.video_ssrc + 2, - rid: "100", - quality: 100, - active: false, - }, + // { + // type: "video", + // ssrc: this.webrtcClient.in.video_ssrc + 1, + // rtx_ssrc: this.webrtcClient.in.video_ssrc + 2, + // rid: "100", + // quality: 100, + // active: false, + // }, ], ssrc: this.webrtcClient.in.audio_ssrc, port: endpoint.getLocalPort(), diff --git a/src/webrtc/opcodes/SelectProtocol.ts b/src/webrtc/opcodes/SelectProtocol.ts
index 063f3769..c3bf0fdd 100644 --- a/src/webrtc/opcodes/SelectProtocol.ts +++ b/src/webrtc/opcodes/SelectProtocol.ts
@@ -19,6 +19,7 @@ import { Payload, Send, WebSocket } from "@fosscord/gateway"; import { SelectProtocolSchema, validateSchema } from "@fosscord/util"; import { endpoint, PublicIP, VoiceOPCodes } from "@fosscord/webrtc"; +import MediaServer from "medooze-media-server"; import SemanticSDP, { MediaInfo } from "semantic-sdp"; import DefaultSDP from "./sdp.json"; @@ -61,48 +62,15 @@ export async function onSelectProtocol(this: WebSocket, payload: Payload) { a=candidate:1 1 UDP 4261412862 66.22.206.174 50026 typ host\n */ - const answer = offer.answer({ - dtls: dtls, - ice: ice, - candidates: endpoint.getLocalCandidates(), - capabilities: { - audio: { - codecs: ["opus"], - rtx: true, - rtcpfbs: [{ id: "transport-cc" }], - extensions: [ - "urn:ietf:params:rtp-hdrext:ssrc-audio-level", - "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time", - "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01", - "urn:ietf:params:rtp-hdrext:sdes:mid", - ], - }, - }, - }); - - // the Video handler creates streams but we need streams now so idk - for (const offered of offer.getStreams().values()) { - const incomingStream = transport.createIncomingStream(offered); - const outgoingStream = transport.createOutgoingStream({ - audio: true, - }); - outgoingStream.attachTo(incomingStream); - this.webrtcClient.in.stream = incomingStream; - this.webrtcClient.out.stream = outgoingStream; - - const info = outgoingStream.getStreamInfo(); - answer.addStream(info); - } - - // const answer = - // `m=audio ${port} ICE/SDP\n` + - // `a=fingerprint:${fingerprint}\n` + - // `c=IN IP4 ${PublicIP}\n` + - // `a=rtcp:${port}\n` + - // `a=ice-ufrag:${ice.getUfrag()}\n` + - // `a=ice-pwd:${ice.getPwd()}\n` + - // `a=fingerprint:${fingerprint}\n` + - // `a=candidate:1 1 ${candidate.getTransport()} ${candidate.getFoundation()} ${candidate.getAddress()} ${candidate.getPort()} typ host\n`; + const answer = + `m=audio ${port} ICE/SDP\n` + + `a=fingerprint:${fingerprint}\n` + + `c=IN IP4 ${PublicIP}\n` + + `a=rtcp:${port}\n` + + `a=ice-ufrag:${ice.getUfrag()}\n` + + `a=ice-pwd:${ice.getPwd()}\n` + + `a=fingerprint:${fingerprint}\n` + + `a=candidate:1 1 ${candidate.getTransport()} ${candidate.getFoundation()} ${candidate.getAddress()} ${candidate.getPort()} typ host\n`; await Send(this, { op: VoiceOPCodes.SELECT_PROTOCOL_ACK,