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

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

Issue 1810973002: Add support for configuring the number of spatial/temporal layers for VP9 through a field trial. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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
Index: webrtc/media/engine/webrtcvideoengine2.cc
diff --git a/webrtc/media/engine/webrtcvideoengine2.cc b/webrtc/media/engine/webrtcvideoengine2.cc
index 5f8488705184488def8fbaca74d04dadb29fa6c8..2f5e34c2d94c24a52fb06aede093d905e1cce8f7 100644
--- a/webrtc/media/engine/webrtcvideoengine2.cc
+++ b/webrtc/media/engine/webrtcvideoengine2.cc
@@ -10,6 +10,7 @@
#include "webrtc/media/engine/webrtcvideoengine2.h"
+#include <stdio.h>
#include <algorithm>
#include <set>
#include <string>
@@ -315,6 +316,44 @@ static int GetMaxDefaultVideoBitrateKbps(int width, int height) {
}
}
+bool GetVp9LayersFromFieldTrialGroup(int* num_spatial_layers,
+ int* num_temporal_layers) {
+ std::string group = webrtc::field_trial::FindFullName("WebRTC-SupportVP9SVC");
+ if (group.empty())
+ return false;
+
+ if (sscanf(group.c_str(), "EnabledByFlag_%dSL%dTL", num_spatial_layers,
+ num_temporal_layers) != 2) {
+ return false;
+ }
+ const int kMaxSpatialLayers = 3;
+ if (*num_spatial_layers > kMaxSpatialLayers || *num_spatial_layers < 1)
+ return false;
+
+ const int kMaxTemporalLayers = 3;
+ if (*num_temporal_layers > kMaxTemporalLayers || *num_temporal_layers < 1)
+ return false;
+
+ return true;
+}
+
+int GetDefaultVp9SpatialLayers() {
+ int num_sl;
+ int num_tl;
+ if (GetVp9LayersFromFieldTrialGroup(&num_sl, &num_tl)) {
+ return num_sl;
+ }
+ return 1;
+}
+
+int GetDefaultVp9TemporalLayers() {
+ int num_sl;
+ int num_tl;
+ if (GetVp9LayersFromFieldTrialGroup(&num_sl, &num_tl)) {
+ return num_tl;
+ }
+ return 1;
+}
} // namespace
// Constants defined in webrtc/media/engine/constants.h
@@ -443,6 +482,7 @@ void* WebRtcVideoChannel2::WebRtcVideoSendStream::ConfigureVideoEncoderSettings(
}
if (CodecNamesEq(codec.name, kVp9CodecName)) {
encoder_settings_.vp9 = webrtc::VideoEncoder::GetDefaultVp9Settings();
+ encoder_settings_.vp9.numberOfSpatialLayers = GetDefaultVp9SpatialLayers();
pbos-webrtc 2016/03/17 14:34:38 I don't think this should apply to screenshare, sh
åsapersson 2016/03/17 16:57:34 Ok, changed so it is not set for screenshare for n
// VP9 denoising is disabled by default.
encoder_settings_.vp9.denoisingOn =
codec_default_denoising ? false : denoising;
@@ -1870,6 +1910,11 @@ WebRtcVideoChannel2::WebRtcVideoSendStream::CreateVideoEncoderConfig(
encoder_config.streams[0].temporal_layer_thresholds_bps.push_back(
config.tl0_bitrate_kbps * 1000);
}
+ if (CodecNamesEq(codec.name, kVp9CodecName) &&
+ encoder_config.streams.size() == 1) {
+ encoder_config.streams[0].temporal_layer_thresholds_bps.resize(
+ GetDefaultVp9TemporalLayers() - 1);
+ }
return encoder_config;
}

Powered by Google App Engine
This is Rietveld 408576698