W3C home > Mailing lists > Public > public-webrtc@w3.org > August 2015

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

From: Peter Thatcher <pthatcher@google.com>
Date: Fri, 21 Aug 2015 23:34:13 -0700
Message-ID: <CAJrXDUH9F_SejzK5Q0dDTx7pHJoYn+51AERHdBf9-u02wSU6pQ@mail.gmail.com>
To: "public-webrtc@w3.org" <public-webrtc@w3.org>
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

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