1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-10 04:32:35 +01:00

Merge pull request #1048 from ppongpeauk/patch1

refactor SELECT_PROTOCOL_ACK (4) voice opcode to SESSION_DESCRIPTION
This commit is contained in:
Madeline 2023-05-05 22:34:51 +10:00 committed by GitHub
commit 91aecf2a77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@
import { Payload, Send, WebSocket } from "@spacebar/gateway"; import { Payload, Send, WebSocket } from "@spacebar/gateway";
import { SelectProtocolSchema, validateSchema } from "@spacebar/util"; import { SelectProtocolSchema, validateSchema } from "@spacebar/util";
import { endpoint, PublicIP, VoiceOPCodes } from "@spacebar/webrtc"; import { PublicIP, VoiceOPCodes, endpoint } from "@spacebar/webrtc";
import SemanticSDP, { MediaInfo, SDPInfo } from "semantic-sdp"; import SemanticSDP, { MediaInfo, SDPInfo } from "semantic-sdp";
export async function onSelectProtocol(this: WebSocket, payload: Payload) { export async function onSelectProtocol(this: WebSocket, payload: Payload) {
@ -56,7 +56,7 @@ export async function onSelectProtocol(this: WebSocket, payload: Payload) {
`a=candidate:1 1 ${candidate.getTransport()} ${candidate.getFoundation()} ${candidate.getAddress()} ${candidate.getPort()} typ host`; `a=candidate:1 1 ${candidate.getTransport()} ${candidate.getFoundation()} ${candidate.getAddress()} ${candidate.getPort()} typ host`;
await Send(this, { await Send(this, {
op: VoiceOPCodes.SELECT_PROTOCOL_ACK, op: VoiceOPCodes.SESSION_DESCRIPTION,
d: { d: {
video_codec: "H264", video_codec: "H264",
sdp: answer, sdp: answer,

View File

@ -29,7 +29,7 @@ export enum VoiceOPCodes {
SELECT_PROTOCOL = 1, SELECT_PROTOCOL = 1,
READY = 2, READY = 2,
HEARTBEAT = 3, HEARTBEAT = 3,
SELECT_PROTOCOL_ACK = 4, SESSION_DESCRIPTION = 4,
SPEAKING = 5, SPEAKING = 5,
HEARTBEAT_ACK = 6, HEARTBEAT_ACK = 6,
RESUME = 7, RESUME = 7,