Add support for DegradationPreference in Android SDK
This wires the current degradation preference in the SDK, it will later be nullable in a follow up change once the native API supports it. Bug: webrtc:11164 Change-Id: I8324e6e0af996dfddfa07e3aff4ba242d9533388 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161321 Commit-Queue: Florent Castelli <orphis@webrtc.org> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30170}
This commit is contained in:
committed by
Commit Bot
parent
75b58972cb
commit
266021dfa2
@ -27,6 +27,22 @@ import org.webrtc.MediaStreamTrack;
|
||||
* default value".
|
||||
*/
|
||||
public class RtpParameters {
|
||||
public enum DegradationPreference {
|
||||
/** Does not degrade resolution or framerate. */
|
||||
DISABLED,
|
||||
/** Degrade resolution in order to maintain framerate. */
|
||||
MAINTAIN_FRAMERATE,
|
||||
/** Degrade framerate in order to maintain resolution. */
|
||||
MAINTAIN_RESOLUTION,
|
||||
/** Degrade a balance of framerate and resolution. */
|
||||
BALANCED;
|
||||
|
||||
@CalledByNative("DegradationPreference")
|
||||
static DegradationPreference fromNativeIndex(int nativeIndex) {
|
||||
return values()[nativeIndex];
|
||||
}
|
||||
}
|
||||
|
||||
public static class Encoding {
|
||||
// If non-null, this represents the RID that identifies this encoding layer.
|
||||
// RIDs are used to identify layers in simulcast.
|
||||
@ -230,20 +246,25 @@ public class RtpParameters {
|
||||
|
||||
public final String transactionId;
|
||||
|
||||
/**
|
||||
* When bandwidth is constrained and the RtpSender needs to choose between degrading resolution or
|
||||
* degrading framerate, degradationPreference indicates which is preferred.
|
||||
*/
|
||||
@Nullable public DegradationPreference degradationPreference;
|
||||
|
||||
private final Rtcp rtcp;
|
||||
|
||||
private final List<HeaderExtension> headerExtensions;
|
||||
|
||||
public final List<Encoding> encodings;
|
||||
// Codec parameters can't currently be changed between getParameters and
|
||||
// setParameters. Though in the future it will be possible to reorder them or
|
||||
// remove them.
|
||||
|
||||
public final List<Codec> codecs;
|
||||
|
||||
@CalledByNative
|
||||
RtpParameters(String transactionId, Rtcp rtcp, List<HeaderExtension> headerExtensions,
|
||||
List<Encoding> encodings, List<Codec> codecs) {
|
||||
RtpParameters(String transactionId, DegradationPreference degradationPreference, Rtcp rtcp,
|
||||
List<HeaderExtension> headerExtensions, List<Encoding> encodings, List<Codec> codecs) {
|
||||
this.transactionId = transactionId;
|
||||
this.degradationPreference = degradationPreference;
|
||||
this.rtcp = rtcp;
|
||||
this.headerExtensions = headerExtensions;
|
||||
this.encodings = encodings;
|
||||
@ -255,6 +276,11 @@ public class RtpParameters {
|
||||
return transactionId;
|
||||
}
|
||||
|
||||
@CalledByNative
|
||||
DegradationPreference getDegradationPreference() {
|
||||
return degradationPreference;
|
||||
}
|
||||
|
||||
@CalledByNative
|
||||
public Rtcp getRtcp() {
|
||||
return rtcp;
|
||||
|
||||
Reference in New Issue
Block a user