Commit d39b63d5 authored by Florent Castelli's avatar Florent Castelli Committed by Commit Bot

Implement and ship RTCRtpEncodingParameters.scaleResolutionDownBy

Intent thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/SV8evGSU_dw/DIrx9XzvDQAJ

Bug: 857048
Change-Id: I32babd443aef05e6f1d062514b27ba5772ab400f
Reviewed-on: https://chromium-review.googlesource.com/c/1445934Reviewed-by: default avatarHenrik Boström <hbos@chromium.org>
Commit-Queue: Florent Castelli <orphis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#627927}
parent 96369af3
......@@ -20,5 +20,5 @@ dictionary RTCRtpEncodingParameters : RTCRtpCodingParameters {
//TODO(orphis): Missing ptime. https://crbug.com/857046
unsigned long maxBitrate;
//TODO(orphis): Missing maxFramerate. https://crbug.com/857047
//TODO(orphis): Missing scaleResolutionDownBy. https://crbug.com/857048
double scaleResolutionDownBy;
};
......@@ -250,8 +250,13 @@ webrtc::RtpEncodingParameters ToRtpEncodingParameters(
webrtc_encoding.bitrate_priority = PriorityToDouble(encoding->priority());
webrtc_encoding.network_priority =
PriorityToDouble(encoding->networkPriority());
if (encoding->hasMaxBitrate())
if (encoding->hasMaxBitrate()) {
webrtc_encoding.max_bitrate_bps = clampTo<int>(encoding->maxBitrate());
}
if (encoding->hasScaleResolutionDownBy()) {
webrtc_encoding.scale_resolution_down_by =
encoding->scaleResolutionDownBy();
}
return webrtc_encoding;
}
......@@ -358,8 +363,13 @@ RTCRtpSendParameters* RTCRtpSender::getParameters() {
// codecPayloadType, dtx, ptime, maxFramerate, scaleResolutionDownBy, rid
RTCRtpEncodingParameters* encoding = RTCRtpEncodingParameters::Create();
encoding->setActive(webrtc_encoding.active);
if (webrtc_encoding.max_bitrate_bps)
if (webrtc_encoding.max_bitrate_bps) {
encoding->setMaxBitrate(webrtc_encoding.max_bitrate_bps.value());
}
if (webrtc_encoding.scale_resolution_down_by) {
encoding->setScaleResolutionDownBy(
webrtc_encoding.scale_resolution_down_by.value());
}
encoding->setPriority(
PriorityFromDouble(webrtc_encoding.bitrate_priority).c_str());
encoding->setNetworkPriority(
......
......@@ -5,8 +5,8 @@ FAIL sender.getParameters() should return sendEncodings set by addTransceiver()
PASS sender.setParameters() with mismatch number of encodings should reject with InvalidModificationError
PASS sender.setParameters() with encodings unset should reject with TypeError
FAIL setParameters() with modified encoding.rid field should reject with InvalidModificationError assert_equals: expected (string) "foo" but got (undefined) undefined
FAIL setParameters() with encoding.scaleResolutionDownBy field set to less than 1.0 should reject with RangeError assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL setParameters() with encoding.scaleResolutionDownBy field set to greater than 1.0 should succeed assert_approx_equals: expected a number but got a "undefined"
PASS setParameters() with encoding.scaleResolutionDownBy field set to less than 1.0 should reject with RangeError
PASS setParameters() with encoding.scaleResolutionDownBy field set to greater than 1.0 should succeed
FAIL setParameters() with modified encoding.dtx should succeed with RTCRtpTransceiverInit assert_equals: expected (string) "enabled" but got (undefined) undefined
FAIL setParameters() with modified encoding.dtx should succeed without RTCRtpTransceiverInit assert_equals: expected (string) "enabled" but got (undefined) undefined
FAIL setParameters() with unset encoding.dtx should succeed with RTCRtpTransceiverInit assert_equals: expected (string) "enabled" but got (undefined) undefined
......
......@@ -253,7 +253,7 @@
const encoding = getFirstEncoding(param);
encoding.scaleResolutionDownBy = 0.5;
return promise_rejects(t, 'RangeError',
return promise_rejects(t, new RangeError(),
sender.setParameters(param));
}, `setParameters() with encoding.scaleResolutionDownBy field set to less than 1.0 should reject with RangeError`);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment