Doohickeys - slightly another take

Hello All

   Below is another take on Doohickeys that is based on the Constrainable interface and builds upon the concepts from other similar proposals.

Idea:
-------
2 forms of constraints
1. Track constraints applied to the sources generating the tracks. [ we have this ... ]
2. Stream constraints that apply to underlying media flows with in a PeerConnection for a given MediaStreamTrack

Use-cases  :
---------------
Constraints on controlling send/recv RTP Stream parameters such as
  - bandwidth
  - multiplexing
  - RTCP Mux/NoMux
  - Stream directionality
  - Simulcast/Layered coding
  - and more

Proposal:
-----------
// Generic constrainable interface for controlling media flow in and out of a
// MediaStream Track. Media flow abstracts an RTP Stream.
interface MediaFlow implements Constrainable
{
  attribute  RTCIceConnection iceConnnectionState; // transport state
  attribute  RTCIceGatheringState iceGatheringState; // transport state
  attribute DOMString CNAME;
  ...
}

partial interface MediaStreamTrack
{
  MediaFlow flow;  // Underlying constrainable Media flow
  attribute sequence<MediaStream> streams; // list of synchronization contexts the track is part of
   ....
}

partial interface RTCPeerConnection
{
    MediaFlow addTrack(MediaStreamTrack track);
    void removeTrack(MediaStreamTrack track);
    attribute sequence <MediaStreamTrack> sendTracks;
    attribute sequence <MediaStreamTrack> receiveTracks;
    ...
}

Usage:
-------
MediaFlow flow1  =   pc1.addTrack(videoTrack1)     // first video source
MediaFlow flow2  =   pc1.addTrack(videoTrack1.clone())  // cloned from videoTrack1
MediaFlow flow3  =   pc1.addTrack(audioTrack)   //  microphone
MediaFlow flow4  =   pc1.addTrack(videoTrack2) // second video source


// Simulcast Example
flow1.applyConstraints({bandwidth: 150-400, direction:sendonly, simulcast-id:1, priortity:High});
flow2.applyConstraints({bandwidth:100-150, direction:sendonly, simulcast-id:1});
flow4.applyConstraints({priority:Low});

pc1.createOffer()
-- resulting SDP will be something like:
 m=audio ...
 m= video ... // first source
    simul-config:1
    simul-config:2
m = video .. // second source

// Layered code example
flow1.applyConstraints({framerate:15,  layer-id:1}); //base layer
flow2.applyConstraints({framerate:30,  layer-id:2}); // first dependent layer


// Remote Track Handling
remote_pc.onAddTrack = function(evt) {
 var remote-track = evt.track;
 var remote-streams = evt.streams;
 var recv-media-flow = remote-track.flow;
 // render track to a given media-stream/media track target or
 // say, apply constraint to recv-media-flow indicating direction update for example
 recv-media-flow.applyConstraint({direction:inactive});
}

Please let me know your thoughts..

Cheers
Suhas

Received on Sunday, 20 April 2014 19:48:34 UTC