| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 next_timestamp_ += frame_time_ms_ * kSampleRate / 1000; | 44 next_timestamp_ += frame_time_ms_ * kSampleRate / 1000; |
| 45 clock_.AdvanceTimeMilliseconds(frame_time_ms_); | 45 clock_.AdvanceTimeMilliseconds(frame_time_ms_); |
| 46 } | 46 } |
| 47 | 47 |
| 48 SimulatedClock clock_; | 48 SimulatedClock clock_; |
| 49 MediaOptimization media_opt_; | 49 MediaOptimization media_opt_; |
| 50 int frame_time_ms_; | 50 int frame_time_ms_; |
| 51 uint32_t next_timestamp_; | 51 uint32_t next_timestamp_; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 | |
| 55 TEST_F(TestMediaOptimization, VerifyMuting) { | 54 TEST_F(TestMediaOptimization, VerifyMuting) { |
| 56 // Enable video suspension with these limits. | 55 // Enable video suspension with these limits. |
| 57 // Suspend the video when the rate is below 50 kbps and resume when it gets | 56 // Suspend the video when the rate is below 50 kbps and resume when it gets |
| 58 // above 50 + 10 kbps again. | 57 // above 50 + 10 kbps again. |
| 59 const uint32_t kThresholdBps = 50000; | 58 const uint32_t kThresholdBps = 50000; |
| 60 const uint32_t kWindowBps = 10000; | 59 const uint32_t kWindowBps = 10000; |
| 61 media_opt_.SuspendBelowMinBitrate(kThresholdBps, kWindowBps); | 60 media_opt_.SuspendBelowMinBitrate(kThresholdBps, kWindowBps); |
| 62 | 61 |
| 63 // The video should not be suspended from the start. | 62 // The video should not be suspended from the start. |
| 64 EXPECT_FALSE(media_opt_.IsVideoSuspended()); | 63 EXPECT_FALSE(media_opt_.IsVideoSuspended()); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // Using as much for codec bitrate as fec rate, new target rate should share | 145 // Using as much for codec bitrate as fec rate, new target rate should share |
| 147 // both equally, but only be half of max (since that ceiling should be hit). | 146 // both equally, but only be half of max (since that ceiling should be hit). |
| 148 protection_callback.fec_rate_bps_ = kCodecBitrateBps; | 147 protection_callback.fec_rate_bps_ = kCodecBitrateBps; |
| 149 target_bitrate = media_opt_.SetTargetRates(kMaxBitrateBps, 128, 100, | 148 target_bitrate = media_opt_.SetTargetRates(kMaxBitrateBps, 128, 100, |
| 150 &protection_callback, nullptr); | 149 &protection_callback, nullptr); |
| 151 EXPECT_EQ(kMaxBitrateBps / 2, static_cast<int>(target_bitrate)); | 150 EXPECT_EQ(kMaxBitrateBps / 2, static_cast<int>(target_bitrate)); |
| 152 } | 151 } |
| 153 | 152 |
| 154 } // namespace media_optimization | 153 } // namespace media_optimization |
| 155 } // namespace webrtc | 154 } // namespace webrtc |
| OLD | NEW |