Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Unified Diff: talk/media/webrtc/webrtcvideoengine2.cc

Issue 1297373003: Let max default bitrate depend on resolution when configuring one video stream (was previously alwa… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: fix for comment Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/media/webrtc/webrtcvideoengine2.cc
diff --git a/talk/media/webrtc/webrtcvideoengine2.cc b/talk/media/webrtc/webrtcvideoengine2.cc
index 7e2c1d41518c90bd35d83a3c8a2c6894dd9acf5e..b82d22c4545e63e379ee55023d45c65582d4200b 100644
--- a/talk/media/webrtc/webrtcvideoengine2.cc
+++ b/talk/media/webrtc/webrtcvideoengine2.cc
@@ -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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698