OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 const webrtc::VideoSendStream::Config::EncoderSettings& settings) | 43 const webrtc::VideoSendStream::Config::EncoderSettings& settings) |
44 : ViEEncoder(1 /* number_of_cores */, | 44 : ViEEncoder(1 /* number_of_cores */, |
45 stats_proxy, | 45 stats_proxy, |
46 settings, | 46 settings, |
47 nullptr /* pre_encode_callback */, | 47 nullptr /* pre_encode_callback */, |
48 nullptr /* encoder_timing */) {} | 48 nullptr /* encoder_timing */) {} |
49 | 49 |
50 void TriggerCpuOveruse() { | 50 void TriggerCpuOveruse() { |
51 rtc::Event event(false, false); | 51 rtc::Event event(false, false); |
52 encoder_queue()->PostTask([this, &event] { | 52 encoder_queue()->PostTask([this, &event] { |
53 OveruseDetected(); | 53 ScaleDown(); |
54 event.Set(); | 54 event.Set(); |
55 }); | 55 }); |
56 event.Wait(rtc::Event::kForever); | 56 event.Wait(rtc::Event::kForever); |
57 } | 57 } |
58 | 58 |
59 void TriggerCpuNormalUsage() { | 59 void TriggerCpuNormalUsage() { |
60 rtc::Event event(false, false); | 60 rtc::Event event(false, false); |
61 encoder_queue()->PostTask([this, &event] { | 61 encoder_queue()->PostTask([this, &event] { |
62 NormalUsage(); | 62 ScaleUp(); |
63 event.Set(); | 63 event.Set(); |
64 }); | 64 }); |
65 event.Wait(rtc::Event::kForever); | 65 event.Wait(rtc::Event::kForever); |
66 } | 66 } |
67 }; | 67 }; |
68 | 68 |
69 } // namespace | 69 } // namespace |
70 | 70 |
71 class ViEEncoderTest : public ::testing::Test { | 71 class ViEEncoderTest : public ::testing::Test { |
72 public: | 72 public: |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 vie_encoder_->Stop(); | 626 vie_encoder_->Stop(); |
627 | 627 |
628 stats_proxy_.reset(); | 628 stats_proxy_.reset(); |
629 EXPECT_EQ(1, | 629 EXPECT_EQ(1, |
630 metrics::NumSamples("WebRTC.Video.CpuLimitedResolutionInPercent")); | 630 metrics::NumSamples("WebRTC.Video.CpuLimitedResolutionInPercent")); |
631 EXPECT_EQ( | 631 EXPECT_EQ( |
632 1, metrics::NumEvents("WebRTC.Video.CpuLimitedResolutionInPercent", 50)); | 632 1, metrics::NumEvents("WebRTC.Video.CpuLimitedResolutionInPercent", 50)); |
633 } | 633 } |
634 | 634 |
635 } // namespace webrtc | 635 } // namespace webrtc |
OLD | NEW |