W3C home > Mailing lists > Public > public-webrtc@w3.org > July 2012

RE: Making RTCSessionDescription and RTCIceCandidate much more flexible

From: Li Li <Li.NJ.Li@huawei.com>
Date: Tue, 31 Jul 2012 15:09:45 +0000
To: Tommy Widenflycht (ᛏᚮᛘᛘᚤ) <tommyw@google.com>, "public-webrtc@w3.org" <public-webrtc@w3.org>
Message-ID: <B60F8F444AAC9C49A9EF0D12D05E0942216B720E@szxeml535-mbs.china.huawei.com>
The current constructor forces the requirement that any SessionDescription object should always have two components: a type and SDP string. Your proposal relaxes this requirement to allow the object to have one or none of the components at some time.

Beside more alternative ways to construct the object, could you elaborate the use cases for this proposal?

Thanks.
Li

From: Tommy Widenflycht (ᛏᚮᛘᛘᚤ) [mailto:tommyw@google.com]
Sent: Tuesday, July 31, 2012 5:42 AM
To: public-webrtc@w3.org
Subject: Making RTCSessionDescription and RTCIceCandidate much more flexible

Hello list members,

Today I would like to propose a small change to RTCSessionDescription and RTCIceCandidate which would make the much more flexible:

[Constructor(optional Dictionary description)]
interface RTCSessionDescription {
             attribute RTCSdpType type;
             attribute DOMString  sdp;
};

In short the single constructor takes an Dictionary which is expected to mimic its members, and the stringifier method is removed.


This has the advantages of being extremely powerful:

sd = new RTCSessionDescription();
sd.sdp = ...;
sd.type = ...;

sd = new RTCSessionDescription({sdp:"..."});
sd.type = ...;

sd = new RTCSessionDescription({type:"answer", sdp:"..."});

sd = new RTCSessionDescription(JSON.parse(some_json_string));

sd2 = new RTCSessionDescription(sd);

and in the other direction

jsonified_sd = JSON.stringify(sd);


There's some precedence in using a constructor like this in some of the base Event classes.


Regards,
Tommy

--
Tommy Widenflycht, Senior Software Engineer
Google Sweden AB, Kungsbron 2, SE-11122 Stockholm, Sweden
Org. nr. 556656-6880
And yes, I have to include the above in every outgoing email according to EU law.
Received on Tuesday, 31 July 2012 15:12:44 UTC

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