Let max default bitrate depend on resolution when configuring one video stream (was previously always 2Mbps).

Is now set to:
<= 320x240: 600kbps
<= 640x480: 1.7Mbps
<= 960x540: 2Mbps
>  960x540: 2.5Mbps

For QVGA and VGA, the qp was around 10 at the selected thresholds when running some tests. The change in qp declined above the selected bitrates.

BUG=
R=mflodman@webrtc.org, pbos@webrtc.org, stefan@webrtc.org

Review URL: https://codereview.webrtc.org/1297373003 .

Cr-Commit-Position: refs/heads/master@{#9878}
This commit is contained in:
Åsa Persson 2015-09-08 09:21:43 +02:00
parent 632246792f
commit 1c7d48d431

View File

@ -309,13 +309,25 @@ bool IsCodecBlacklistedForSimulcast(const std::string& codec_name) {
return CodecNamesEq(codec_name, kH264CodecName);
}
// The selected thresholds for QVGA and VGA corresponded to a QP around 10.
// The change in QP declined above the selected bitrates.
static int GetMaxDefaultVideoBitrateKbps(int width, int height) {
if (width * height <= 320 * 240) {
return 600;
} else if (width * height <= 640 * 480) {
return 1700;
} else if (width * height <= 960 * 540) {
return 2000;
} else {
return 2500;
}
}
} // namespace
// Constants defined in talk/media/webrtc/constants.h
// TODO(pbos): Move these to a separate constants.cc file.
const int kMinVideoBitrate = 30;
const int kStartVideoBitrate = 300;
const int kMaxVideoBitrate = 2000;
const int kVideoMtu = 1200;
const int kVideoRtpBufferSize = 65536;
@ -449,8 +461,10 @@ WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoStreams(
}
// For unset max bitrates set default bitrate for non-simulcast.
if (max_bitrate_bps <= 0)
max_bitrate_bps = kMaxVideoBitrate * 1000;
if (max_bitrate_bps <= 0) {
max_bitrate_bps =
GetMaxDefaultVideoBitrateKbps(codec.width, codec.height) * 1000;
}
webrtc::VideoStream stream;
stream.width = codec.width;