Add bindings for simulcast and RIDs in Android SDK.

This adds the bindings for rid in RtpParameters.Encoding and bindings
for send_encodings in RtpTransceiverInit to allow creating a transceiver
with multiple send encodings.

Bug: webrtc:10464
Change-Id: I4c205dc0f466768c63b7efcb3c68e93277236da0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128960
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Commit-Queue: Amit Hilbuch <amithi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27323}
This commit is contained in:
Amit Hilbuch
2019-03-25 12:53:58 -07:00
committed by Commit Bot
parent ce50b000d9
commit 177670afd6
5 changed files with 78 additions and 4 deletions

View File

@ -12,6 +12,7 @@ package org.webrtc;
import android.support.annotation.Nullable;
import java.lang.Double;
import java.lang.String;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -28,6 +29,9 @@ import org.webrtc.MediaStreamTrack;
*/
public class RtpParameters {
public static class Encoding {
// If non-null, this represents the RID that identifies this encoding layer.
// RIDs are used to identify layers in simulcast.
@Nullable public String rid;
// Set to true to cause this encoding to be sent, and false for it not to
// be sent.
public boolean active = true;
@ -48,9 +52,17 @@ public class RtpParameters {
// Can't be changed between getParameters/setParameters.
public Long ssrc;
// This constructor is useful for creating simulcast layers.
Encoding(String rid, boolean active, Double scaleResolutionDownBy) {
this.rid = rid;
this.active = active;
this.scaleResolutionDownBy = scaleResolutionDownBy;
}
@CalledByNative("Encoding")
Encoding(boolean active, Integer maxBitrateBps, Integer minBitrateBps, Integer maxFramerate,
Integer numTemporalLayers, Double scaleResolutionDownBy, Long ssrc) {
Encoding(String rid, boolean active, Integer maxBitrateBps, Integer minBitrateBps,
Integer maxFramerate, Integer numTemporalLayers, Double scaleResolutionDownBy, Long ssrc) {
this.rid = rid;
this.active = active;
this.maxBitrateBps = maxBitrateBps;
this.minBitrateBps = minBitrateBps;
@ -60,6 +72,12 @@ public class RtpParameters {
this.ssrc = ssrc;
}
@Nullable
@CalledByNative("Encoding")
String getRid() {
return rid;
}
@CalledByNative("Encoding")
boolean getActive() {
return active;

View File

@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.webrtc.MediaStreamTrack;
import org.webrtc.RtpParameters;
/**
* Java wrapper for a C++ RtpTransceiverInterface.
@ -71,18 +72,25 @@ public class RtpTransceiver {
public static final class RtpTransceiverInit {
private final RtpTransceiverDirection direction;
private final List<String> streamIds;
private final List<RtpParameters.Encoding> sendEncodings;
public RtpTransceiverInit() {
this(RtpTransceiverDirection.SEND_RECV);
}
public RtpTransceiverInit(RtpTransceiverDirection direction) {
this(direction, Collections.emptyList());
this(direction, Collections.emptyList(), Collections.emptyList());
}
public RtpTransceiverInit(RtpTransceiverDirection direction, List<String> streamIds) {
this(direction, streamIds, Collections.emptyList());
}
public RtpTransceiverInit(RtpTransceiverDirection direction, List<String> streamIds,
List<RtpParameters.Encoding> sendEncodings) {
this.direction = direction;
this.streamIds = new ArrayList<String>(streamIds);
this.sendEncodings = new ArrayList<RtpParameters.Encoding>(sendEncodings);
}
@CalledByNative("RtpTransceiverInit")
@ -94,6 +102,11 @@ public class RtpTransceiver {
List<String> getStreamIds() {
return new ArrayList<String>(this.streamIds);
}
@CalledByNative("RtpTransceiverInit")
List<RtpParameters.Encoding> getSendEncodings() {
return new ArrayList<RtpParameters.Encoding>(this.sendEncodings);
}
}
private long nativeRtpTransceiver;