| 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 | 10 |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 int64_t capture_time_ms = fake_clock_.TimeInMilliseconds(); | 493 int64_t capture_time_ms = fake_clock_.TimeInMilliseconds(); |
| 494 auto packet = rtp_sender_->AllocatePacket(); | 494 auto packet = rtp_sender_->AllocatePacket(); |
| 495 packet->SetPayloadType(kPayload); | 495 packet->SetPayloadType(kPayload); |
| 496 packet->SetMarker(true); | 496 packet->SetMarker(true); |
| 497 packet->SetTimestamp(kTimestamp); | 497 packet->SetTimestamp(kTimestamp); |
| 498 packet->set_capture_time_ms(capture_time_ms); | 498 packet->set_capture_time_ms(capture_time_ms); |
| 499 const VideoSendTiming kVideoTiming = {0u, 0u, 0u, 0u, 0u, 0u, true}; | 499 const VideoSendTiming kVideoTiming = {0u, 0u, 0u, 0u, 0u, 0u, true}; |
| 500 packet->SetExtension<VideoTimingExtension>(kVideoTiming); | 500 packet->SetExtension<VideoTimingExtension>(kVideoTiming); |
| 501 EXPECT_TRUE(rtp_sender_->AssignSequenceNumber(packet.get())); | 501 EXPECT_TRUE(rtp_sender_->AssignSequenceNumber(packet.get())); |
| 502 size_t packet_size = packet->size(); | 502 size_t packet_size = packet->size(); |
| 503 webrtc::RTPHeader rtp_header; | |
| 504 | |
| 505 packet->GetHeader(&rtp_header); | |
| 506 | 503 |
| 507 const int kStoredTimeInMs = 100; | 504 const int kStoredTimeInMs = 100; |
| 508 fake_clock_.AdvanceTimeMilliseconds(kStoredTimeInMs); | 505 fake_clock_.AdvanceTimeMilliseconds(kStoredTimeInMs); |
| 509 | 506 |
| 510 EXPECT_TRUE(rtp_sender_->SendToNetwork(std::move(packet), | 507 EXPECT_TRUE(rtp_sender_->SendToNetwork(std::move(packet), |
| 511 kAllowRetransmission, | 508 kAllowRetransmission, |
| 512 RtpPacketSender::kNormalPriority)); | 509 RtpPacketSender::kNormalPriority)); |
| 513 EXPECT_EQ(1, transport_.packets_sent()); | 510 EXPECT_EQ(1, transport_.packets_sent()); |
| 514 EXPECT_EQ(packet_size, transport_.last_sent_packet().size()); | 511 EXPECT_EQ(packet_size, transport_.last_sent_packet().size()); |
| 515 | 512 |
| 516 transport_.last_sent_packet().GetHeader(&rtp_header); | 513 VideoSendTiming video_timing; |
| 517 EXPECT_TRUE(rtp_header.extension.has_video_timing); | 514 EXPECT_TRUE(transport_.last_sent_packet().GetExtension<VideoTimingExtension>( |
| 518 EXPECT_EQ(kStoredTimeInMs, | 515 &video_timing)); |
| 519 rtp_header.extension.video_timing.pacer_exit_delta_ms); | 516 EXPECT_EQ(kStoredTimeInMs, video_timing.pacer_exit_delta_ms); |
| 520 | 517 |
| 521 fake_clock_.AdvanceTimeMilliseconds(kStoredTimeInMs); | 518 fake_clock_.AdvanceTimeMilliseconds(kStoredTimeInMs); |
| 522 rtp_sender_->TimeToSendPacket(kSsrc, kSeqNum, capture_time_ms, false, | 519 rtp_sender_->TimeToSendPacket(kSsrc, kSeqNum, capture_time_ms, false, |
| 523 PacedPacketInfo()); | 520 PacedPacketInfo()); |
| 524 | 521 |
| 525 EXPECT_EQ(2, transport_.packets_sent()); | 522 EXPECT_EQ(2, transport_.packets_sent()); |
| 526 EXPECT_EQ(packet_size, transport_.last_sent_packet().size()); | 523 EXPECT_EQ(packet_size, transport_.last_sent_packet().size()); |
| 527 | 524 |
| 528 transport_.last_sent_packet().GetHeader(&rtp_header); | 525 EXPECT_TRUE(transport_.last_sent_packet().GetExtension<VideoTimingExtension>( |
| 529 EXPECT_TRUE(rtp_header.extension.has_video_timing); | 526 &video_timing)); |
| 530 EXPECT_EQ(kStoredTimeInMs * 2, | 527 EXPECT_EQ(kStoredTimeInMs * 2, video_timing.pacer_exit_delta_ms); |
| 531 rtp_header.extension.video_timing.pacer_exit_delta_ms); | |
| 532 } | 528 } |
| 533 | 529 |
| 534 TEST_P(RtpSenderTest, TrafficSmoothingWithExtensions) { | 530 TEST_P(RtpSenderTest, TrafficSmoothingWithExtensions) { |
| 535 EXPECT_CALL(mock_paced_sender_, InsertPacket(RtpPacketSender::kNormalPriority, | 531 EXPECT_CALL(mock_paced_sender_, InsertPacket(RtpPacketSender::kNormalPriority, |
| 536 kSsrc, kSeqNum, _, _, _)); | 532 kSsrc, kSeqNum, _, _, _)); |
| 537 EXPECT_CALL(mock_rtc_event_log_, | 533 EXPECT_CALL(mock_rtc_event_log_, |
| 538 LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _)); | 534 LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _)); |
| 539 | 535 |
| 540 rtp_sender_->SetStorePacketsStatus(true, 10); | 536 rtp_sender_->SetStorePacketsStatus(true, 10); |
| 541 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( | 537 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension( |
| (...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1995 INSTANTIATE_TEST_CASE_P(WithAndWithoutOverhead, | 1991 INSTANTIATE_TEST_CASE_P(WithAndWithoutOverhead, |
| 1996 RtpSenderTestWithoutPacer, | 1992 RtpSenderTestWithoutPacer, |
| 1997 ::testing::Bool()); | 1993 ::testing::Bool()); |
| 1998 INSTANTIATE_TEST_CASE_P(WithAndWithoutOverhead, | 1994 INSTANTIATE_TEST_CASE_P(WithAndWithoutOverhead, |
| 1999 RtpSenderVideoTest, | 1995 RtpSenderVideoTest, |
| 2000 ::testing::Bool()); | 1996 ::testing::Bool()); |
| 2001 INSTANTIATE_TEST_CASE_P(WithAndWithoutOverhead, | 1997 INSTANTIATE_TEST_CASE_P(WithAndWithoutOverhead, |
| 2002 RtpSenderAudioTest, | 1998 RtpSenderAudioTest, |
| 2003 ::testing::Bool()); | 1999 ::testing::Bool()); |
| 2004 } // namespace webrtc | 2000 } // namespace webrtc |
| OLD | NEW |