| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 "trials are separated by \"/\""); | 125 "trials are separated by \"/\""); |
| 126 } // namespace flags | 126 } // namespace flags |
| 127 | 127 |
| 128 class ScreenshareLoopback : public test::Loopback { | 128 class ScreenshareLoopback : public test::Loopback { |
| 129 public: | 129 public: |
| 130 explicit ScreenshareLoopback(const Config& config) : Loopback(config) { | 130 explicit ScreenshareLoopback(const Config& config) : Loopback(config) { |
| 131 vp8_settings_ = VideoEncoder::GetDefaultVp8Settings(); | 131 vp8_settings_ = VideoEncoder::GetDefaultVp8Settings(); |
| 132 vp8_settings_.denoisingOn = false; | 132 vp8_settings_.denoisingOn = false; |
| 133 vp8_settings_.frameDroppingOn = false; | 133 vp8_settings_.frameDroppingOn = false; |
| 134 vp8_settings_.numberOfTemporalLayers = 2; | 134 vp8_settings_.numberOfTemporalLayers = 2; |
| 135 |
| 136 vp9_settings_ = VideoEncoder::GetDefaultVp9Settings(); |
| 137 vp9_settings_.denoisingOn = false; |
| 138 vp9_settings_.frameDroppingOn = false; |
| 139 vp9_settings_.numberOfTemporalLayers = 2; |
| 135 } | 140 } |
| 136 virtual ~ScreenshareLoopback() {} | 141 virtual ~ScreenshareLoopback() {} |
| 137 | 142 |
| 138 protected: | 143 protected: |
| 139 VideoEncoderConfig CreateEncoderConfig() override { | 144 VideoEncoderConfig CreateEncoderConfig() override { |
| 140 VideoEncoderConfig encoder_config(test::Loopback::CreateEncoderConfig()); | 145 VideoEncoderConfig encoder_config(test::Loopback::CreateEncoderConfig()); |
| 141 VideoStream* stream = &encoder_config.streams[0]; | 146 VideoStream* stream = &encoder_config.streams[0]; |
| 142 encoder_config.content_type = VideoEncoderConfig::ContentType::kScreen; | 147 encoder_config.content_type = VideoEncoderConfig::ContentType::kScreen; |
| 143 encoder_config.min_transmit_bitrate_bps = flags::MinTransmitBitrate(); | 148 encoder_config.min_transmit_bitrate_bps = flags::MinTransmitBitrate(); |
| 144 encoder_config.encoder_specific_settings = &vp8_settings_; | 149 if (config_.codec == "VP8") { |
| 150 encoder_config.encoder_specific_settings = &vp8_settings_; |
| 151 } else if (config_.codec == "VP9") { |
| 152 encoder_config.encoder_specific_settings = &vp9_settings_; |
| 153 } else { |
| 154 RTC_NOTREACHED() << "Codec not supported!"; |
| 155 abort(); |
| 156 } |
| 145 stream->temporal_layer_thresholds_bps.clear(); | 157 stream->temporal_layer_thresholds_bps.clear(); |
| 146 stream->target_bitrate_bps = | 158 stream->target_bitrate_bps = |
| 147 static_cast<int>(config_.start_bitrate_kbps) * 1000; | 159 static_cast<int>(config_.start_bitrate_kbps) * 1000; |
| 148 stream->temporal_layer_thresholds_bps.push_back(stream->target_bitrate_bps); | 160 stream->temporal_layer_thresholds_bps.push_back(stream->target_bitrate_bps); |
| 149 return encoder_config; | 161 return encoder_config; |
| 150 } | 162 } |
| 151 | 163 |
| 152 test::VideoCapturer* CreateCapturer(VideoSendStream* send_stream) override { | 164 test::VideoCapturer* CreateCapturer(VideoSendStream* send_stream) override { |
| 153 std::vector<std::string> slides; | 165 std::vector<std::string> slides; |
| 154 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); | 166 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 171 Clock::GetRealTimeClock(), slides, kWidth, kHeight, flags::Width(), | 183 Clock::GetRealTimeClock(), slides, kWidth, kHeight, flags::Width(), |
| 172 flags::Height(), flags::ScrollDuration() * 1000, kPauseDurationMs); | 184 flags::Height(), flags::ScrollDuration() * 1000, kPauseDurationMs); |
| 173 | 185 |
| 174 test::FrameGeneratorCapturer* capturer(new test::FrameGeneratorCapturer( | 186 test::FrameGeneratorCapturer* capturer(new test::FrameGeneratorCapturer( |
| 175 clock_, send_stream->Input(), frame_generator, flags::Fps())); | 187 clock_, send_stream->Input(), frame_generator, flags::Fps())); |
| 176 EXPECT_TRUE(capturer->Init()); | 188 EXPECT_TRUE(capturer->Init()); |
| 177 return capturer; | 189 return capturer; |
| 178 } | 190 } |
| 179 | 191 |
| 180 VideoCodecVP8 vp8_settings_; | 192 VideoCodecVP8 vp8_settings_; |
| 193 VideoCodecVP9 vp9_settings_; |
| 181 }; | 194 }; |
| 182 | 195 |
| 183 void Loopback() { | 196 void Loopback() { |
| 184 test::Loopback::Config config{flags::Width(), | 197 test::Loopback::Config config{flags::Width(), |
| 185 flags::Height(), | 198 flags::Height(), |
| 186 flags::Fps(), | 199 flags::Fps(), |
| 187 flags::MinBitrate(), | 200 flags::MinBitrate(), |
| 188 flags::StartBitrate(), | 201 flags::StartBitrate(), |
| 189 flags::MaxBitrate(), | 202 flags::MaxBitrate(), |
| 190 flags::MinTransmitBitrate(), | 203 flags::MinTransmitBitrate(), |
| (...skipping 11 matching lines...) Expand all Loading... |
| 202 } // namespace webrtc | 215 } // namespace webrtc |
| 203 | 216 |
| 204 int main(int argc, char* argv[]) { | 217 int main(int argc, char* argv[]) { |
| 205 ::testing::InitGoogleTest(&argc, argv); | 218 ::testing::InitGoogleTest(&argc, argv); |
| 206 google::ParseCommandLineFlags(&argc, &argv, true); | 219 google::ParseCommandLineFlags(&argc, &argv, true); |
| 207 webrtc::test::InitFieldTrialsFromString( | 220 webrtc::test::InitFieldTrialsFromString( |
| 208 webrtc::flags::FLAGS_force_fieldtrials); | 221 webrtc::flags::FLAGS_force_fieldtrials); |
| 209 webrtc::test::RunTest(webrtc::Loopback); | 222 webrtc::test::RunTest(webrtc::Loopback); |
| 210 return 0; | 223 return 0; |
| 211 } | 224 } |
| OLD | NEW |