| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 test::FrameGeneratorCapturer* frame_generator_capturer) override { | 483 test::FrameGeneratorCapturer* frame_generator_capturer) override { |
| 484 frame_generator_capturer->SetSinkWantsObserver(this); | 484 frame_generator_capturer->SetSinkWantsObserver(this); |
| 485 } | 485 } |
| 486 | 486 |
| 487 // OnSinkWantsChanged is called when FrameGeneratorCapturer::AddOrUpdateSink | 487 // OnSinkWantsChanged is called when FrameGeneratorCapturer::AddOrUpdateSink |
| 488 // is called. | 488 // is called. |
| 489 void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink, | 489 void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink, |
| 490 const rtc::VideoSinkWants& wants) override { | 490 const rtc::VideoSinkWants& wants) override { |
| 491 // First expect CPU overuse. Then expect CPU underuse when the encoder | 491 // First expect CPU overuse. Then expect CPU underuse when the encoder |
| 492 // delay has been decreased. | 492 // delay has been decreased. |
| 493 if (wants.max_pixel_count) { | 493 if (wants.target_pixel_count) { |
| 494 // Target pixel count set indicates we want to move from a lower res |
| 495 // to a higher. |
| 496 EXPECT_FALSE(expect_lower_resolution_wants_); |
| 497 observation_complete_.Set(); |
| 498 } else if (wants.max_pixel_count) { |
| 499 // No target set, but max is applied indicates we are overusing and want |
| 500 // a lower resolution. |
| 494 EXPECT_TRUE(expect_lower_resolution_wants_); | 501 EXPECT_TRUE(expect_lower_resolution_wants_); |
| 495 expect_lower_resolution_wants_ = false; | 502 expect_lower_resolution_wants_ = false; |
| 496 encoder_.SetDelay(2); | 503 encoder_.SetDelay(2); |
| 497 } else if (wants.max_pixel_count_step_up) { | |
| 498 EXPECT_FALSE(expect_lower_resolution_wants_); | |
| 499 observation_complete_.Set(); | |
| 500 } | 504 } |
| 501 } | 505 } |
| 502 | 506 |
| 503 void ModifyVideoConfigs( | 507 void ModifyVideoConfigs( |
| 504 VideoSendStream::Config* send_config, | 508 VideoSendStream::Config* send_config, |
| 505 std::vector<VideoReceiveStream::Config>* receive_configs, | 509 std::vector<VideoReceiveStream::Config>* receive_configs, |
| 506 VideoEncoderConfig* encoder_config) override { | 510 VideoEncoderConfig* encoder_config) override { |
| 507 send_config->encoder_settings.encoder = &encoder_; | 511 send_config->encoder_settings.encoder = &encoder_; |
| 508 } | 512 } |
| 509 | 513 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 uint32_t last_set_bitrate_kbps_; | 731 uint32_t last_set_bitrate_kbps_; |
| 728 VideoSendStream* send_stream_; | 732 VideoSendStream* send_stream_; |
| 729 test::FrameGeneratorCapturer* frame_generator_; | 733 test::FrameGeneratorCapturer* frame_generator_; |
| 730 VideoEncoderConfig encoder_config_; | 734 VideoEncoderConfig encoder_config_; |
| 731 } test; | 735 } test; |
| 732 | 736 |
| 733 RunBaseTest(&test); | 737 RunBaseTest(&test); |
| 734 } | 738 } |
| 735 | 739 |
| 736 } // namespace webrtc | 740 } // namespace webrtc |
| OLD | NEW |