[webrtc-pc] Simplify candidate interaction by allowing Null

alvestrand has just created a new issue for https://github.com/w3c/webrtc-pc:

== Simplify candidate interaction by allowing Null ==
We see a lot of code like this (this is a change from Firefox to making it work on Chrome)
<pre>
var onIceCandidateToSecond = function(event) {
-    gFirstConnection.addIceCandidate(event.candidate);
+    if (event.candidate) {
+      gFirstConnection.addIceCandidate(event.candidate);
+    }
   };
</pre>

Life for developers would be easier if they could just write the "addiceCandidate" and not the "if".
This requires inserting a line in "addIceCandidate" processing that says "If candidate is null, abort these steps and return". All existing code should still work, since nothing new is being forbidden.

This has been discussed before. Not a big issue, but reducing the number of things developers have to think about is generally a Good Thing.







Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1773 using your GitHub account

Received on Thursday, 15 February 2018 11:15:20 UTC