Proposal: Combine createRtpSender (PR 271) and createRtpReceiver (PR 279) into one method (PR 293)

Working through many use cases for createRtpSender and createRtpReceiver
has made me realize that what would be much cleaner is to have a method
that creates both like so:

// Replaces createRtpSender
var media = pc.addMedia("video", {send: true, receive: true});

// Replaces createRtpReceiver
var media = pc.addMedia("audio", {send: false, receive: true});

// Replaces addTrack + "offerToReceive: 0"
pc.addMedia("video", {send: true, receive: false});


The return time is a pair of an RtpSender and RtpReceiver:

interface RTCRtpTransceiver {
  readonly attribute mid;  // Chosen when addMedia is called.
  // These are non-nullable.  You get one, even if it isn't actively
sending/receiving.
  readonly attribute RtpSender sender;
  readonly attribute RtpReceiver receiver;
}


Rather than call it "RTCRtpPair", I called it "RTCRtpTransceiver", but
that's just a placeholder (much like "doohikies" was).  We can get creative
with the names later.  For now, the point is that this is cleaner than
having separate createRtpSender and createRtpReceiver methods.   Similarly,
I could have called it "createRtpTransceiver", but "addMedia" sounded a lot
nicer, and we can get creative with names later.

This also provides a nice place to put a "set m-line to port 0" method,
which could solve https://github.com/w3c/webrtc-pc/issues/187.  So I added
a "stop" method also:

partial interface RTCRtpTranceiver {
  readonly attribute bool stopped;
  void stop();
}




You can see the entire PR for it here:
https://github.com/w3c/webrtc-pc/pull/293/

And I made some slides with more examples and use cases about it here:
https://docs.google.com/presentation/d/1BN2GBoJvys6PbswQink4CAgrGl_ofZYEHepbExfAsF0/edit#slide=id.g663e22e54_1_133


I hope to present on it at the upcoming f2f.

Received on Wednesday, 9 September 2015 06:37:30 UTC