| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 DEFINE_int32(tl1_bitrate, 2000, "Temporal layer 1 target bitrate."); | 71 DEFINE_int32(tl1_bitrate, 2000, "Temporal layer 1 target bitrate."); |
| 72 size_t MaxBitrate() { | 72 size_t MaxBitrate() { |
| 73 return static_cast<size_t>(FLAGS_tl1_bitrate); | 73 return static_cast<size_t>(FLAGS_tl1_bitrate); |
| 74 } | 74 } |
| 75 | 75 |
| 76 DEFINE_int32(num_temporal_layers, 2, "Number of temporal layers to use."); | 76 DEFINE_int32(num_temporal_layers, 2, "Number of temporal layers to use."); |
| 77 int NumTemporalLayers() { | 77 int NumTemporalLayers() { |
| 78 return static_cast<int>(FLAGS_num_temporal_layers); | 78 return static_cast<int>(FLAGS_num_temporal_layers); |
| 79 } | 79 } |
| 80 | 80 |
| 81 DEFINE_int32(num_spatial_layers, 1, "Number of spatial layers to use."); |
| 82 int NumSpatialLayers() { |
| 83 return static_cast<int>(FLAGS_num_spatial_layers); |
| 84 } |
| 85 |
| 86 DEFINE_int32(tl_discard_threshold, |
| 87 0, |
| 88 "Discard all temporal layers above the given. 0 to disable."); |
| 89 int TLDiscardThreshold() { |
| 90 return static_cast<int>(FLAGS_tl_discard_threshold); |
| 91 } |
| 92 |
| 93 DEFINE_int32(sl_discard_threshold, |
| 94 0, |
| 95 "Discard all spatial layers above the given. 0 to disable."); |
| 96 int SLDiscardThreshold() { |
| 97 return static_cast<int>(FLAGS_sl_discard_threshold); |
| 98 } |
| 99 |
| 81 DEFINE_int32(min_transmit_bitrate, 400, "Min transmit bitrate incl. padding."); | 100 DEFINE_int32(min_transmit_bitrate, 400, "Min transmit bitrate incl. padding."); |
| 82 int MinTransmitBitrate() { | 101 int MinTransmitBitrate() { |
| 83 return FLAGS_min_transmit_bitrate; | 102 return FLAGS_min_transmit_bitrate; |
| 84 } | 103 } |
| 85 | 104 |
| 86 DEFINE_string(codec, "VP8", "Video codec to use."); | 105 DEFINE_string(codec, "VP8", "Video codec to use."); |
| 87 std::string Codec() { | 106 std::string Codec() { |
| 88 return static_cast<std::string>(FLAGS_codec); | 107 return static_cast<std::string>(FLAGS_codec); |
| 89 } | 108 } |
| 90 | 109 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" | 147 "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" |
| 129 " will assign the group Enable to field trial WebRTC-FooFeature. Multiple " | 148 " will assign the group Enable to field trial WebRTC-FooFeature. Multiple " |
| 130 "trials are separated by \"/\""); | 149 "trials are separated by \"/\""); |
| 131 } // namespace flags | 150 } // namespace flags |
| 132 | 151 |
| 133 class ScreenshareLoopback : public test::Loopback { | 152 class ScreenshareLoopback : public test::Loopback { |
| 134 public: | 153 public: |
| 135 explicit ScreenshareLoopback(const Config& config) : Loopback(config) { | 154 explicit ScreenshareLoopback(const Config& config) : Loopback(config) { |
| 136 CHECK_GE(config.num_temporal_layers, 1u); | 155 CHECK_GE(config.num_temporal_layers, 1u); |
| 137 CHECK_LE(config.num_temporal_layers, 2u); | 156 CHECK_LE(config.num_temporal_layers, 2u); |
| 157 CHECK_GE(config.num_spatial_layers, 1u); |
| 158 CHECK_LE(config.num_spatial_layers, 5u); |
| 159 CHECK(config.num_spatial_layers == 1 || config.codec == "VP9"); |
| 160 CHECK(config.num_spatial_layers == 1 || config.num_temporal_layers == 1); |
| 161 CHECK_LT(config.tl_discard_threshold, config.num_temporal_layers); |
| 162 CHECK_LT(config.sl_discard_threshold, config.num_spatial_layers); |
| 138 | 163 |
| 139 vp8_settings_ = VideoEncoder::GetDefaultVp8Settings(); | 164 vp8_settings_ = VideoEncoder::GetDefaultVp8Settings(); |
| 140 vp8_settings_.denoisingOn = false; | 165 vp8_settings_.denoisingOn = false; |
| 141 vp8_settings_.frameDroppingOn = false; | 166 vp8_settings_.frameDroppingOn = false; |
| 142 vp8_settings_.numberOfTemporalLayers = | 167 vp8_settings_.numberOfTemporalLayers = |
| 143 static_cast<unsigned char>(config.num_temporal_layers); | 168 static_cast<unsigned char>(config.num_temporal_layers); |
| 144 | 169 |
| 145 vp9_settings_ = VideoEncoder::GetDefaultVp9Settings(); | 170 vp9_settings_ = VideoEncoder::GetDefaultVp9Settings(); |
| 146 vp9_settings_.denoisingOn = false; | 171 vp9_settings_.denoisingOn = false; |
| 147 vp9_settings_.frameDroppingOn = false; | 172 vp9_settings_.frameDroppingOn = false; |
| 148 vp9_settings_.numberOfTemporalLayers = | 173 vp9_settings_.numberOfTemporalLayers = |
| 149 static_cast<unsigned char>(config.num_temporal_layers); | 174 static_cast<unsigned char>(config.num_temporal_layers); |
| 175 vp9_settings_.numberOfSpatialLayers = |
| 176 static_cast<unsigned char>(config.num_spatial_layers); |
| 150 } | 177 } |
| 151 virtual ~ScreenshareLoopback() {} | 178 virtual ~ScreenshareLoopback() {} |
| 152 | 179 |
| 153 protected: | 180 protected: |
| 154 VideoEncoderConfig CreateEncoderConfig() override { | 181 VideoEncoderConfig CreateEncoderConfig() override { |
| 155 VideoEncoderConfig encoder_config(test::Loopback::CreateEncoderConfig()); | 182 VideoEncoderConfig encoder_config(test::Loopback::CreateEncoderConfig()); |
| 156 VideoStream* stream = &encoder_config.streams[0]; | 183 VideoStream* stream = &encoder_config.streams[0]; |
| 157 encoder_config.content_type = VideoEncoderConfig::ContentType::kScreen; | 184 encoder_config.content_type = VideoEncoderConfig::ContentType::kScreen; |
| 158 encoder_config.min_transmit_bitrate_bps = flags::MinTransmitBitrate(); | 185 encoder_config.min_transmit_bitrate_bps = flags::MinTransmitBitrate(); |
| 159 int num_temporal_layers; | 186 int num_temporal_layers; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 void Loopback() { | 239 void Loopback() { |
| 213 test::Loopback::Config config{flags::Width(), | 240 test::Loopback::Config config{flags::Width(), |
| 214 flags::Height(), | 241 flags::Height(), |
| 215 flags::Fps(), | 242 flags::Fps(), |
| 216 flags::MinBitrate(), | 243 flags::MinBitrate(), |
| 217 flags::StartBitrate(), | 244 flags::StartBitrate(), |
| 218 flags::MaxBitrate(), | 245 flags::MaxBitrate(), |
| 219 flags::MinTransmitBitrate(), | 246 flags::MinTransmitBitrate(), |
| 220 flags::Codec(), | 247 flags::Codec(), |
| 221 flags::NumTemporalLayers(), | 248 flags::NumTemporalLayers(), |
| 249 flags::NumSpatialLayers(), |
| 250 flags::TLDiscardThreshold(), |
| 251 flags::SLDiscardThreshold(), |
| 222 flags::LossPercent(), | 252 flags::LossPercent(), |
| 223 flags::LinkCapacity(), | 253 flags::LinkCapacity(), |
| 224 flags::QueueSize(), | 254 flags::QueueSize(), |
| 225 flags::AvgPropagationDelayMs(), | 255 flags::AvgPropagationDelayMs(), |
| 226 flags::StdPropagationDelayMs(), | 256 flags::StdPropagationDelayMs(), |
| 227 flags::FLAGS_logs}; | 257 flags::FLAGS_logs}; |
| 228 ScreenshareLoopback loopback(config); | 258 ScreenshareLoopback loopback(config); |
| 229 loopback.Run(); | 259 loopback.Run(); |
| 230 } | 260 } |
| 231 } // namespace webrtc | 261 } // namespace webrtc |
| 232 | 262 |
| 233 int main(int argc, char* argv[]) { | 263 int main(int argc, char* argv[]) { |
| 234 ::testing::InitGoogleTest(&argc, argv); | 264 ::testing::InitGoogleTest(&argc, argv); |
| 235 google::ParseCommandLineFlags(&argc, &argv, true); | 265 google::ParseCommandLineFlags(&argc, &argv, true); |
| 236 webrtc::test::InitFieldTrialsFromString( | 266 webrtc::test::InitFieldTrialsFromString( |
| 237 webrtc::flags::FLAGS_force_fieldtrials); | 267 webrtc::flags::FLAGS_force_fieldtrials); |
| 238 webrtc::test::RunTest(webrtc::Loopback); | 268 webrtc::test::RunTest(webrtc::Loopback); |
| 239 return 0; | 269 return 0; |
| 240 } | 270 } |
| OLD | NEW |