| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 settings, | 71 settings, |
| 72 nullptr /* pre_encode_callback */, | 72 nullptr /* pre_encode_callback */, |
| 73 nullptr /* encoder_timing */) {} | 73 nullptr /* encoder_timing */) {} |
| 74 | 74 |
| 75 void PostTaskAndWait(bool down, AdaptReason reason) { | 75 void PostTaskAndWait(bool down, AdaptReason reason) { |
| 76 rtc::Event event(false, false); | 76 rtc::Event event(false, false); |
| 77 encoder_queue()->PostTask([this, &event, reason, down] { | 77 encoder_queue()->PostTask([this, &event, reason, down] { |
| 78 down ? AdaptDown(reason) : AdaptUp(reason); | 78 down ? AdaptDown(reason) : AdaptUp(reason); |
| 79 event.Set(); | 79 event.Set(); |
| 80 }); | 80 }); |
| 81 RTC_DCHECK(event.Wait(5000)); | 81 ASSERT_TRUE(event.Wait(5000)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void TriggerCpuOveruse() { PostTaskAndWait(true, AdaptReason::kCpu); } | 84 void TriggerCpuOveruse() { PostTaskAndWait(true, AdaptReason::kCpu); } |
| 85 | 85 |
| 86 void TriggerCpuNormalUsage() { PostTaskAndWait(false, AdaptReason::kCpu); } | 86 void TriggerCpuNormalUsage() { PostTaskAndWait(false, AdaptReason::kCpu); } |
| 87 | 87 |
| 88 void TriggerQualityLow() { PostTaskAndWait(true, AdaptReason::kQuality); } | 88 void TriggerQualityLow() { PostTaskAndWait(true, AdaptReason::kQuality); } |
| 89 | 89 |
| 90 void TriggerQualityHigh() { PostTaskAndWait(false, AdaptReason::kQuality); } | 90 void TriggerQualityHigh() { PostTaskAndWait(false, AdaptReason::kQuality); } |
| 91 }; | 91 }; |
| (...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 | 1221 |
| 1222 // Trigger CPU normal use, return to original resoluton; | 1222 // Trigger CPU normal use, return to original resoluton; |
| 1223 vie_encoder_->TriggerCpuNormalUsage(); | 1223 vie_encoder_->TriggerCpuNormalUsage(); |
| 1224 video_source_.IncomingCapturedFrame( | 1224 video_source_.IncomingCapturedFrame( |
| 1225 CreateFrame(3, kFrameWidth, kFrameHeight)); | 1225 CreateFrame(3, kFrameWidth, kFrameHeight)); |
| 1226 sink_.WaitForEncodedFrame(kFrameWidth, kFrameHeight); | 1226 sink_.WaitForEncodedFrame(kFrameWidth, kFrameHeight); |
| 1227 | 1227 |
| 1228 vie_encoder_->Stop(); | 1228 vie_encoder_->Stop(); |
| 1229 } | 1229 } |
| 1230 } // namespace webrtc | 1230 } // namespace webrtc |
| OLD | NEW |