Subject: Re: [rtcweb] Default candidate pool size

From: Kiran Kumar Guduru <[email-masked]>
Date: Tue, 13 May 2014 10:29:23 +0000 (GMT)

Hi All,

As per WebRTC spec,

The localDescription attribute must return the RTCSessionDescription that was most recently passed to setLocalDescription(), plus any local candidates that have been generated by the ICE Agent since then.

A null object will be returned if the local description has not yet been set.

That is, candidates gathered will be added to SDP, only if localDescription is set (Becuase before setLocalDescription called for first time, localDescription will be NULL).

Now what about the following scenario.

CASE- I

1. createOffer(...)

2. onIceCandidate()

3. setLocalDescription().

I agree that setLocalDescription should be called immediately after createOffer, chances always there for receiving a candidate before localDescription is called.

How to add this to localDescription?

and

CASE-II

1. createOffer(...)

2. setLocalDescription().

3. onIceCandidate()

4. createOffer(...) (with one ice candidate)

5. onIceCandidate()

6. setLocalDescription()(with Once IceCandidate)

Should the new setLocalDescription call (with 1 ICE candidate) override the existing localDescription with 2 ICE candidates?

-------Original Message--------
Sent: Martin Thomson <[email-masked]>
Date: Mon, 12 May 2014 11:59:28 -0700
Subject: Re: [rtcweb] When are ICE candidates added to the SDP

Why not:

1. pc.createOffer(...)

2. success callback fires (0 candidates)

3. pc.setLocalDescription(offer)

4. onicecandidate fires some number of times

5. onicecandidate fires with a null candidate

6. send pc.localDescription (as opposed to the original offer)

No need to run multiple rounds of createOffer or anything nasty like that. Note that we don't have an onicegatheringstatechange event that would let us monitor that state more directly, but the actual code cost is identical either way.

On 12 May 2014 09:14, Harald Alvestrand wrote:

> On 05/12/2014 05:17 PM, Eric Rescorla wrote:

> > > > > On Mon, May 12, 2014 at 6:51 AM, Harald Alvestrand > wrote: >> >> On 05/12/2014 02:39 PM, Eric Rescorla wrote: >> >> >> >> >> On Mon, May 12, 2014 at 2:03 AM, Rauschenbach, Uwe (NSN - DE/Munich) >> wrote: >>> >>> Hi Eric, all, >>> >>> >>> >>> Is the consequence of âalways trickleâ that ICE candidates have to be >>> added by non-trickling applications via SDP manipulation? >>> >>> I consider this indeed quite inconvenient for non-trickling applications. >> >> >> So, my understanding was that we had agreed that no candidates would >> be available in the first CreateOffer() no matter how many candidates were >> in the pool. >> >> The intent of this message is to ask if that is useful. >> >> >> If an application is written as >> >> 1) CreateOffer() >> 2) wait for the end of candidates callback >> 3) negotiate >> >> then I would think it might have trouble if all the candidates are present >> in the SDP, and therefore no callbacks were called. >> Solution: Always fire the end of candidates callback after calling the >> success callback, even if all candidates are in the SDP already. > > > So you mean: > > 1. CreateOffer() > 2. success callback fires. > 3. SetLocal() > 4. onicecandidate(...) > 5. onicecandidate(null) > > Then later (w/ no changes to the MSTs) > > 6. CreateOffer() > 7. success callback fires > 8. SetLocal (????) > 9. onicecandidate(null) > > I believe this would be a change to the W3C API (not that this is > necessarily bad) > > > Something like that, yes. Or in more detail, for a call requiring 2 > candidates: > > 1. CreateOffer() > 2. success callback fires (1 candidate present) > 3. SetLocal() > 4. onicecandidate(...) > 5. onicecandidate(null) > > Then later (w/ no changes to the MSTs) > > 6. CreateOffer() > 7. success callback fires (2 candidates present) > 8. SetLocal () > 9. onicecandidate(null) > > Then still later (after having done something that requires a 3rd > candidate): > > 10. CreateOffer() > 11. successCallback fires (2 candidates present) > 12. SetLocal() > 13. onicecandidate(...) > 14. onicecandidate(null) > > If we don't have the null onicecandidate in case 2 (step 9), it gets hard to > support case 3 (step 12-14). > > > -Ekr > >> >> >> >> -Ekr >> >>> A way out would be that the SDP always contains the candidates collected >>> so far (as currently defined in the JSEP snippet cited), >>> >>> or that a switch in the API allows an application to configure the >>> behavior when adding ICE candidates. >>> >>> >>> >>> Kind regards, >>> Uwe >>> >>> >>> >>> >>> >>> From: rtcweb [mailto:[email-masked]] On Behalf Of ext Eric >>> Rescorla >>> Sent: Monday, May 12, 2014 8:52 AM >>> To: [email-masked] >>> Subject: [rtcweb] When are ICE candidates added to the SDP >>> >>> >>> >>> See: https://github.com/rtcweb-wg/jsep/issues/11 >>> >>> >>> >>> Section 3.4 reads: >>> >>> >>> >>> When a new ICE candidate is available, the ICE Agent will notify the >>> >>> application via a callback; these candidates will automatically be >>> >>> added to the local session description. When all candidates have >>> >>> been gathered, the callback will also be invoked to signal that the >>> >>> gathering process is complete. >>> >>> >>> >>> However, we agreed in London that we would do "always trickle", and >>> >>> that even if there were candidates available at the time when CreateOffer >>> >>> (because of candidate pooling) was called, they would not be included >>> >>> in the initial offer. Consider the following sequence of events. >>> >>> >>> >>> 0. pc = new RTCPeerConnection(); >>> >>> 1. pc.AddStream(stream); >>> >>> 2. pc.CreateOffer(); >>> >>> 3. CreateOffer callback fires with offer A, and you call >>> SetLocalDescription(); >>> >>> 4. onicecandidate fires with candidate X. >>> >>> 5. pc.CreateOffer() >>> >>> 6. CreateOffer callback fires with offer B. >>> >>> 7. onicecandidate fires with null. >>> >>> >>> >>> So, in London, I think we agreed that offer A would have no candidates. >>> >>> The above text implies that if you were to examine localdescription prior >>> >>> to step #5 or at step #7 it would contain candidate X, and probably that >>> offer B would >>> >>> also contain candidate X. >>> >>> >>> >>> Note that it's quite inconvenient for non-trickle applications to never >>> >>> have any candidates in the SDP, especially after gathering is completed >>> >>> at step #7. However it also seems kind of inconsistent to only update the >>> >>> candidates after SetLocal() has been called. >>> >>> >>> >>> -Ekr >>> >>> >> >> >> >> >> _______________________________________________ >> rtcweb mailing list >> [email-masked] >> https://www.ietf.org/mailman/listinfo/rtcweb >> >> >> >> -- >> Surveillance is pervasive. Go Dark. >> >> >> _______________________________________________ >> rtcweb mailing list >> [email-masked] >> https://www.ietf.org/mailman/listinfo/rtcweb >> > > > > _______________________________________________ > rtcweb mailing list > [email-masked] > https://www.ietf.org/mailman/listinfo/rtcweb >
-------Original Message--------
Sent: "Rauschenbach, Uwe (NSN - DE/Munich)" <[email-masked]>
Date: Tue, 13 May 2014 03:44:46 +0000
Subject: Re: [rtcweb] When are ICE candidates added to the SDP

On Mon, May 12, 2014 at 2:03 AM, Rauschenbach, Uwe (NSN - DE/Munich) <[email-masked]> wrote:

Hi Eric, all,

Is the consequence of âalways trickleâ that ICE candidates have to be added by non-trickling applications via SDP manipulation?

I consider this indeed quite inconvenient for non-trickling applications.

So, my understanding was that we had agreed that no candidates would

be available in the first CreateOffer() no matter how many candidates were

in the pool.

The intent of this message is to ask if that is useful.

-Ekr

Thanks for clarifying. As long as the candidates are in the SDP that can be obtained via the API after the âend of candidatesâ, I think non-trickling applications should be OK.

I was concerned they would not end up in the SDP anymore.

-- Uwe

A way out would be that the SDP always contains the candidates collected so far (as currently defined in the JSEP snippet cited),

or that a switch in the API allows an application to configure the behavior when adding ICE candidates.

Kind regards,
Uwe

From: rtcweb [mailto:[email-masked]] On Behalf Of ext Eric Rescorla
Sent: Monday, May 12, 2014 8:52 AM
To: [email-masked]
Subject: [rtcweb] When are ICE candidates added to the SDP

See: https://github.com/rtcweb-wg/jsep/issues/11

Section 3.4 reads:

When a new ICE candidate is available, the ICE Agent will notify the

application via a callback; these candidates will automatically be

added to the local session description. When all candidates have

been gathered, the callback will also be invoked to signal that the

gathering process is complete.

However, we agreed in London that we would do "always trickle", and

that even if there were candidates available at the time when CreateOffer

(because of candidate pooling) was called, they would not be included

in the initial offer. Consider the following sequence of events.

0. pc = new RTCPeerConnection();

1. pc.AddStream(stream);

2. pc.CreateOffer();

3. CreateOffer callback fires with offer A, and you call SetLocalDescription();

4. onicecandidate fires with candidate X.

5. pc.CreateOffer()

6. CreateOffer callback fires with offer B.

7. onicecandidate fires with null.

So, in London, I think we agreed that offer A would have no candidates.

The above text implies that if you were to examine localdescription prior

to step #5 or at step #7 it would contain candidate X, and probably that offer B would

also contain candidate X.

Note that it's quite inconvenient for non-trickle applications to never

have any candidates in the SDP, especially after gathering is completed

at step #7. However it also seems kind of inconsistent to only update the

candidates after SetLocal() has been called.

-Ekr

---

From: Kiran Kumar Guduru <[email-masked]>
Date: Tue, 13 May 2014 12:00:44 +0000 (GMT)

AFAIK, the default value of '0' logically equals to that what we can achieve with iceTransports set to "none" (don't gather any candidate).

I suggest adding candidatePoolSize attribute to RTCConfiguration.

This attribute can be modified by invoking updateIce / setConfiguration (based on the consnsus).

And the default value to 1.

I don't have very strong objections to '0' but support '1' with and optimistic assumption that every node/ browser implementing this specification will support Bundle.

This will avoid latency incured in candidate gathering.

App developer can set it to '0', in case, if the app is running in mobile device (if it feels to reduce battery drain out at the expense of latency).

------- Original Message -------

Sender : Martin Thomson<[email-masked]>

Date : May 13, 2014 02:15 (GMT+09:00)

Title : Re: [rtcweb] Default candidate pool size

On 11 May 2014 17:18, Eric Rescorla wrote:
>
> My personal opinion is that candidate pooling is useful here and we
> should probably leave the default in the hands of the browser. I
> could live with 0 however.

I tend to agree.  The selection of a default seems like a good
opportunity for browsers to optimize.  For instance, a mobile device
might choose to defer gathering until it knows that it needs them;
whereas a device with a good source of power might prefer the latency
benefits associated with early gathering.  No point in us specifying
this.