Re: [rtcweb] My Opinion: Why I think a negotiating protocol is a Good Thing

Hadriel Kaplan <HKaplan@acmepacket.com> Fri, 21 October 2011 07:12 UTC

Return-Path: <HKaplan@acmepacket.com>
X-Original-To: rtcweb@ietfa.amsl.com
Delivered-To: rtcweb@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C1CE321F858C for <rtcweb@ietfa.amsl.com>; Fri, 21 Oct 2011 00:12:11 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.111
X-Spam-Level:
X-Spam-Status: No, score=-2.111 tagged_above=-999 required=5 tests=[AWL=-0.112, BAYES_00=-2.599, J_CHICKENPOX_15=0.6]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1nwt19zX80go for <rtcweb@ietfa.amsl.com>; Fri, 21 Oct 2011 00:12:11 -0700 (PDT)
Received: from etmail.acmepacket.com (etmail.acmepacket.com [216.41.24.6]) by ietfa.amsl.com (Postfix) with ESMTP id 0882021F8562 for <rtcweb@ietf.org>; Fri, 21 Oct 2011 00:12:01 -0700 (PDT)
Received: from MAIL2.acmepacket.com (10.0.0.22) by etmail.acmepacket.com (216.41.24.6) with Microsoft SMTP Server (TLS) id 8.2.254.0; Fri, 21 Oct 2011 03:11:53 -0400
Received: from MAIL1.acmepacket.com ([169.254.1.230]) by Mail2.acmepacket.com ([169.254.2.157]) with mapi id 14.01.0270.001; Fri, 21 Oct 2011 03:11:54 -0400
From: Hadriel Kaplan <HKaplan@acmepacket.com>
To: Cullen Jennings <fluffy@cisco.com>
Thread-Topic: [rtcweb] My Opinion: Why I think a negotiating protocol is a Good Thing
Thread-Index: AQHMj8C2DClMf3FX2Eu6JNnlQamw7Q==
Date: Fri, 21 Oct 2011 07:11:53 +0000
Message-ID: <F1CFA432-9541-4CF1-BFCE-7B50E140A357@acmepacket.com>
References: <4E9D667A.2040703@alvestrand.no> <9B03E9E2-4376-465E-84F5-EDAC51390408@phonefromhere.com> <B5F4C6D1-3F54-4242-A89C-C2FC66AF8E7D@cisco.com> <570BDE5E-6EDC-4094-8DC0-094CEC3F12DF@acmepacket.com> <E44893DD4E290745BB608EB23FDDB7620DE659@008-AM1MPN1-043.mgdnok.nokia.com> <773FB266-721F-4C51-81A6-C01778BB68DF@cisco.com> <B6990248-74BB-4421-8EEB-A99D3432B854@acmepacket.com> <018D7B69-3A31-480F-BFDD-EA083CF00B13@cisco.com>
In-Reply-To: <018D7B69-3A31-480F-BFDD-EA083CF00B13@cisco.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [216.41.24.34]
Content-Type: text/plain; charset="us-ascii"
Content-ID: <08083A11807CB14A8DA36A10E676F98B@acmepacket.com>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Brightmail-Tracker: AAAAAQAAAWE=
Cc: "<rtcweb@ietf.org>" <rtcweb@ietf.org>
Subject: Re: [rtcweb] My Opinion: Why I think a negotiating protocol is a Good Thing
X-BeenThere: rtcweb@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Real-Time Communication in WEB-browsers working group list <rtcweb.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/rtcweb>, <mailto:rtcweb-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/rtcweb>
List-Post: <mailto:rtcweb@ietf.org>
List-Help: <mailto:rtcweb-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/rtcweb>, <mailto:rtcweb-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 21 Oct 2011 07:12:11 -0000

On Oct 21, 2011, at 12:35 AM, Cullen Jennings wrote:
> 
> I'm happy to ignore T.38 as a "special case" but new codecs, video codecs in particular, need to define new parameters. Lets say a given codec defines some new parameters that show up in some normal spot in SDP, I don't see how the JS app will be able to negotiation without understanding what the new parameters mean. Lets say some new VP9 video codec defines a new maxFluffyDepth and the browser reports that it support 666. The other other side offers a maxFlufflyDepth=Yes. What does the Javascript code select? It might be that the based on these you even use a different parameter, say fluffyDepth=-6ft , to specify the interoperable solution. 

I'm not sure you're following what I meant, or else I'm not following you.  
If a new codec VP9 needed to indicate a "maxFluffyDepth" and it supports a value of "666", then when JS calls a getter on the API for available codec info, in the array-list of returned codecs it sees something like this:

returnedArrayOfLocalVideoCodecs = [
	{ "payload-type": 99, "name": "H263-2000", "clock" : 90000, "fmtp": "CIF=4;QCIF=2;F=1;K=1" },
	{ "payload-type": 100, "name": "VP9", "clock": 64000, "fmtp": "maxFluffyDepth=666" },
	...
]

(that's not actually exactly what I would do, BTW, but just for sake of simplicity)

JS could, if it so wished, only use entries in that array it understood.  OR, it could use any/all of them.  How it uses them exactly is app-specific.  It could stringify this into JSON, etc.

But let's just say it wants to turn this into SDP and use offer/answer.  Lucky for us there's a sdpForDummies.js library which does that, so this is all in that library.  The library knows nothing about codec VP9, but it knows how to produce attributes and such using the fields defined in the API, so it creates this:

[some SDP lines missing because I'm lazy]

m=video 1234 RTP/AVPF 99 100
a=rtpmap:99 H263-2000/90000
a=fmtp:99 CIF=4;QCIF=2;F=1;K=1
a=rtpmap:100 VP9/64000
a=fmtp:100 maxFluffyDepth=666

Then let's say it gets an SDP answer back of this:
m=video 5678 RTP/AVPF 100
a=rtpmap:100 VP9/64000
a=fmtp:100 maxFluffyDepth=Yes

So sdpForDummies.js understands the SDP offer/answer model, but not the codec chosen.  But it does what it does in every case: it parses it, sees the fmtp stuff and treats that as a opaque string, and calls a Browser API setter function like 
	MediaStream.setRemoteCodec(1, 100, 64000, "maxFluffyDepth=Yes"); 
	// the first arg=1 is the array index of codecs for "VP9"

You can say "well isn't that like an answer/offer just with SDP parsed out as Javascript integral data types?"  And I would say no it's not - the Browser's maintaining no offer/answer state, it's not handling forking, it's not handling reversion in case of failure, it's not parsing protocol messages (ie, SDP), and it's not making decisions unbeknownst to the JavaScript.  In short: it's an API rather than a protocol. 

Will there be some future case that could require the JS to change when the Browser does something new?  Of course.  But JS developers are incredibly fast at changing code and getting it deployed/used compared to timescales of Browser changes.  If the JS app developer wants to enable some new doohicky that really did new things differently in an incompatible way, then the JS developer will do it.  We don't need to tell them how to do their job.  We need to *let* them do their job, and their job is code.

-hadriel
p.s. as a side benefit, doing this might also keep us honest in MMUSIC about how we encode things and handle SDP offer/answer consistently across codecs.  :)