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 *wants.target_pixel_count < |
| 495 wants.max_pixel_count.value_or(std::numeric_limits<int>::max())) { |
| 496 // On adapting up, ViEEncoder::VideoSourceProxy will set the target |
| 497 // pixel count to a step up from the current and the max value to |
| 498 // something higher than the target. |
| 499 EXPECT_FALSE(expect_lower_resolution_wants_); |
| 500 observation_complete_.Set(); |
| 501 } else if (wants.max_pixel_count) { |
| 502 // On adapting down, ViEEncoder::VideoSourceProxy will set only the max |
| 503 // pixel count, leaving the target unset. |
494 EXPECT_TRUE(expect_lower_resolution_wants_); | 504 EXPECT_TRUE(expect_lower_resolution_wants_); |
495 expect_lower_resolution_wants_ = false; | 505 expect_lower_resolution_wants_ = false; |
496 encoder_.SetDelay(2); | 506 encoder_.SetDelay(2); |
497 } else if (wants.max_pixel_count_step_up) { | |
498 EXPECT_FALSE(expect_lower_resolution_wants_); | |
499 observation_complete_.Set(); | |
500 } | 507 } |
501 } | 508 } |
502 | 509 |
503 void ModifyVideoConfigs( | 510 void ModifyVideoConfigs( |
504 VideoSendStream::Config* send_config, | 511 VideoSendStream::Config* send_config, |
505 std::vector<VideoReceiveStream::Config>* receive_configs, | 512 std::vector<VideoReceiveStream::Config>* receive_configs, |
506 VideoEncoderConfig* encoder_config) override { | 513 VideoEncoderConfig* encoder_config) override { |
507 send_config->encoder_settings.encoder = &encoder_; | 514 send_config->encoder_settings.encoder = &encoder_; |
508 } | 515 } |
509 | 516 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 uint32_t last_set_bitrate_kbps_; | 734 uint32_t last_set_bitrate_kbps_; |
728 VideoSendStream* send_stream_; | 735 VideoSendStream* send_stream_; |
729 test::FrameGeneratorCapturer* frame_generator_; | 736 test::FrameGeneratorCapturer* frame_generator_; |
730 VideoEncoderConfig encoder_config_; | 737 VideoEncoderConfig encoder_config_; |
731 } test; | 738 } test; |
732 | 739 |
733 RunBaseTest(&test); | 740 RunBaseTest(&test); |
734 } | 741 } |
735 | 742 |
736 } // namespace webrtc | 743 } // namespace webrtc |
OLD | NEW |