Skip to content

Commit

Permalink
dont attempt to overwrite RTCSessionDescription.sdp
Browse files Browse the repository at this point in the history
follow-up on #1042
  • Loading branch information
fippo committed Mar 10, 2021
1 parent 0656728 commit 6a62de1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/js/common_shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,18 @@ export function removeExtmapAllowMixed(window, browserDetails) {
window.RTCPeerConnection.prototype.setRemoteDescription =
function setRemoteDescription(desc) {
if (desc && desc.sdp && desc.sdp.indexOf('\na=extmap-allow-mixed') !== -1) {
desc.sdp = desc.sdp.split('\n').filter((line) => {
const sdp = desc.sdp.split('\n').filter((line) => {
return line.trim() !== 'a=extmap-allow-mixed';
}).join('\n');
// Safari enforces read-only-ness of RTCSessionDescription fields.
if (desc instanceof RTCSessionDescription) {
arguments[0] = new RTCSessionDescription({
type: desc.type,
sdp,
});
} else {
desc.sdp = sdp;
}
}
return nativeSRD.apply(this, arguments);
};
Expand Down

0 comments on commit 6a62de1

Please sign in to comment.