W3C home > Mailing lists > Public > public-webrtc@w3.org > September 2015

Re: RTCSessionDescription and RTCIceCandidate

From: Jan-Ivar Bruaroey <jib@mozilla.com>
Date: Mon, 14 Sep 2015 23:05:45 -0400
To: Martin Thomson <martin.thomson@gmail.com>, Harald Alvestrand <harald@alvestrand.no>
Cc: "public-webrtc@w3.org" <public-webrtc@w3.org>
Message-ID: <55F78B09.9080103@mozilla.com>
On 9/14/15 5:08 PM, Martin Thomson wrote:
> On 14 September 2015 at 14:03, Harald Alvestrand <harald@alvestrand.no> wrote:
>> I don't see any huge advantage of using "dictionary" over "interface",
>> but that may be just me.
> Here's why:
>
> Previously:
>
> signaling.oncandidate = c => {
>    RTCIceCandidate = RTCIceCandidate || mozRTCIceCandidate;
>    pc.addIceCandidate(new RTCIceCandidate(c));
> };
>
> With the change:
>
> signaling.oncandidate = c => {
>    pc.addIceCandidate(c);
> };

I agree.

Though strictly speaking, we don't need to get rid of the 
RTCIceCandidate interface to accomplish this. All we'd need is:

   -  Promise<void> addIceCandidate (RTCIceCandidate candidate);
   +  Promise<void> addIceCandidate (optional RTCIceCandidateInit 
candidate);

Since the interface has a serializer, addIceCandidate will now accept 
either. *

That said, I see little value in keeping a serializable interface for 
its readonly properties, given how malleable it is:

     pc.onicecandidate = e => {
       var can = JSON.parse(JSON.stringify(e.candidate));
       can. sdpMLineIndex++;
       can = new RTCIceCandidate(can);
       // Do something with can...
     };

.: Jan-Ivar :.

*) the init-dict pattern was designed with interface-cloning in mind.
Received on Tuesday, 15 September 2015 03:06:15 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 15:19:46 UTC