From 008005b27faf850596069071d59ba530cf2a059f Mon Sep 17 00:00:00 2001 From: Jaya Allamsetty Date: Wed, 30 Oct 2024 16:38:45 -0400 Subject: [PATCH] fix(JingleSession) Get correct direction for source-remove on p2p. --- modules/xmpp/JingleSessionPC.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/xmpp/JingleSessionPC.js b/modules/xmpp/JingleSessionPC.js index fcf87fb5b7..08495120b8 100644 --- a/modules/xmpp/JingleSessionPC.js +++ b/modules/xmpp/JingleSessionPC.js @@ -400,9 +400,11 @@ export default class JingleSessionPC extends JingleSession { for (const mid of modifiedMids) { if (this.isP2P) { const { media } = SDPUtil.parseMLine(currentRemoteSdp.media[mid].split('\r\n')[0]); - const desiredDirection = this.peerconnection.getDesiredMediaDirection(media, true); + const desiredDirection = this.peerconnection.getDesiredMediaDirection(media, isAdd); + const currentDirections = isAdd ? [ MediaDirection.RECVONLY, MediaDirection.INACTIVE ] + : [ MediaDirection.SENDRECV, MediaDirection.SENDONLY ]; - [ MediaDirection.RECVONLY, MediaDirection.INACTIVE ].forEach(direction => { + currentDirections.forEach(direction => { currentRemoteSdp.media[mid] = currentRemoteSdp.media[mid] .replace(`a=${direction}`, `a=${desiredDirection}`); });