From 58c8235cbcb0a548ac8a18373be41bf37218c968 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Sat, 27 Aug 2022 12:13:32 -0700 Subject: [PATCH] webrtc: fixup nvr usage --- plugins/webrtc/src/ffmpeg-to-wrtc.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/plugins/webrtc/src/ffmpeg-to-wrtc.ts b/plugins/webrtc/src/ffmpeg-to-wrtc.ts index 84b5b39b7..10a65a556 100644 --- a/plugins/webrtc/src/ffmpeg-to-wrtc.ts +++ b/plugins/webrtc/src/ffmpeg-to-wrtc.ts @@ -363,12 +363,20 @@ export class WebRTCConnectionManagement implements RTCConnectionManagement { return this.negotiationDeferred.promise; } - async negotiateRTCSignalingSession(): Promise { + async negotiateRTCSignalingSession(clientOffer?: boolean): Promise { try { - await connectRTCSignalingClients(this.console, - this.clientSession, createSetup(this.options?.disableIntercom ? 'recvonly' : 'sendrecv', 'recvonly'), - this.weriftSignalingSession, createSetup(this.options?.disableIntercom ? 'sendonly' : 'sendrecv', 'sendonly'), - ); + if (clientOffer) { + await connectRTCSignalingClients(this.console, + this.clientSession, createSetup(this.options?.disableIntercom ? 'recvonly' : 'sendrecv', 'recvonly'), + this.weriftSignalingSession, createSetup(this.options?.disableIntercom ? 'sendonly' : 'sendrecv', 'sendonly'), + ); + } + else { + await connectRTCSignalingClients(this.console, + this.weriftSignalingSession, createSetup(this.options?.disableIntercom ? 'sendonly' : 'sendrecv', 'sendonly'), + this.clientSession, createSetup(this.options?.disableIntercom ? 'recvonly' : 'sendrecv', 'recvonly'), + ); + } this.negotiationDeferred.resolve(undefined); } catch (e) {