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

RTPSender/Receiver - The case for Constraints

From: Suhas Nandakumar (snandaku) <snandaku@cisco.com>
Date: Thu, 15 May 2014 18:38:31 +0000
To: "public-webrtc@w3.org" <public-webrtc@w3.org>
Message-ID: <37D91FC30D69DE43B61E5EEADD959F180D12D2B1@xmb-aln-x12.cisco.com>
Here is an attempt on explaining the applicability of constraints in the context of RTPSender/Receivers. Please note that the below proposal doesn't touch upon DtlsTransport/Transport related objects from the earlier proposals.
Many thanks to Jim Barnett for helping develop the below proposal.


Case for Constraints:
----------------------
Example : One way video session
This is a simple example that shows the applicability of constraints in successfully negotiating a one way video session where, Alice is the Media Sender and Bob is the Media Receiver.

Alice can send a video RTP stream with the following configuration
  - Aspect ratio between 1.0 and 2.0
  - Frame-rate ranges 20 - 60 FPS
  - bit-rate ranging from 0.5 to 3 Mbps
  - She wants 640 X 480 as the minimum resolution and 1080p as the preferred resolution with 30 FPS as the associated frame rate.

Alice might use following constraint specification to share her proposal with Bob.
var alice_constraints {
  require:   ["width", "height"]
  width:     {min: 640},
  height:    {min: 480},
  framerate: {min:20, max: 60},
  aspectRatio: {min:1.0, max:2.0}
  advanced     [{width: 1920, height: 1080},
               {framerate:30}]
 };

//example usage - as a result of this, the next createOffer()
//generates SDP that takes care into account the above constraints.
Pc.getRTPSenders()[0].applyConstraints(alice_constraints);

Bob wishes to receive the video stream with these characteristics
  - Can support 4:3 as the single Aspect ratio.
  - Max recv video resolution 1024 X 768.
  - He prefers 630 X 480 video resolution.

var bob_constraints {
  require:   ["aspectRatio", "width", "height"],
  aspectRatio: {min: 1.333, max: 1.334},
  width:  {max: 1024},
  height: {height: 768},
  advanced [{width: 640, height: 480}]
};

// Set Bob's constraints so that the createAnswer()
// can generate appropriate SDP reflecting Bob's
// support for Alice's proposal
Pc.getRTPReceivers()[0].applyConstraints(bob_constraints);

"This is a simple case where we would like to give the UA flexibility to adjust the parameters within
application-specified bounds at runtime."

-----------------------------------
On to some theory now,
RTPSender/Receiver's media configuration attributes can be categorized as below
  - locally scoped attribute
  - negotiation scoped attributes

Locally Scoped Attributes:
    These are the attributes whose settings impact the decision that is localized to an UA and can be applied unilaterally.
    Example: Relative Priority of the stream, Pause/Resume State, CNAME ..

Negotiation Scoped Attributes:
    Any attribute whose final value is determined by the negotiation procedures between the participating entities fall in to this category
    Examples: Frame-rate, Aspect Ratio, resolution, bandwidth ..

Following properties of the "Negotiation Scoped Attributes" controlling RTP Sender/Receiver naturally fits with in the applicability of constraints mechanisms:

PROPERTY1: From a Media sender's perspective, these attributes represent possible configurations for sending the media. From a Media receiver's perspective, these attributes capture receivers capacity in handling the configuration proposed by the Sender. Thus a sender cannot send anything that a receiver doesn't wish to or cannot handle for a given session.
PROPERTY2: There is an implied inter-dependency between these attributes. Changing one causes visible changes in the  others. Thus changing , say Frame-rate and video resolution impacts the bandwidth that can be sent/received for example.


Based on the above, following additions to existing RTPSender/Receiver proposal might be a good starting place for further discussions

// Most of this is picked from the section 4.3.5.1 of [1]
dictionary RTCRTPStreamConstraintSet {
  ConstrainLong  width;
  ConstrainLong   height;
  ConstrainDouble aspectRatio;
  ConstrainDouble frameRate;
  ConstrainDouble  bitRate;
  // more as we need
};

// replaces RTCRTPEncodingParams
interface RTCRTPStreamParams {

void applyConstraints(RTCRTPStreamConstraintSet constraints,
                        VoidFunction successCallback,
                        ConstraintErrorCallback errorCallback);

RTCRTPStreamConstraints getConstraints();

boolean       active;

// more Locally Scoped Attributes as needed

};

Please let me know your thoughts.

Cheers
Suhas
Received on Thursday, 15 May 2014 18:39:00 UTC

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