Re: [rtcweb] Alternative Proposal for Dynamic Codec Parameter Change (Was: Re: Resolution negotiation - a contribution)

Justin Uberti <juberti@google.com> Tue, 01 May 2012 03:03 UTC

Return-Path: <juberti@google.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 2498121E8158 for <rtcweb@ietfa.amsl.com>; Mon, 30 Apr 2012 20:03:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -101.377
X-Spam-Level:
X-Spam-Status: No, score=-101.377 tagged_above=-999 required=5 tests=[AWL=-0.201, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, J_CHICKENPOX_53=0.6, J_CHICKENPOX_55=0.6, J_CHICKENPOX_56=0.6, RCVD_IN_DNSWL_LOW=-1, USER_IN_WHITELIST=-100]
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 5qTxYQD8qpj7 for <rtcweb@ietfa.amsl.com>; Mon, 30 Apr 2012 20:03:22 -0700 (PDT)
Received: from mail-qa0-f44.google.com (mail-qa0-f44.google.com [209.85.216.44]) by ietfa.amsl.com (Postfix) with ESMTP id D619321E8157 for <rtcweb@ietf.org>; Mon, 30 Apr 2012 20:03:21 -0700 (PDT)
Received: by qadz3 with SMTP id z3so1904312qad.10 for <rtcweb@ietf.org>; Mon, 30 Apr 2012 20:03:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-system-of-record; bh=SgD0CnY526IKm4ID3gKeMTWOA+5I7cHRkKm92o1amk4=; b=aBM8ynJQS4VpnjbP1ik6E3+f0HQVgiFa1SNG+nazVsaLoVEvgdLm4e2dAd8A1JpVfk q1ya+O0J2/QGApiis00wHQXaAKy5SnJox6n08ux1PDBVNP0oYbeu3iXFUIaU6Xvs+o4h /VUaacaxHha3xhV8sDgBpyVDGCy9rinxi/B8ompINITuMbeFC0M25/nDqVQmz3II3CEC /LY9R8jAEv6pZ41mUvdF23mGn9NxTH3O9++pYe0GLTg+zpX5fRM0Bhw6uhFhna3UrLtb Y+D1pStzCcqmPJ6zfuWiu47eL2ZlhRQFC5bi55VSAUXkF9RRZIkqncJ40R1AMLBxYS9s 4n1w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-system-of-record:x-gm-message-state; bh=SgD0CnY526IKm4ID3gKeMTWOA+5I7cHRkKm92o1amk4=; b=Q6r6FfBX0QPexBfZjQcFanjFG2s0+gIOWp5cm2qPtMX4lZGoUKQuLST8Ud2WUW4hiX iUMJznKA345gK/4Avgndq7Hd7P6SoLe/n10Tx7oZClgoUOYOMZPTZQ1EZJhAjiZCbZ/5 0FVL2LtDy+MtUCqQV/H9/7l9NCkMcDu7zb7YGv+BTNrN8aBBvrrmn1hPlkSzduY7RerE sFGF79fR4/RatqrOVcNOnzPnTokJO+0pjUo8PoLlTHUZNZ+exJcwQS1F10jsy9KseIWf 5nvwEcv54ewAzJPk/1Bulb4mM3jmbBQYPJqKe0ZR6j+qmRebgONhKJkOMtYm8QSJ4qdF AyrA==
Received: by 10.224.101.72 with SMTP id b8mr14843624qao.53.1335841401257; Mon, 30 Apr 2012 20:03:21 -0700 (PDT)
Received: by 10.224.101.72 with SMTP id b8mr14843612qao.53.1335841401055; Mon, 30 Apr 2012 20:03:21 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.229.217.129 with HTTP; Mon, 30 Apr 2012 20:02:59 -0700 (PDT)
In-Reply-To: <4F9E57BF.5000902@ericsson.com>
References: <4F869648.2020605@alvestrand.no> <4F96B7C9.1030609@ericsson.com> <CAOJ7v-0ZPxxPEpr6-r8tUyiWJ0MJz47s59kD2tiUPo7Tkj9qcA@mail.gmail.com> <4F980BA6.7070405@ericsson.com> <4F9822C2.7090602@alvestrand.no> <4F9E57BF.5000902@ericsson.com>
From: Justin Uberti <juberti@google.com>
Date: Mon, 30 Apr 2012 20:02:59 -0700
Message-ID: <CAOJ7v-3NAgcRtpmUwqqcHDWjQaPtk6XYKrhbD_7Ja19QFCmq1Q@mail.gmail.com>
To: Magnus Westerlund <magnus.westerlund@ericsson.com>
Content-Type: multipart/alternative; boundary=20cf30667c2f2faaa304bef0d06a
X-System-Of-Record: true
X-Gm-Message-State: ALoCoQmlN3ZYv7Uuly6eDj+A4rFxcmCztWmXwH0WPGSRCyK4YSK3pb50PkmF/gcxN8Sy+IdMlbgQh2mRWXbvwNTyM1/DBd/SWFmKCYOlSMmAuZdsgJpwgjkCxRs6R6rX4uQEUhbhvLo+
Cc: "rtcweb@ietf.org" <rtcweb@ietf.org>
Subject: Re: [rtcweb] Alternative Proposal for Dynamic Codec Parameter Change (Was: Re: Resolution negotiation - a contribution)
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: Tue, 01 May 2012 03:03:23 -0000

On Mon, Apr 30, 2012 at 2:13 AM, Magnus Westerlund <
magnus.westerlund@ericsson.com> wrote:

> On 2012-04-25 18:13, Harald Alvestrand wrote:
> > On 04/25/2012 04:35 PM, Magnus Westerlund wrote:
> >> On 2012-04-25 05:20, Justin Uberti wrote:
> >>> On Tue, Apr 24, 2012 at 10:25 AM, Magnus Westerlund
> >>> <magnus.westerlund@ericsson.com<mailto:magnus.westerlund@ericsson.com
> >>
> >>> wrote:
> >>>
> >>>      A) Using COP and using SDP based signaling for the dynamic
> changes are
> >>>      two quite different models in relation to how the interaction
> happens.
> >>>
> >>>      For COP this all happens in the browser, normally initiated by the
> >>>      browser's own determination that a COP request or notification is
> >>>      needed. Harald's proposal appears to require that the JS initiate
> a
> >>>      renegotiation. This puts a requirement on the implementation to
> listen
> >>>      to the correct callbacks to know when changes happens, such as
> window
> >>>      resize. To my knowledge there are not yet any proposals for how
> the
> >>>      browser can initiate a JSEP renegotiation.
> >>>
> >>>
> >>> Maybe I misunderstand what you are saying, but the application will
> >>> definitely know when the browser size changes, and can then trigger a
> >>> JSEP renegotiation by calling createOffer and shipping it off.
> >> Yes, they can but that requires them to write code to do this. With COP
> >> the browser can do it and it works well for all applications, not only
> >> the ones that have implementors that are aware of the need to do this.
> >>
> >> I am proposing a mechanism that makes the default behavior if you care
> >> nothing about controlling or optimizing this behavior in your JS to be
> >> good. In addition JS that wants to control it can affect the behavior
> >> through generic mechanisms, such as controlling the video element. And
> >> if clear need is shown and some functionality is missing, W3C can create
> >> an API to provide explicit control.
> > It's not at all clear to me that the browser being in control is right
> > for all cases.
> > Renegotiating has a cost, and some of the costs are known only to the
> > application.
> >
> > We may possibly handle this via constraints like
> > "VideoEnumRenegotiationTendency" or something like that - when you get
> > the proposal together more, I'd like to see the controls you're
> proposing.
> >>> I have the opposite concern - how can the browser know when the
> >>> application makes a change, for instance to display a participant in a
> >>> large view versus a small view? This may be possible if using a<video/>
> >>> for display, but I don't think it will be possible when using WebGL for
> >>> rendering, where the size of the view will be dictated only by the
> >>> geometry of the scene.
> >> What I understand from my colleagues is that all rendering of video have
> >> to go through a video element, even if not displayed directly. Thus the
> >> application can control the size of the video element used and possibly
> >> consumed by WebGL to be included in rendering. Thus the application will
> >> have control over this even when COP is being used.
> > We have on the "list of things that need doing" the connection of a
> > mediastream directly to a canvas, a WebGL element or being captured to a
> > file, so don't gamble too much on the video element to stay in the path.
> >
> > Example code for capturing video to a canvas (taken from a real app):
> >
> >         video.src = webkitURL.createObjectURL(s);
> >         canvas.getContext("2d").drawImage(video, 0, 0, 300, 300, 0, 0,
> > 300, 300);
>
> According to my Colleague Per-Erik you can use video.width and
> video.height to set the resolution the video element should have.
>
> see
> http://dev.w3.org/html5/spec/the-video-element.html#the-video-element
>
> Thus the code you presented should be something like.
>
> video.src = webkitURL.createObjectURL(s);
> video.width = 300;
> video.height = 300;
> canvas.getContext("2d").drawImage(video, 0, 0, 300, 300);
>
> That would set the video objects size to a 300, 300 video resolution.
> The drawImage call I have removed the part which selects a cropping of
> the source video to automatically show the full video in the specified
> area.
>
> The adaptation of the video will of course not happen instantly so until
> that happens the video will be scaled to the specified width and height.
> And the actual delivered resolution will depend on the COP request and
> what the sender support.
>

I think this is a reasonable way to approach the problem as long as a
<video/> element stays in the path. But as Harald mentions we have already
considered several usages where a <video/> would not be in the path, i.e.
connecting a MediaStream to a file, or perhaps as input to another
PeerConnection.

Perhaps we need to provide hooks directly on the MediaStream to allow the
resolution to be specified, and these hooks are invoked automatically when
the MediaStream is connected to a <video/>.

>
> >> I agree that it needs to be clearly specified. But COP appears to be
> >> less prone to complete failures by using target values. Then at least it
> >> will receive video that can be used, even if not optimal. imageattr can
> >> result in failures in the negotiation requiring at minimal a second
> >> round potentially no agreed on acceptable resolution then that is
> >> clearly sub-optimal. That is even without considering involving JS
> >> mainipulating this.
> >
> > I certainly hope that we can avoid the need for SDP manipulation of JS
> > in all of these proposals.
> >
>
> Looking forward to a bit more detailed explanation of how that is
> accomplished in relation to the API.
>
> Cheers
>
> Magnus Westerlund
>
> ----------------------------------------------------------------------
> Multimedia Technologies, Ericsson Research EAB/TVM
> ----------------------------------------------------------------------
> Ericsson AB                | Phone  +46 10 7148287
> Färögatan 6                | Mobile +46 73 0949079
> SE-164 80 Stockholm, Sweden| mailto: magnus.westerlund@ericsson.com
> ----------------------------------------------------------------------
>
>