OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unitt
est_helper.h" | 10 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unitt
est_helper.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 } | 240 } |
241 | 241 |
242 // Generates a frame of packets belonging to a stream at a given bitrate and | 242 // Generates a frame of packets belonging to a stream at a given bitrate and |
243 // with a given ssrc. The stream is pushed through a very simple simulated | 243 // with a given ssrc. The stream is pushed through a very simple simulated |
244 // network, and is then given to the receive-side bandwidth estimator. | 244 // network, and is then given to the receive-side bandwidth estimator. |
245 // Returns true if an over-use was seen, false otherwise. | 245 // Returns true if an over-use was seen, false otherwise. |
246 // The StreamGenerator::updated() should be used to check for any changes in | 246 // The StreamGenerator::updated() should be used to check for any changes in |
247 // target bitrate after the call to this function. | 247 // target bitrate after the call to this function. |
248 bool RemoteBitrateEstimatorTest::GenerateAndProcessFrame(uint32_t ssrc, | 248 bool RemoteBitrateEstimatorTest::GenerateAndProcessFrame(uint32_t ssrc, |
249 uint32_t bitrate_bps) { | 249 uint32_t bitrate_bps) { |
250 RTC_DCHECK_GT(bitrate_bps, 0u); | 250 RTC_DCHECK_GT(bitrate_bps, 0); |
251 stream_generator_->SetBitrateBps(bitrate_bps); | 251 stream_generator_->SetBitrateBps(bitrate_bps); |
252 testing::RtpStream::PacketList packets; | 252 testing::RtpStream::PacketList packets; |
253 int64_t next_time_us = stream_generator_->GenerateFrame( | 253 int64_t next_time_us = stream_generator_->GenerateFrame( |
254 &packets, clock_.TimeInMicroseconds()); | 254 &packets, clock_.TimeInMicroseconds()); |
255 bool overuse = false; | 255 bool overuse = false; |
256 while (!packets.empty()) { | 256 while (!packets.empty()) { |
257 testing::RtpStream::RtpPacket* packet = packets.front(); | 257 testing::RtpStream::RtpPacket* packet = packets.front(); |
258 bitrate_observer_->Reset(); | 258 bitrate_observer_->Reset(); |
259 // The simulated clock should match the time of packet->arrival_time | 259 // The simulated clock should match the time of packet->arrival_time |
260 // since both are used in IncomingPacket(). | 260 // since both are used in IncomingPacket(). |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs); | 606 clock_.AdvanceTimeMilliseconds(2 * kFrameIntervalMs); |
607 absolute_send_time = AddAbsSendTime(absolute_send_time, | 607 absolute_send_time = AddAbsSendTime(absolute_send_time, |
608 kFrameIntervalAbsSendTime); | 608 kFrameIntervalAbsSendTime); |
609 bitrate_estimator_->Process(); | 609 bitrate_estimator_->Process(); |
610 } | 610 } |
611 uint32_t bitrate_after = 0; | 611 uint32_t bitrate_after = 0; |
612 bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_after); | 612 bitrate_estimator_->LatestEstimate(&ssrcs, &bitrate_after); |
613 EXPECT_LT(bitrate_after, bitrate_before); | 613 EXPECT_LT(bitrate_after, bitrate_before); |
614 } | 614 } |
615 } // namespace webrtc | 615 } // namespace webrtc |
OLD | NEW |