W3C home > Mailing lists > Public > public-webrtc@w3.org > November 2013

Re: Using tracks instead of streams

From: Adam Bergkvist <adam.bergkvist@ericsson.com>
Date: Tue, 12 Nov 2013 08:18:20 +0000
To: Martin Thomson <martin.thomson@gmail.com>, "public-webrtc@w3.org" <public-webrtc@w3.org>
Message-ID: <A222C88B6882744D8D4B9681B31588901161E0F1@ESESSMB307.ericsson.se>
On 2013-11-12 07:46, Martin Thomson wrote:
> This isn't rocket science, though it requires a degree of API-inversion.
>
> Yes, I know that I'm breaking the rules with respect to use of
> "attribute sequence<Foo>".  The rules are stupid.
>
> partial interface RTCPeerConnection {
>   // the set of tracks we are sending
>   attribute sequence<Doohickey> sendTracks;
>   // the set of tracks we are (maybe) receiving
>   attribute sequence<Doohickey> receiveTracks;
>
>   // add a track to the set of sending tracks
>   Doohickey addSendTrack(MediaStreamTrack track);
>
>   // fired when a remote track manifests
>   attribute EventHandler? onremotetrack;
> };
>
> partial interface MediaStreamTrack {
>   // the set of streams - i.e., synchronization contexts
>   // that this track belongs to
>   attribute sequence<MediaStream> streams;
> };
>
> interface DooHickey {
>   readonly attribute MediaStreamTrack track;
>   // and some other stuff
>   attribute PriorityLevel priority;
>   attribute unsigned long maxBitrate;
>   // ellipsis
> };
>
> All the stream-related mechanisms are removed from RTCPeerConnection.
> Nothing changes about the way that MSID and appID and those mechanisms
> work.
>
> The reason that MediaStreamTrack gets an accessor for the set of
> streams that it belongs to is that if you are navigating this object
> mesh starting from RTCPeerConnection, you wouldn't otherwise be able
> to find the streams that exist.  Without that, worst case, the browser
> wouldn't have a strong reference it could use to manage garbage
> collection.
>
> We are still talking about Doohickeys, so that interface has an ellipsis on it.
>
>

I like this proposal and I think it will simplify a whole lot of things.

One thing that I find a bit odd is:

pc.addSendTrack(track);
pc.sendTracks[0] == track; // false (different types)

We could have the script construct a DooHickey and add it to the
PeerConnection.

// A-side
var hickey = new DooHickey(track);
peerConn.addDooHickey(hickey);

// B-side
ondoohickey  = function (evt) {
  hickey = evt.dooHickey;
  remoteVideo.srcObject = new MediaStream([hickey.track]);
};

/Adam
Received on Tuesday, 12 November 2013 08:18:49 UTC

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