From 67a7c6a34ebde970e256dcf4bbd3a4568f9f4896 Mon Sep 17 00:00:00 2001 From: Evgeny Melnikov Date: Wed, 29 Apr 2026 15:56:00 +0300 Subject: [PATCH] fix: Failed to set remote offer sdp: Duplicate a=mid value 'datachannel' error --- src/handlers/sdp/RemoteSdp.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/handlers/sdp/RemoteSdp.ts b/src/handlers/sdp/RemoteSdp.ts index 31b91544..35719620 100644 --- a/src/handlers/sdp/RemoteSdp.ts +++ b/src/handlers/sdp/RemoteSdp.ts @@ -320,6 +320,10 @@ export class RemoteSdp { }: { offerMediaObject: SdpTransform.MediaDescription; }): void { + if (offerMediaObject.mid && this._midToIndex.has(offerMediaObject.mid)) { + return; + } + const mediaSection = new AnswerMediaSection({ iceParameters: this._iceParameters, iceCandidates: this._iceCandidates, @@ -333,6 +337,10 @@ export class RemoteSdp { } receiveSctpAssociation(): void { + if (this._midToIndex.has('datachannel')) { + return; + } + const mediaSection = new OfferMediaSection({ iceParameters: this._iceParameters, iceCandidates: this._iceCandidates,