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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 frame_generator_capturer->ChangeResolution(1920, 1080); | 485 frame_generator_capturer->ChangeResolution(1920, 1080); |
486 } | 486 } |
487 | 487 |
488 // OnSinkWantsChanged is called when FrameGeneratorCapturer::AddOrUpdateSink | 488 // OnSinkWantsChanged is called when FrameGeneratorCapturer::AddOrUpdateSink |
489 // is called. | 489 // is called. |
490 void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink, | 490 void OnSinkWantsChanged(rtc::VideoSinkInterface<VideoFrame>* sink, |
491 const rtc::VideoSinkWants& wants) override { | 491 const rtc::VideoSinkWants& wants) override { |
492 // First expect CPU overuse. Then expect CPU underuse when the encoder | 492 // First expect CPU overuse. Then expect CPU underuse when the encoder |
493 // delay has been decreased. | 493 // delay has been decreased. |
494 if (wants.target_pixel_count && | 494 if (wants.target_pixel_count && |
495 *wants.target_pixel_count < | 495 *wants.target_pixel_count < wants.max_pixel_count) { |
496 wants.max_pixel_count.value_or(std::numeric_limits<int>::max())) { | |
497 // On adapting up, ViEEncoder::VideoSourceProxy will set the target | 496 // On adapting up, ViEEncoder::VideoSourceProxy will set the target |
498 // pixel count to a step up from the current and the max value to | 497 // pixel count to a step up from the current and the max value to |
499 // something higher than the target. | 498 // something higher than the target. |
500 EXPECT_FALSE(expect_lower_resolution_wants_); | 499 EXPECT_FALSE(expect_lower_resolution_wants_); |
501 observation_complete_.Set(); | 500 observation_complete_.Set(); |
502 } else if (wants.max_pixel_count) { | 501 } else if (wants.max_pixel_count < std::numeric_limits<int>::max()) { |
503 // On adapting down, ViEEncoder::VideoSourceProxy will set only the max | 502 // On adapting down, ViEEncoder::VideoSourceProxy will set only the max |
504 // pixel count, leaving the target unset. | 503 // pixel count, leaving the target unset. |
505 EXPECT_TRUE(expect_lower_resolution_wants_); | 504 EXPECT_TRUE(expect_lower_resolution_wants_); |
506 expect_lower_resolution_wants_ = false; | 505 expect_lower_resolution_wants_ = false; |
507 encoder_.SetDelay(2); | 506 encoder_.SetDelay(2); |
508 } | 507 } |
509 } | 508 } |
510 | 509 |
511 void ModifyVideoConfigs( | 510 void ModifyVideoConfigs( |
512 VideoSendStream::Config* send_config, | 511 VideoSendStream::Config* send_config, |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 uint32_t last_set_bitrate_kbps_; | 735 uint32_t last_set_bitrate_kbps_; |
737 VideoSendStream* send_stream_; | 736 VideoSendStream* send_stream_; |
738 test::FrameGeneratorCapturer* frame_generator_; | 737 test::FrameGeneratorCapturer* frame_generator_; |
739 VideoEncoderConfig encoder_config_; | 738 VideoEncoderConfig encoder_config_; |
740 } test; | 739 } test; |
741 | 740 |
742 RunBaseTest(&test); | 741 RunBaseTest(&test); |
743 } | 742 } |
744 | 743 |
745 } // namespace webrtc | 744 } // namespace webrtc |
OLD | NEW |