| 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( | 
|  | 87     tl_discard_threshold, | 
|  | 88     0, | 
|  | 89     "Discard TLs with id greater or equal the threshold. 0 to disable."); | 
|  | 90 int TLDiscardThreshold() { | 
|  | 91   return static_cast<int>(FLAGS_tl_discard_threshold); | 
|  | 92 } | 
|  | 93 | 
|  | 94 DEFINE_int32( | 
|  | 95     sl_discard_threshold, | 
|  | 96     0, | 
|  | 97     "Discard SLs with id greater or equal the threshold. 0 to disable."); | 
|  | 98 int SLDiscardThreshold() { | 
|  | 99   return static_cast<int>(FLAGS_sl_discard_threshold); | 
|  | 100 } | 
|  | 101 | 
| 81 DEFINE_int32(min_transmit_bitrate, 400, "Min transmit bitrate incl. padding."); | 102 DEFINE_int32(min_transmit_bitrate, 400, "Min transmit bitrate incl. padding."); | 
| 82 int MinTransmitBitrate() { | 103 int MinTransmitBitrate() { | 
| 83   return FLAGS_min_transmit_bitrate; | 104   return FLAGS_min_transmit_bitrate; | 
| 84 } | 105 } | 
| 85 | 106 | 
| 86 DEFINE_string(codec, "VP8", "Video codec to use."); | 107 DEFINE_string(codec, "VP8", "Video codec to use."); | 
| 87 std::string Codec() { | 108 std::string Codec() { | 
| 88   return static_cast<std::string>(FLAGS_codec); | 109   return static_cast<std::string>(FLAGS_codec); | 
| 89 } | 110 } | 
| 90 | 111 | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 128     "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" | 149     "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/" | 
| 129     " will assign the group Enable to field trial WebRTC-FooFeature. Multiple " | 150     " will assign the group Enable to field trial WebRTC-FooFeature. Multiple " | 
| 130     "trials are separated by \"/\""); | 151     "trials are separated by \"/\""); | 
| 131 }  // namespace flags | 152 }  // namespace flags | 
| 132 | 153 | 
| 133 class ScreenshareLoopback : public test::Loopback { | 154 class ScreenshareLoopback : public test::Loopback { | 
| 134  public: | 155  public: | 
| 135   explicit ScreenshareLoopback(const Config& config) : Loopback(config) { | 156   explicit ScreenshareLoopback(const Config& config) : Loopback(config) { | 
| 136     CHECK_GE(config.num_temporal_layers, 1u); | 157     CHECK_GE(config.num_temporal_layers, 1u); | 
| 137     CHECK_LE(config.num_temporal_layers, 2u); | 158     CHECK_LE(config.num_temporal_layers, 2u); | 
|  | 159     CHECK_GE(config.num_spatial_layers, 1u); | 
|  | 160     CHECK_LE(config.num_spatial_layers, 5u); | 
|  | 161     CHECK(config.num_spatial_layers == 1 || config.codec == "VP9"); | 
|  | 162     CHECK(config.num_spatial_layers == 1 || config.num_temporal_layers == 1); | 
|  | 163     CHECK_LT(config.tl_discard_threshold, config.num_temporal_layers); | 
|  | 164     CHECK_LT(config.sl_discard_threshold, config.num_spatial_layers); | 
| 138 | 165 | 
| 139     vp8_settings_ = VideoEncoder::GetDefaultVp8Settings(); | 166     vp8_settings_ = VideoEncoder::GetDefaultVp8Settings(); | 
| 140     vp8_settings_.denoisingOn = false; | 167     vp8_settings_.denoisingOn = false; | 
| 141     vp8_settings_.frameDroppingOn = false; | 168     vp8_settings_.frameDroppingOn = false; | 
| 142     vp8_settings_.numberOfTemporalLayers = | 169     vp8_settings_.numberOfTemporalLayers = | 
| 143         static_cast<unsigned char>(config.num_temporal_layers); | 170         static_cast<unsigned char>(config.num_temporal_layers); | 
| 144 | 171 | 
| 145     vp9_settings_ = VideoEncoder::GetDefaultVp9Settings(); | 172     vp9_settings_ = VideoEncoder::GetDefaultVp9Settings(); | 
| 146     vp9_settings_.denoisingOn = false; | 173     vp9_settings_.denoisingOn = false; | 
| 147     vp9_settings_.frameDroppingOn = false; | 174     vp9_settings_.frameDroppingOn = false; | 
| 148     vp9_settings_.numberOfTemporalLayers = | 175     vp9_settings_.numberOfTemporalLayers = | 
| 149         static_cast<unsigned char>(config.num_temporal_layers); | 176         static_cast<unsigned char>(config.num_temporal_layers); | 
|  | 177     vp9_settings_.numberOfSpatialLayers = | 
|  | 178         static_cast<unsigned char>(config.num_spatial_layers); | 
| 150   } | 179   } | 
| 151   virtual ~ScreenshareLoopback() {} | 180   virtual ~ScreenshareLoopback() {} | 
| 152 | 181 | 
| 153  protected: | 182  protected: | 
| 154   VideoEncoderConfig CreateEncoderConfig() override { | 183   VideoEncoderConfig CreateEncoderConfig() override { | 
| 155     VideoEncoderConfig encoder_config(test::Loopback::CreateEncoderConfig()); | 184     VideoEncoderConfig encoder_config(test::Loopback::CreateEncoderConfig()); | 
| 156     VideoStream* stream = &encoder_config.streams[0]; | 185     VideoStream* stream = &encoder_config.streams[0]; | 
| 157     encoder_config.content_type = VideoEncoderConfig::ContentType::kScreen; | 186     encoder_config.content_type = VideoEncoderConfig::ContentType::kScreen; | 
| 158     encoder_config.min_transmit_bitrate_bps = flags::MinTransmitBitrate(); | 187     encoder_config.min_transmit_bitrate_bps = flags::MinTransmitBitrate(); | 
| 159     int num_temporal_layers; | 188     int num_temporal_layers; | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 212 void Loopback() { | 241 void Loopback() { | 
| 213   test::Loopback::Config config{flags::Width(), | 242   test::Loopback::Config config{flags::Width(), | 
| 214                                 flags::Height(), | 243                                 flags::Height(), | 
| 215                                 flags::Fps(), | 244                                 flags::Fps(), | 
| 216                                 flags::MinBitrate(), | 245                                 flags::MinBitrate(), | 
| 217                                 flags::StartBitrate(), | 246                                 flags::StartBitrate(), | 
| 218                                 flags::MaxBitrate(), | 247                                 flags::MaxBitrate(), | 
| 219                                 flags::MinTransmitBitrate(), | 248                                 flags::MinTransmitBitrate(), | 
| 220                                 flags::Codec(), | 249                                 flags::Codec(), | 
| 221                                 flags::NumTemporalLayers(), | 250                                 flags::NumTemporalLayers(), | 
|  | 251                                 flags::NumSpatialLayers(), | 
|  | 252                                 flags::TLDiscardThreshold(), | 
|  | 253                                 flags::SLDiscardThreshold(), | 
| 222                                 flags::LossPercent(), | 254                                 flags::LossPercent(), | 
| 223                                 flags::LinkCapacity(), | 255                                 flags::LinkCapacity(), | 
| 224                                 flags::QueueSize(), | 256                                 flags::QueueSize(), | 
| 225                                 flags::AvgPropagationDelayMs(), | 257                                 flags::AvgPropagationDelayMs(), | 
| 226                                 flags::StdPropagationDelayMs(), | 258                                 flags::StdPropagationDelayMs(), | 
| 227                                 flags::FLAGS_logs}; | 259                                 flags::FLAGS_logs}; | 
| 228   ScreenshareLoopback loopback(config); | 260   ScreenshareLoopback loopback(config); | 
| 229   loopback.Run(); | 261   loopback.Run(); | 
| 230 } | 262 } | 
| 231 }  // namespace webrtc | 263 }  // namespace webrtc | 
| 232 | 264 | 
| 233 int main(int argc, char* argv[]) { | 265 int main(int argc, char* argv[]) { | 
| 234   ::testing::InitGoogleTest(&argc, argv); | 266   ::testing::InitGoogleTest(&argc, argv); | 
| 235   google::ParseCommandLineFlags(&argc, &argv, true); | 267   google::ParseCommandLineFlags(&argc, &argv, true); | 
| 236   webrtc::test::InitFieldTrialsFromString( | 268   webrtc::test::InitFieldTrialsFromString( | 
| 237       webrtc::flags::FLAGS_force_fieldtrials); | 269       webrtc::flags::FLAGS_force_fieldtrials); | 
| 238   webrtc::test::RunTest(webrtc::Loopback); | 270   webrtc::test::RunTest(webrtc::Loopback); | 
| 239   return 0; | 271   return 0; | 
| 240 } | 272 } | 
| OLD | NEW | 
|---|