diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-02-04 18:46:09 +1100 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-02-04 18:46:09 +1100 |
commit | 958d570574ecd5e3e510fa8203edf27b8760763c (patch) | |
tree | f488b478cd6d488ddd865a7fe771158be63490a3 /webrtc/src/opcodes | |
parent | mmmm (diff) | |
download | server-958d570574ecd5e3e510fa8203edf27b8760763c.tar.xz |
;jondfgsk
Diffstat (limited to 'webrtc/src/opcodes')
-rw-r--r-- | webrtc/src/opcodes/Identify.ts | 7 | ||||
-rw-r--r-- | webrtc/src/opcodes/SelectProtocol.ts | 46 |
2 files changed, 32 insertions, 21 deletions
diff --git a/webrtc/src/opcodes/Identify.ts b/webrtc/src/opcodes/Identify.ts index c31870c8..82f327be 100644 --- a/webrtc/src/opcodes/Identify.ts +++ b/webrtc/src/opcodes/Identify.ts @@ -5,7 +5,7 @@ import { Server } from "../Server"; export async function onIdentify(this: Server, socket: WebSocket, data: Payload) { var transport = await this.mediasoupRouters[0].createWebRtcTransport({ - listenIps: [{ ip: "127.0.0.1" }], + listenIps: [{ ip: "0.0.0.0", announcedIp: "127.0.0.1" }], enableUdp: true, enableTcp: true, preferUdp: true, @@ -40,10 +40,9 @@ export async function onIdentify(this: Server, socket: WebSocket, data: Payload) socket.send(JSON.stringify({ op: VoiceOPCodes.READY, d: { + streams: [], ssrc: 1, - ip: "127.0.0.1", - - //@ts-ignore + ip: transport.iceCandidates[0].ip, port: transport.iceCandidates[0].port, modes: [ "aead_aes256_gcm_rtpsize", diff --git a/webrtc/src/opcodes/SelectProtocol.ts b/webrtc/src/opcodes/SelectProtocol.ts index 08335ade..36527a8b 100644 --- a/webrtc/src/opcodes/SelectProtocol.ts +++ b/webrtc/src/opcodes/SelectProtocol.ts @@ -68,6 +68,8 @@ import * as sdpTransform from 'sdp-transform'; } */ +var test_hasMadeProducer = false; + export async function onSelectProtocol(this: Server, socket: WebSocket, data: Payload) { const rtpCapabilities = this.mediasoupRouters[0].rtpCapabilities; const codecs = rtpCapabilities.codecs as RtpCodecCapability[]; @@ -85,23 +87,33 @@ export async function onSelectProtocol(this: Server, socket: WebSocket, data: Pa })), */ - const producer = await transport.produce({ - kind: "audio", - rtpParameters: { - mid: "audio", - codecs: [{ - clockRate: 48000, - payloadType: 111, - mimeType: "audio/opus", - channels: 2, - }], - headerExtensions: res.ext?.map(x => ({ - id: x.value, - uri: x.uri, - })) - }, - paused: false, - }); + if (!test_hasMadeProducer) { + const producer = await transport.produce({ + kind: "audio", + rtpParameters: { + mid: "audio", + codecs: [{ + clockRate: 48000, + payloadType: 111, + mimeType: "audio/opus", + channels: 2, + }], + headerExtensions: res.ext?.map(x => ({ + id: x.value, + uri: x.uri, + })) + }, + paused: false, + }); + + const consumer = await transport.consume({ + producerId: producer.id, + paused: false, + rtpCapabilities, + }) + + test_hasMadeProducer = true; + } socket.send(JSON.stringify({ op: VoiceOPCodes.SESSION_DESCRIPTION, |