New java ScalingSettings constructors.
Deprecate old constructors. Intended to make java api consistent with the changes in https://webrtc-review.googlesource.com/c/src/+/46622. Bug: webrtc:8830 Change-Id: Iadecb5d033b5de841873905af659d8d234b75c7d Reviewed-on: https://webrtc-review.googlesource.com/49062 Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21956}
This commit is contained in:
@ -96,11 +96,38 @@ public interface VideoEncoder {
|
||||
public final Integer low;
|
||||
public final Integer high;
|
||||
|
||||
/**
|
||||
* Settings to disable quality based scaling.
|
||||
*/
|
||||
public static final ScalingSettings OFF = new ScalingSettings();
|
||||
|
||||
/**
|
||||
* Creates settings to enable quality based scaling.
|
||||
*
|
||||
* @param low Average QP at which to scale up the resolution.
|
||||
* @param high Average QP at which to scale down the resolution.
|
||||
*/
|
||||
public ScalingSettings(int low, int high) {
|
||||
this.on = true;
|
||||
this.low = low;
|
||||
this.high = high;
|
||||
}
|
||||
|
||||
private ScalingSettings() {
|
||||
this.on = false;
|
||||
this.low = null;
|
||||
this.high = null;
|
||||
}
|
||||
|
||||
// TODO(bugs.webrtc.org/8830): Below constructors are deprecated.
|
||||
// Default thresholds are going away, so thresholds have to be set
|
||||
// when scaling is on.
|
||||
/**
|
||||
* Creates quality based scaling setting.
|
||||
*
|
||||
* @param on True if quality scaling is turned on.
|
||||
*/
|
||||
@Deprecated
|
||||
public ScalingSettings(boolean on) {
|
||||
this.on = on;
|
||||
this.low = null;
|
||||
@ -114,6 +141,7 @@ public interface VideoEncoder {
|
||||
* @param low Average QP at which to scale up the resolution.
|
||||
* @param high Average QP at which to scale down the resolution.
|
||||
*/
|
||||
@Deprecated
|
||||
public ScalingSettings(boolean on, int low, int high) {
|
||||
this.on = on;
|
||||
this.low = low;
|
||||
|
@ -415,7 +415,18 @@ class HardwareVideoEncoder implements VideoEncoder {
|
||||
@Override
|
||||
public ScalingSettings getScalingSettings() {
|
||||
encodeThreadChecker.checkIsOnValidThread();
|
||||
return new ScalingSettings(automaticResizeOn);
|
||||
if (automaticResizeOn) {
|
||||
if (codecType == VideoCodecType.VP8) {
|
||||
final int kLowVp8QpThreshold = 29;
|
||||
final int kHighVp8QpThreshold = 95;
|
||||
return new ScalingSettings(kLowVp8QpThreshold, kHighVp8QpThreshold);
|
||||
} else if (codecType == VideoCodecType.H264) {
|
||||
final int kLowH264QpThreshold = 24;
|
||||
final int kHighH264QpThreshold = 37;
|
||||
return new ScalingSettings(kLowH264QpThreshold, kHighH264QpThreshold);
|
||||
}
|
||||
}
|
||||
return ScalingSettings.OFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user