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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } | 257 } |
258 | 258 |
259 void RunRtxTest(RtxMode rtx_method, int loss) { | 259 void RunRtxTest(RtxMode rtx_method, int loss) { |
260 rtp_payload_registry_.SetRtxSsrc(kTestSsrc + 1); | 260 rtp_payload_registry_.SetRtxSsrc(kTestSsrc + 1); |
261 rtp_rtcp_module_->SetRtxSendStatus(rtx_method); | 261 rtp_rtcp_module_->SetRtxSendStatus(rtx_method); |
262 rtp_rtcp_module_->SetRtxSsrc(kTestSsrc + 1); | 262 rtp_rtcp_module_->SetRtxSsrc(kTestSsrc + 1); |
263 transport_.DropEveryNthPacket(loss); | 263 transport_.DropEveryNthPacket(loss); |
264 uint32_t timestamp = 3000; | 264 uint32_t timestamp = 3000; |
265 uint16_t nack_list[kVideoNackListSize]; | 265 uint16_t nack_list[kVideoNackListSize]; |
266 for (int frame = 0; frame < kNumFrames; ++frame) { | 266 for (int frame = 0; frame < kNumFrames; ++frame) { |
267 EXPECT_TRUE(rtp_rtcp_module_->SendOutgoingData( | 267 EXPECT_EQ(0, rtp_rtcp_module_->SendOutgoingData( |
268 webrtc::kVideoFrameDelta, kPayloadType, timestamp, timestamp / 90, | 268 webrtc::kVideoFrameDelta, kPayloadType, timestamp, |
269 payload_data, payload_data_length, nullptr, nullptr, nullptr)); | 269 timestamp / 90, payload_data, payload_data_length)); |
270 // Min required delay until retransmit = 5 + RTT ms (RTT = 0). | 270 // Min required delay until retransmit = 5 + RTT ms (RTT = 0). |
271 fake_clock.AdvanceTimeMilliseconds(5); | 271 fake_clock.AdvanceTimeMilliseconds(5); |
272 int length = BuildNackList(nack_list); | 272 int length = BuildNackList(nack_list); |
273 if (length > 0) | 273 if (length > 0) |
274 rtp_rtcp_module_->SendNACK(nack_list, length); | 274 rtp_rtcp_module_->SendNACK(nack_list, length); |
275 fake_clock.AdvanceTimeMilliseconds(28); // 33ms - 5ms delay. | 275 fake_clock.AdvanceTimeMilliseconds(28); // 33ms - 5ms delay. |
276 rtp_rtcp_module_->Process(); | 276 rtp_rtcp_module_->Process(); |
277 // Prepare next frame. | 277 // Prepare next frame. |
278 timestamp += 3000; | 278 timestamp += 3000; |
279 } | 279 } |
(...skipping 23 matching lines...) Expand all Loading... |
303 // Disable StorePackets to be able to set a larger packet history. | 303 // Disable StorePackets to be able to set a larger packet history. |
304 rtp_rtcp_module_->SetStorePacketsStatus(false, 0); | 304 rtp_rtcp_module_->SetStorePacketsStatus(false, 0); |
305 // Enable StorePackets with a packet history of 2000 packets. | 305 // Enable StorePackets with a packet history of 2000 packets. |
306 rtp_rtcp_module_->SetStorePacketsStatus(true, 2000); | 306 rtp_rtcp_module_->SetStorePacketsStatus(true, 2000); |
307 // Drop 900 packets from the second one so that we get a NACK list which is | 307 // Drop 900 packets from the second one so that we get a NACK list which is |
308 // big enough to require 4 RTCP packets to be fully transmitted to the sender. | 308 // big enough to require 4 RTCP packets to be fully transmitted to the sender. |
309 transport_.DropConsecutivePackets(2, kNumPacketsToDrop); | 309 transport_.DropConsecutivePackets(2, kNumPacketsToDrop); |
310 // Send 30 frames which at the default size is roughly what we need to get | 310 // Send 30 frames which at the default size is roughly what we need to get |
311 // enough packets. | 311 // enough packets. |
312 for (int frame = 0; frame < kNumFrames; ++frame) { | 312 for (int frame = 0; frame < kNumFrames; ++frame) { |
313 EXPECT_TRUE(rtp_rtcp_module_->SendOutgoingData( | 313 EXPECT_EQ(0, rtp_rtcp_module_->SendOutgoingData( |
314 webrtc::kVideoFrameDelta, kPayloadType, timestamp, timestamp / 90, | 314 webrtc::kVideoFrameDelta, kPayloadType, timestamp, |
315 payload_data, payload_data_length, nullptr, nullptr, nullptr)); | 315 timestamp / 90, payload_data, payload_data_length)); |
316 // Prepare next frame. | 316 // Prepare next frame. |
317 timestamp += 3000; | 317 timestamp += 3000; |
318 fake_clock.AdvanceTimeMilliseconds(33); | 318 fake_clock.AdvanceTimeMilliseconds(33); |
319 rtp_rtcp_module_->Process(); | 319 rtp_rtcp_module_->Process(); |
320 } | 320 } |
321 EXPECT_FALSE(transport_.expected_sequence_numbers_.empty()); | 321 EXPECT_FALSE(transport_.expected_sequence_numbers_.empty()); |
322 EXPECT_FALSE(receiver_.sequence_numbers_.empty()); | 322 EXPECT_FALSE(receiver_.sequence_numbers_.empty()); |
323 size_t last_receive_count = receiver_.sequence_numbers_.size(); | 323 size_t last_receive_count = receiver_.sequence_numbers_.size(); |
324 int length = BuildNackList(nack_list); | 324 int length = BuildNackList(nack_list); |
325 for (int i = 0; i < kNumRequiredRtcp - 1; ++i) { | 325 for (int i = 0; i < kNumRequiredRtcp - 1; ++i) { |
(...skipping 11 matching lines...) Expand all Loading... |
337 RunRtxTest(kRtxRetransmitted, 10); | 337 RunRtxTest(kRtxRetransmitted, 10); |
338 EXPECT_EQ(kTestSequenceNumber, *(receiver_.sequence_numbers_.begin())); | 338 EXPECT_EQ(kTestSequenceNumber, *(receiver_.sequence_numbers_.begin())); |
339 EXPECT_EQ(kTestSequenceNumber + kTestNumberOfPackets - 1, | 339 EXPECT_EQ(kTestSequenceNumber + kTestNumberOfPackets - 1, |
340 *(receiver_.sequence_numbers_.rbegin())); | 340 *(receiver_.sequence_numbers_.rbegin())); |
341 EXPECT_EQ(kTestNumberOfPackets, receiver_.sequence_numbers_.size()); | 341 EXPECT_EQ(kTestNumberOfPackets, receiver_.sequence_numbers_.size()); |
342 EXPECT_EQ(kTestNumberOfRtxPackets, transport_.count_rtx_ssrc_); | 342 EXPECT_EQ(kTestNumberOfRtxPackets, transport_.count_rtx_ssrc_); |
343 EXPECT_TRUE(ExpectedPacketsReceived()); | 343 EXPECT_TRUE(ExpectedPacketsReceived()); |
344 } | 344 } |
345 | 345 |
346 } // namespace webrtc | 346 } // namespace webrtc |
OLD | NEW |