W3C home > Mailing lists > Public > public-webrtc@w3.org > March 2014

Re: Panic between createOffer() and setLocalDescription()

From: Kiran Kumar <g.kiranreddy4u@gmail.com>
Date: Mon, 10 Mar 2014 12:45:55 +0530
Message-ID: <CAGW1TF7o2=y+FL-XJzW_wHfPb5DCfZhnET_4QHe6xi5yonUr4w@mail.gmail.com>
To: Harald Alvestrand <harald@alvestrand.no>
Cc: "piranna@gmail.com" <piranna@gmail.com>, public-webrtc <public-webrtc@w3.org>
Modifying the API will delay the shipment of webrtc 1.0.
I haven't went through this mail chain in dept, but after checking this
mail chain in a faster overview, I would like to add my suggestions as
follows.

1) Add an attribute of boolean variable "sdpMangling", so that if
1.1)  If sdpMangling is false, then either skip calling setLocalDescription
and continue to send offer from java script or set it as it is now without
changing. (Any changes to sdp after selecting sdpMangling false should
throw an exception and continue with the sdp returned in the createOffer).
1.2) If sdpMangling is set to true, then UA should be provided with a list
of parameters/attributes that he is allowed to modify.
1.2.1) The list should be at high-level and with no risk of delaying webrtc
1.0 for now (like changing codec priority etc).

Setting sdpMangling to false (which is case for majority of scenarios/apps)
will speedup the process, because browser can start processing the sdp
without waiting for setLocalDescription.


Thanks,
Kiran.



On Fri, Feb 28, 2014 at 5:43 PM, Harald Alvestrand <harald@alvestrand.no>wrote:

> On 02/20/2014 12:32 PM, piranna@gmail.com wrote:
> > Callback hell from real code:
> >
> >
> > peerConnection.setRemoteDescription(offer, function()
> > {
> >   peerConnection.createAnswer(function(answer)
> >   {
> >     peerConnection.setLocalDescription(answer, function()
> >     {
> >
> >         // Send back answer SDP
> >
> >     },
> >     console.error);
> >   },
> >   console.error);
> > },
> > console.error);
>
> Apart from the rudimentary error handling, what's wrong with it?
>
> (I may have achieved Javascript brain damage, but this clearly shows
> that you do three things one after another, and do nothing inbetween.
> Time may pass between all 3 things, which is important to know about -
> in particular, you will begin sending media data before you attempt to
> send the SDP back to the offerer; I assume this is intentional.)
>
>
> >
> >
> > I have just noticed this on the code I'm using. I was doing mostly a
> > copy&paste of this snippet between my projects since it was a "live
> > with it" issue, by since this discussion started I'm now seeing how
> > much disturbing the current API is. As you can see here, definitely
> > for the most basic cases not only the setLocalDescription() could be
> > integrated on createOffer(), but as you can see here for the most
> > common use cases also the trio of
> > setRemoteDescription-createAnswer-setLocalDescription could be merged
> > in just one function (createAnswer() giving the offer as first
> > parameter? a new one processOffer()?).
>
> If you want one function, it is easy for you to wrap them (as you have
> done).
> If the API had only one function, there would be no way for you to tease
> them apart.
>
> Having the option of having to call one, two or three functions
> depending on the invocation parameters of each of them would seem to me
> to be the most confusing alternative.
>
> >
> > 2014-02-20 10:44 GMT+01:00 piranna@gmail.com <piranna@gmail.com>:
> >>> I'm not sure that's a compelling reason to separate the two, but it's a
> >>> possible reason, even in the absence of SDP modification.
> >>>
> >> I'm not saying to remove setLocalDescription(), I'm only saying that
> >> for most use cases is redundant to call to
> >> createOffer()/createAnswer() and inmediately to setLocalDescription(),
> >> so I'll change the spec to do the call implicitly and if some changes
> >> are required, let the user to do the call explicitly, overwritting
> >> this way the content of the local description with its custom one.
> >> This will make easier to new comers what's the call flow:
> >>
> >> createOffer() -> send()
> >> onmessage -> setRemoteDescription()
> >> createAnswer() -> send()
> >> onmessage -> setRemoteDescription()
> >>
> >> Honestly, if you need to call to setLocalDescription() with a modified
> >> SDP, you are not in "WebRTC 101" anymore... Why complicate it?
> >>
> >>
> >> --
> >> "Si quieres viajar alrededor del mundo y ser invitado a hablar en un
> >> monton de sitios diferentes, simplemente escribe un sistema operativo
> >> Unix."
> >> - Linus Tordvals, creador del sistema operativo Linux
> >
> >
>
>
> --
> Surveillance is pervasive. Go Dark.
>
>
>
Received on Monday, 10 March 2014 07:16:47 UTC

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