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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 DCHECK(remote_bitrate_estimator_ != nullptr); |
123 remote_bitrate_estimator_->IncomingPacket(clock_->TimeInMilliseconds(), | 123 remote_bitrate_estimator_->IncomingPacket( |
124 length - 12, 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 } | 127 } |
128 total_sent_ += length; | 128 total_sent_ += length; |
129 padding_sent_ += header.paddingLength; | 129 padding_sent_ += header.paddingLength; |
130 ++total_packets_sent_; | 130 ++total_packets_sent_; |
131 if (header.paddingLength > 0) | 131 if (header.paddingLength > 0) |
132 ++padding_packets_sent_; | 132 ++padding_packets_sent_; |
133 // Handle RTX retransmission, but only for non-padding-only packets. | 133 // Handle RTX retransmission, but only for non-padding-only packets. |
134 if (rtx_media_ssrcs_.find(header.ssrc) != rtx_media_ssrcs_.end() && | 134 if (rtx_media_ssrcs_.find(header.ssrc) != rtx_media_ssrcs_.end() && |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 } | 262 } |
263 return test::DirectTransport::SendRtp(data, length); | 263 return test::DirectTransport::SendRtp(data, length); |
264 } | 264 } |
265 | 265 |
266 PacketReceiver::DeliveryStatus LowRateStreamObserver::DeliverPacket( | 266 PacketReceiver::DeliveryStatus LowRateStreamObserver::DeliverPacket( |
267 MediaType media_type, const uint8_t* packet, size_t length) { | 267 MediaType media_type, const uint8_t* packet, size_t length) { |
268 rtc::CritScope lock(&crit_); | 268 rtc::CritScope lock(&crit_); |
269 RTPHeader header; | 269 RTPHeader header; |
270 EXPECT_TRUE(rtp_parser_->Parse(packet, length, &header)); | 270 EXPECT_TRUE(rtp_parser_->Parse(packet, length, &header)); |
271 receive_stats_->IncomingPacket(header, length, false); | 271 receive_stats_->IncomingPacket(header, length, false); |
272 remote_bitrate_estimator_->IncomingPacket(clock_->TimeInMilliseconds(), | 272 remote_bitrate_estimator_->IncomingPacket( |
273 length - 12, header, true); | 273 clock_->TimeInMilliseconds(), length - header.headerLength, header, true); |
274 if (remote_bitrate_estimator_->TimeUntilNextProcess() <= 0) { | 274 if (remote_bitrate_estimator_->TimeUntilNextProcess() <= 0) { |
275 remote_bitrate_estimator_->Process(); | 275 remote_bitrate_estimator_->Process(); |
276 } | 276 } |
277 suspended_in_stats_ = send_stream_->GetStats().suspended; | 277 suspended_in_stats_ = send_stream_->GetStats().suspended; |
278 return DELIVERY_OK; | 278 return DELIVERY_OK; |
279 } | 279 } |
280 | 280 |
281 bool LowRateStreamObserver::SendRtcp(const uint8_t* packet, size_t length) { | 281 bool LowRateStreamObserver::SendRtcp(const uint8_t* packet, size_t length) { |
282 return true; | 282 return true; |
283 } | 283 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 } | 455 } |
456 | 456 |
457 void RampUpTest::RunRampUpDownUpTest(size_t number_of_streams, | 457 void RampUpTest::RunRampUpDownUpTest(size_t number_of_streams, |
458 bool rtx, | 458 bool rtx, |
459 bool red) { | 459 bool red) { |
460 test::DirectTransport receiver_transport; | 460 test::DirectTransport receiver_transport; |
461 LowRateStreamObserver stream_observer( | 461 LowRateStreamObserver stream_observer( |
462 &receiver_transport, Clock::GetRealTimeClock(), number_of_streams, rtx); | 462 &receiver_transport, Clock::GetRealTimeClock(), number_of_streams, rtx); |
463 | 463 |
464 Call::Config call_config(&stream_observer); | 464 Call::Config call_config(&stream_observer); |
| 465 call_config.bitrate_config.start_bitrate_bps = 60000; |
465 CreateSenderCall(call_config); | 466 CreateSenderCall(call_config); |
466 receiver_transport.SetReceiver(sender_call_->Receiver()); | 467 receiver_transport.SetReceiver(sender_call_->Receiver()); |
467 | 468 |
468 CreateSendConfig(number_of_streams); | 469 CreateSendConfig(number_of_streams); |
469 | 470 |
470 send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 471 send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
471 send_config_.rtp.extensions.push_back(RtpExtension( | 472 send_config_.rtp.extensions.push_back(RtpExtension( |
472 RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId)); | 473 RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId)); |
473 send_config_.suspend_below_min_bitrate = true; | 474 send_config_.suspend_below_min_bitrate = true; |
| 475 |
474 if (rtx) { | 476 if (rtx) { |
475 send_config_.rtp.rtx.payload_type = kSendRtxPayloadType; | 477 send_config_.rtp.rtx.payload_type = kSendRtxPayloadType; |
476 send_config_.rtp.rtx.ssrcs = GenerateSsrcs(number_of_streams, 200); | 478 send_config_.rtp.rtx.ssrcs = GenerateSsrcs(number_of_streams, 200); |
477 } | 479 } |
478 if (red) { | 480 if (red) { |
479 send_config_.rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 481 send_config_.rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; |
480 send_config_.rtp.fec.red_payload_type = kRedPayloadType; | 482 send_config_.rtp.fec.red_payload_type = kRedPayloadType; |
481 } | 483 } |
482 | 484 |
483 CreateStreams(); | 485 CreateStreams(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 | 554 |
553 TEST_F(RampUpTest, AbsSendTimeSimulcastByRedWithRtx) { | 555 TEST_F(RampUpTest, AbsSendTimeSimulcastByRedWithRtx) { |
554 RunRampUpTest(3, 0, RtpExtension::kAbsSendTime, true, true); | 556 RunRampUpTest(3, 0, RtpExtension::kAbsSendTime, true, true); |
555 } | 557 } |
556 | 558 |
557 TEST_F(RampUpTest, AbsSendTimeSingleStreamWithHighStartBitrate) { | 559 TEST_F(RampUpTest, AbsSendTimeSingleStreamWithHighStartBitrate) { |
558 RunRampUpTest(1, 0.9 * kSingleStreamTargetBps, RtpExtension::kAbsSendTime, | 560 RunRampUpTest(1, 0.9 * kSingleStreamTargetBps, RtpExtension::kAbsSendTime, |
559 false, false); | 561 false, false); |
560 } | 562 } |
561 } // namespace webrtc | 563 } // namespace webrtc |
OLD | NEW |