| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 void StreamObserver::set_start_bitrate_bps(unsigned int start_bitrate_bps) { | 87 void StreamObserver::set_start_bitrate_bps(unsigned int start_bitrate_bps) { |
| 88 rtc::CritScope lock(&crit_); | 88 rtc::CritScope lock(&crit_); |
| 89 start_bitrate_bps_ = start_bitrate_bps; | 89 start_bitrate_bps_ = start_bitrate_bps; |
| 90 } | 90 } |
| 91 | 91 |
| 92 void StreamObserver::OnReceiveBitrateChanged( | 92 void StreamObserver::OnReceiveBitrateChanged( |
| 93 const std::vector<unsigned int>& ssrcs, unsigned int bitrate) { | 93 const std::vector<unsigned int>& ssrcs, unsigned int bitrate) { |
| 94 rtc::CritScope lock(&crit_); | 94 rtc::CritScope lock(&crit_); |
| 95 DCHECK_GT(expected_bitrate_bps_, 0u); | 95 RTC_DCHECK_GT(expected_bitrate_bps_, 0u); |
| 96 if (start_bitrate_bps_ != 0) { | 96 if (start_bitrate_bps_ != 0) { |
| 97 // For tests with an explicitly set start bitrate, verify the first | 97 // For tests with an explicitly set start bitrate, verify the first |
| 98 // bitrate estimate is close to the start bitrate and lower than the | 98 // bitrate estimate is close to the start bitrate and lower than the |
| 99 // test target bitrate. This is to verify a call respects the configured | 99 // test target bitrate. This is to verify a call respects the configured |
| 100 // start bitrate, but due to the BWE implementation we can't guarantee the | 100 // start bitrate, but due to the BWE implementation we can't guarantee the |
| 101 // first estimate really is as high as the start bitrate. | 101 // first estimate really is as high as the start bitrate. |
| 102 EXPECT_GT(bitrate, 0.9 * start_bitrate_bps_); | 102 EXPECT_GT(bitrate, 0.9 * start_bitrate_bps_); |
| 103 start_bitrate_bps_ = 0; | 103 start_bitrate_bps_ = 0; |
| 104 } | 104 } |
| 105 if (bitrate >= expected_bitrate_bps_) { | 105 if (bitrate >= expected_bitrate_bps_) { |
| 106 ramp_up_finished_ms_ = clock_->TimeInMilliseconds(); | 106 ramp_up_finished_ms_ = clock_->TimeInMilliseconds(); |
| 107 // Just trigger if there was any rtx padding packet. | 107 // Just trigger if there was any rtx padding packet. |
| 108 if (rtx_media_ssrcs_.empty() || rtx_media_sent_ > 0) { | 108 if (rtx_media_ssrcs_.empty() || rtx_media_sent_ > 0) { |
| 109 TriggerTestDone(); | 109 TriggerTestDone(); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 rtp_rtcp_->SetREMBData(bitrate, ssrcs); | 112 rtp_rtcp_->SetREMBData(bitrate, ssrcs); |
| 113 rtp_rtcp_->Process(); | 113 rtp_rtcp_->Process(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool StreamObserver::SendRtp(const uint8_t* packet, size_t length) { | 116 bool StreamObserver::SendRtp(const uint8_t* packet, size_t length) { |
| 117 rtc::CritScope lock(&crit_); | 117 rtc::CritScope lock(&crit_); |
| 118 RTPHeader header; | 118 RTPHeader header; |
| 119 EXPECT_TRUE(rtp_parser_->Parse(packet, length, &header)); | 119 EXPECT_TRUE(rtp_parser_->Parse(packet, length, &header)); |
| 120 receive_stats_->IncomingPacket(header, length, false); | 120 receive_stats_->IncomingPacket(header, length, false); |
| 121 payload_registry_->SetIncomingPayloadType(header); | 121 payload_registry_->SetIncomingPayloadType(header); |
| 122 DCHECK(remote_bitrate_estimator_ != nullptr); | 122 RTC_DCHECK(remote_bitrate_estimator_ != nullptr); |
| 123 remote_bitrate_estimator_->IncomingPacket( | 123 remote_bitrate_estimator_->IncomingPacket( |
| 124 clock_->TimeInMilliseconds(), length - header.headerLength, header, true); | 124 clock_->TimeInMilliseconds(), length - header.headerLength, header, true); |
| 125 if (remote_bitrate_estimator_->TimeUntilNextProcess() <= 0) { | 125 if (remote_bitrate_estimator_->TimeUntilNextProcess() <= 0) { |
| 126 remote_bitrate_estimator_->Process(); | 126 remote_bitrate_estimator_->Process(); |
| 127 rtp_rtcp_->Process(); | 127 rtp_rtcp_->Process(); |
| 128 } | 128 } |
| 129 total_sent_ += length; | 129 total_sent_ += length; |
| 130 padding_sent_ += header.paddingLength; | 130 padding_sent_ += header.paddingLength; |
| 131 ++total_packets_sent_; | 131 ++total_packets_sent_; |
| 132 if (header.paddingLength > 0) | 132 if (header.paddingLength > 0) |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 str += (number_of_streams_ > 1 ? "s" : ""); | 296 str += (number_of_streams_ > 1 ? "s" : ""); |
| 297 str += "_"; | 297 str += "_"; |
| 298 str += (rtx_used_ ? "" : "no"); | 298 str += (rtx_used_ ? "" : "no"); |
| 299 str += "rtx"; | 299 str += "rtx"; |
| 300 return str; | 300 return str; |
| 301 } | 301 } |
| 302 | 302 |
| 303 void LowRateStreamObserver::EvolveTestState(unsigned int bitrate_bps) { | 303 void LowRateStreamObserver::EvolveTestState(unsigned int bitrate_bps) { |
| 304 int64_t now = clock_->TimeInMilliseconds(); | 304 int64_t now = clock_->TimeInMilliseconds(); |
| 305 rtc::CritScope lock(&crit_); | 305 rtc::CritScope lock(&crit_); |
| 306 DCHECK(send_stream_ != nullptr); | 306 RTC_DCHECK(send_stream_ != nullptr); |
| 307 switch (test_state_) { | 307 switch (test_state_) { |
| 308 case kFirstRampup: { | 308 case kFirstRampup: { |
| 309 EXPECT_FALSE(suspended_in_stats_); | 309 EXPECT_FALSE(suspended_in_stats_); |
| 310 if (bitrate_bps > kExpectedHighBitrateBps) { | 310 if (bitrate_bps > kExpectedHighBitrateBps) { |
| 311 // The first ramp-up has reached the target bitrate. Change the | 311 // The first ramp-up has reached the target bitrate. Change the |
| 312 // channel limit, and move to the next test state. | 312 // channel limit, and move to the next test state. |
| 313 forward_transport_config_.link_capacity_kbps = | 313 forward_transport_config_.link_capacity_kbps = |
| 314 kLowBandwidthLimitBps / 1000; | 314 kLowBandwidthLimitBps / 1000; |
| 315 test::DirectTransport::SetConfig(forward_transport_config_); | 315 test::DirectTransport::SetConfig(forward_transport_config_); |
| 316 test_state_ = kLowRate; | 316 test_state_ = kLowRate; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 | 557 |
| 558 TEST_F(RampUpTest, AbsSendTimeSimulcastByRedWithRtx) { | 558 TEST_F(RampUpTest, AbsSendTimeSimulcastByRedWithRtx) { |
| 559 RunRampUpTest(3, 0, RtpExtension::kAbsSendTime, true, true); | 559 RunRampUpTest(3, 0, RtpExtension::kAbsSendTime, true, true); |
| 560 } | 560 } |
| 561 | 561 |
| 562 TEST_F(RampUpTest, AbsSendTimeSingleStreamWithHighStartBitrate) { | 562 TEST_F(RampUpTest, AbsSendTimeSingleStreamWithHighStartBitrate) { |
| 563 RunRampUpTest(1, 0.9 * kSingleStreamTargetBps, RtpExtension::kAbsSendTime, | 563 RunRampUpTest(1, 0.9 * kSingleStreamTargetBps, RtpExtension::kAbsSendTime, |
| 564 false, false); | 564 false, false); |
| 565 } | 565 } |
| 566 } // namespace webrtc | 566 } // namespace webrtc |
| OLD | NEW |