webrtc: fix Safari addIceCandidate crash

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2039>
This commit is contained in:
Robert Ayrapetyan 2025-01-13 12:45:56 -08:00 committed by GStreamer Marge Bot
parent 06939540a1
commit e82e5fe5ae
3 changed files with 2 additions and 17 deletions

View file

@ -58,7 +58,6 @@
"webpack-dev-server": "4.15.1"
},
"dependencies": {
"patch-package": "8.0.0",
"webrtc-adapter": "8.2.3"
},
"scripts": {
@ -69,7 +68,6 @@
"make": "npm run check && npm run build && npm run docs",
"test": "mocha --node-env=test --exit",
"prepack": "npm run test && npm run make",
"start": "webpack serve",
"postinstall": "patch-package"
"start": "webpack serve"
}
}

View file

@ -1,13 +0,0 @@
diff --git a/node_modules/webrtc-adapter/src/js/common_shim.js b/node_modules/webrtc-adapter/src/js/common_shim.js
index 96d7c8e..063ea64 100644
--- a/node_modules/webrtc-adapter/src/js/common_shim.js
+++ b/node_modules/webrtc-adapter/src/js/common_shim.js
@@ -388,7 +388,7 @@ export function shimAddIceCandidateNullOrEmpty(window, browserDetails) {
}
const nativeAddIceCandidate =
window.RTCPeerConnection.prototype.addIceCandidate;
- if (!nativeAddIceCandidate || nativeAddIceCandidate.length === 0) {
+ if (!nativeAddIceCandidate) {
return;
}
window.RTCPeerConnection.prototype.addIceCandidate =

View file

@ -341,7 +341,7 @@ class ConsumerSession extends WebRTCSession {
});
}
} else if (msg.ice) {
const candidate = new RTCIceCandidate(msg.ice);
const candidate = msg.ice.candidate ? new RTCIceCandidate(msg.ice) : null;
this._rtcPeerConnection.addIceCandidate(candidate).catch((ex) => {
if (this._state !== SessionState.closed) {
this.dispatchEvent(new ErrorEvent("error", {