Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Unified Diff: webrtc/sdk/android/api/org/webrtc/PeerConnection.java

Issue 2994733002: Adding comments explaining Java createSender and setTrack methods. (Closed)
Patch Set: Convert to javadoc style comments Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/sdk/android/api/org/webrtc/RtpSender.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/sdk/android/api/org/webrtc/PeerConnection.java
diff --git a/webrtc/sdk/android/api/org/webrtc/PeerConnection.java b/webrtc/sdk/android/api/org/webrtc/PeerConnection.java
index 69f4d9b7f4effa36ee1938a8b6a225b2c2bf85ed..b2155c42e4d0e79561adb746a3ac67a989fbc179 100644
--- a/webrtc/sdk/android/api/org/webrtc/PeerConnection.java
+++ b/webrtc/sdk/android/api/org/webrtc/PeerConnection.java
@@ -286,6 +286,43 @@ public class PeerConnection {
localStreams.remove(stream);
}
+ /**
+ * Creates an RtpSender without a track.
+ * <p>
+ * This method allows an application to cause the PeerConnection to negotiate
+ * sending/receiving a specific media type, but without having a track to
+ * send yet.
+ * <p>
+ * When the application does want to begin sending a track, it can call
+ * RtpSender.setTrack, which doesn't require any additional SDP negotiation.
+ * <p>
+ * Example use:
+ * <pre>
+ * {@code
+ * audioSender = pc.createSender("audio", "stream1");
+ * videoSender = pc.createSender("video", "stream1");
+ * // Do normal SDP offer/answer, which will kick off ICE/DTLS and negotiate
+ * // media parameters....
+ * // Later, when the endpoint is ready to actually begin sending:
+ * audioSender.setTrack(audioTrack, false);
+ * videoSender.setTrack(videoTrack, false);
+ * }
+ * </pre>
+ * Note: This corresponds most closely to "addTransceiver" in the official
+ * WebRTC API, in that it creates a sender without a track. It was
+ * implemented before addTransceiver because it provides useful
+ * functionality, and properly implementing transceivers would have required
+ * a great deal more work.
+ *
+ * @param kind Corresponds to MediaStreamTrack kinds (must be "audio" or
+ * "video").
+ * @param stream_id The ID of the MediaStream that this sender's track will
+ * be associated with when SDP is applied to the remote
+ * PeerConnection. If createSender is used to create an
+ * audio and video sender that should be synchronized, they
+ * should use the same stream ID.
+ * @return A new RtpSender object if successful, or null otherwise.
+ */
public RtpSender createSender(String kind, String stream_id) {
RtpSender new_sender = nativeCreateSender(kind, stream_id);
if (new_sender != null) {
« no previous file with comments | « no previous file | webrtc/sdk/android/api/org/webrtc/RtpSender.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698