From dd2ab2bea592da5f7c4f55249888104931c366b2 Mon Sep 17 00:00:00 2001 From: Joachim Bauch Date: Tue, 27 Feb 2024 11:03:19 +0100 Subject: [PATCH] Ignore label of data channel when processing received messages. This is necessary for support of Janus 1.x which will use the (random) id of the publisher that sent the message as label. Signed-off-by: Joachim Bauch --- .../webrtc/models/CallParticipantModel.js | 4 --- src/utils/webrtc/webrtc.js | 32 ++++++++----------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/utils/webrtc/models/CallParticipantModel.js b/src/utils/webrtc/models/CallParticipantModel.js index 646556f9d206..147f6ee1d2ea 100644 --- a/src/utils/webrtc/models/CallParticipantModel.js +++ b/src/utils/webrtc/models/CallParticipantModel.js @@ -228,10 +228,6 @@ CallParticipantModel.prototype = { return } - if (label !== 'status' && label !== 'JanusDataChannel') { - return - } - if (data.type === 'speaking') { this.set('speaking', true) } else if (data.type === 'stoppedSpeaking') { diff --git a/src/utils/webrtc/webrtc.js b/src/utils/webrtc/webrtc.js index 887eb58a297c..873a399cf139 100644 --- a/src/utils/webrtc/webrtc.js +++ b/src/utils/webrtc/webrtc.js @@ -1594,25 +1594,21 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local }) webrtc.on('channelMessage', function(peer, label, data) { - if (label === 'status' || label === 'JanusDataChannel') { - if (data.type === 'audioOn') { - webrtc.emit('unmute', { id: peer.id, name: 'audio' }) - } else if (data.type === 'audioOff') { - webrtc.emit('mute', { id: peer.id, name: 'audio' }) - } else if (data.type === 'videoOn') { - webrtc.emit('unmute', { id: peer.id, name: 'video' }) - } else if (data.type === 'videoOff') { - webrtc.emit('mute', { id: peer.id, name: 'video' }) - } else if (data.type === 'nickChanged') { - const name = typeof (data.payload) === 'string' ? data.payload : data.payload.name - webrtc.emit('nick', { id: peer.id, name }) - } else if (data.type === 'speaking' || data.type === 'stoppedSpeaking') { - // Valid known messages, handled by CallParticipantModel.js - } else { - console.debug('Unknown message type %s from %s datachannel', data.type, label, data, peer.id, peer) - } + if (data.type === 'audioOn') { + webrtc.emit('unmute', { id: peer.id, name: 'audio' }) + } else if (data.type === 'audioOff') { + webrtc.emit('mute', { id: peer.id, name: 'audio' }) + } else if (data.type === 'videoOn') { + webrtc.emit('unmute', { id: peer.id, name: 'video' }) + } else if (data.type === 'videoOff') { + webrtc.emit('mute', { id: peer.id, name: 'video' }) + } else if (data.type === 'nickChanged') { + const name = typeof (data.payload) === 'string' ? data.payload : data.payload.name + webrtc.emit('nick', { id: peer.id, name }) + } else if (data.type === 'speaking' || data.type === 'stoppedSpeaking') { + // Valid known messages, handled by CallParticipantModel.js } else { - console.debug('Unknown message from %s datachannel', label, data, peer.id, peer) + console.debug('Unknown message type %s from %s datachannel', data.type, label, data, peer.id, peer) } })