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 de0348c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/js/common_shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,19 @@ 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 (window.RTCSessionDescription &&
desc instanceof window.RTCSessionDescription) {
arguments[0] = new window.RTCSessionDescription({
type: desc.type,
sdp,
});
} else {
desc.sdp = sdp;
}
}
return nativeSRD.apply(this, arguments);
};
Expand Down

0 comments on commit de0348c

Please sign in to comment.