PRs for either PC.createRtpSender or PC.addTrack(..., RtpSenderInit, ...)

On the list we have had discussion around adding an RtpSenderInit parameter
to PC.addTrack, and around adding PC.createRtpSender.  Today I realized
that RtpSenderInit could also be used the same way PC.createRtpSender is.

So, I have two PRs to choose from:

PR 271 (https://github.com/w3c/webrtc-pc/pull/271):

+          <dt>RTCRtpSender createRtpSender (DOMString kind)</dt>
+
+          <dd>
+            <p>Equivalent to calling <code>addTrack(null)<code>, but
+            the returned RtpSender is configured to send a track of
+            the given <code>kind</code>.  If the returned RtpSender is
+            later set to have a different track, that track must have
+            the same kind.
+          </dd>

Example:

var sender = pc.createRtpSender("audio");
// ... later ...
sender.setTrack(track);

Pros:
- Simple

Cons:
- Adds a new method (two ways to do things)

PR 272 (https://github.com/w3c/webrtc-pc/pull/272):

+          <dt>RTCRtpSender addTrack (
+            MediaStreamTrack track,
+            optional RTCRtpSenderInit senderDict,
+            MediaStream... streams)</dt>

+        <dl class="idl" title="dictionary RTCRtpSenderInit">
+          <dt>DOMString kind</dt>
+          <dd>
+            <p>The kind of the track that the <code>RtpSender</code>
+              will send.  If <code>addTrack</code> is passed a null track,
+              this must be set to indicate the type of track that will be
+              set later.  If <code>addTrack</code> is passed a non-null
+              track, this kind must either be unset or agree with the kind
+              of the given track.</p>
+          </dd>
+
+          <dt>RTCRtpParameters parameters<dt>
+            <dd>
+              <p>The initial parameters to use for
+                the <code>RtpSender</code>.  This is equivalent to
+                calling <code>RTCRtpSender.setParameters</code> on the
+                RTCRtpSender returned by <code>addTrack</code>.
+              </p>
+            </dd>
+        </dl>

Example:

var sender = pc.addTrack(null, {kind: "audio"});
// ... later ...
sender.setTrack(track);

Pros:
- RtpSenderInit is useful for other things (Could be used for VAD or MSID
replacement)

Cons:
- A little more complex


So, which do we like?  I'd be happy with either.

Received on Saturday, 22 August 2015 06:35:20 UTC