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

Re: New JSEP draft posted

From: Justin Uberti <juberti@google.com>
Date: Fri, 10 Feb 2012 11:02:51 -0500
Message-ID: <CAOJ7v-1k6wiOH6ftBwM4DtOkF6PAV6K2oJbj0J8mH7NF0y_b8g@mail.gmail.com>
To: Adam Bergkvist <adam.bergkvist@ericsson.com>
Cc: "rtcweb@ietf.org" <rtcweb@ietf.org>, "public-webrtc@w3.org" <public-webrtc@w3.org>
Updated sample below. Changes (move of startIce) are in *bold*.

      var signalingChannel = createSignalingChannel();
   var pc = null;
   var hasCandidates = false;

   function start(isCaller) {
     // create a PeerConnection and hook up the IceCallback
     pc = new webkitPeerConnection(
            "", function (candidate, moreToFollow) {
       if (!moreToFollow) {
         hasCandidates = true;
         maybeSignal(isCaller);
       }
     });

     // get the local stream and show it in the local video element
     navigator.webkitGetUserMedia(
           {"audio": true, "video": true}, function (localStream) {
       selfView.src = webkitURL.createObjectURL(localStream);
       pc.addStream(localStream);
       maybeSignal(isCaller);
     }

     // once remote stream arrives, show it in the remote video element
     pc.onaddstream = function(evt) {
       remoteView.src = webkitURL.createObjectURL(evt.stream);
     };

    * // if we're the caller, create and install our offer,*
*     // and start candidate generation*
*     if (isCaller) {*
*       offer = pc.createOffer(null);*
*       pc.setLocalDescription(SDP_OFFER, offer);*
*       pc.startIce();*
*     }*
   }

   function maybeSignal(isCaller) {
     // only signal once we have a local stream and local candidates
     if (localStreams.size() == 0 || !hasCandidates) return;
     if (isCaller) {
   *    offer = pc.localDescription;*
       signalingChannel.send(
           JSON.stringify({ "type": "offer", "sdp": offer }));
     } else {
       // if we're the callee, generate, apply, and send the answer
       answer = pc.createAnswer(pc.remoteDescription, null);
       pc.setLocalDescription(SDP_ANSWER, answer);
       signalingChannel.send(
           JSON.stringify({ "type": "answer", "sdp": answer }));
     }
   }

   signalingChannel.onmessage = function(evt) {
     var msg = JSON.parse(evt.data);
     if (msg.type == "offer") {
       // create the PeerConnection
       start(false);
       // feed the received offer into the PeerConnection and
       // start candidate generation
       pc.setRemoteDescription(PeerConnection.SDP_OFFER, msg.sdp);
       pc.startIce();
     } else if (msg.type == "answer") {
       // feed the answer into the PeerConnection to complete setup
       pc.setRemoteDescription(PeerConnection.SDP_ANSWER, msg.sdp);
     }


On Fri, Feb 10, 2012 at 9:03 AM, Justin Uberti <juberti@google.com> wrote:

>
>
> On Fri, Feb 10, 2012 at 6:07 AM, Adam Bergkvist <
> adam.bergkvist@ericsson.com> wrote:
>
>> On 02/08/2012 09:57 PM, Justin Uberti wrote:
>>
>>> Now available at http://www.ietf.org/id/draft-**
>>> uberti-rtcweb-jsep-01.txt<http://www.ietf.org/id/draft-uberti-rtcweb-jsep-01.txt>
>>>
>>> Includes changes based on implementation feedback, and I believe it
>>> addresses most of the concerns raised in last week's interim meetings:
>>> - Initial documentation provided for each API call, and what state
>>> changes it causes
>>> - More examples, including a complete basic sample application
>>> - Simplified approach to trickle candidate handling
>>> - Resolved concerns about how to separate SDP attributes into media /
>>> transport
>>> - Provided encapsulation for SDP blobs and ICE candidate lines, in the
>>> event we want to change encodings or provide helper functions for JS
>>> - Provided mechanism for limiting candidates to TURN-only
>>> - Resolved several implementation issues
>>>
>>> I have not yet addressed the non-overlapping codec concern mentioned in
>>> the interim meeting. I think there are ways of handling this either in
>>> the application or the implementation, but I wanted to get this -01 out
>>> first for feedback.
>>>
>>
>> Good to see a concrete JS example. Some comments below.
>>
>> I believe the example has a deadlock on the caller side:
>> * hasCandidates (initially false) is set true by the ice callback
>> * the ice callback can never trigger before startIce() is called
>> * maybeSignal(), which calls startIce(), will return early if
>> hasCandidates is false
>>
>
> You're right. startIce() should be called in start(), if |isCaller| is
> true.
>
>>
>> Another thing, how are the candidates from the ice callback included in
>> the offer? The candidate argument from the ice callback is never used.
>
>
> As mentioned in the draft, candidates are included in the offer
> automatically (if they have already been gathered). In the example, we just
> wait for the IceCallback to inform us that gathering is complete, and use
> that to know when to dispatch the offer.
>
>>
>>
>> /Adam
>>
>
>
Received on Friday, 10 February 2012 16:03:41 UTC

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