diff --git a/package-lock.json b/package-lock.json index c6af696d..d719b369 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8624,7 +8624,7 @@ }, "packages/webrtc": { "name": "werift", - "version": "0.18.15", + "version": "0.18.16", "license": "MIT", "dependencies": { "@fidm/x509": "^1.2.1", diff --git a/packages/webrtc/package.json b/packages/webrtc/package.json index 38f09c1f..5b6d48c0 100644 --- a/packages/webrtc/package.json +++ b/packages/webrtc/package.json @@ -1,6 +1,6 @@ { "name": "werift", - "version": "0.18.15", + "version": "0.18.16", "description": "WebRTC Implementation for TypeScript (Node.js)", "keywords": [ "WebRTC", diff --git a/packages/webrtc/src/media/rtpSender.ts b/packages/webrtc/src/media/rtpSender.ts index 4a07a4fb..94c4a351 100644 --- a/packages/webrtc/src/media/rtpSender.ts +++ b/packages/webrtc/src/media/rtpSender.ts @@ -327,6 +327,7 @@ export class RTCRtpSender { const ntpTimestamp = ntpTime(); + const originalHeaderExtensions = [...header.extensions]; header.extensions = this.headerExtensions .map((extension) => { const payload = (() => { @@ -364,6 +365,15 @@ export class RTCRtpSender { if (payload) return { id: extension.id, payload }; }) .filter((v) => v) as Extension[]; + for (const ext of originalHeaderExtensions) { + const exist = header.extensions.find((v) => v.id === ext.id); + if (exist) { + exist.payload = ext.payload; + } else { + header.extensions.push(ext); + } + } + header.extensions = header.extensions.sort((a, b) => a.id - b.id); this.ntpTimestamp = ntpTimestamp; this.rtpTimestamp = header.timestamp;