| 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 rtp_parser->RegisterRtpHeaderExtension(kRtpExtensionTransmissionTimeOffset, | 732 rtp_parser->RegisterRtpHeaderExtension(kRtpExtensionTransmissionTimeOffset, |
| 733 kTransmissionTimeOffsetExtensionId); | 733 kTransmissionTimeOffsetExtensionId); |
| 734 rtp_parser->RegisterRtpHeaderExtension(kRtpExtensionAbsoluteSendTime, | 734 rtp_parser->RegisterRtpHeaderExtension(kRtpExtensionAbsoluteSendTime, |
| 735 kAbsoluteSendTimeExtensionId); | 735 kAbsoluteSendTimeExtensionId); |
| 736 webrtc::RTPHeader rtp_header; | 736 webrtc::RTPHeader rtp_header; |
| 737 | 737 |
| 738 rtp_sender_->SetTargetBitrate(300000); | 738 rtp_sender_->SetTargetBitrate(300000); |
| 739 int64_t capture_time_ms = fake_clock_.TimeInMilliseconds(); | 739 int64_t capture_time_ms = fake_clock_.TimeInMilliseconds(); |
| 740 int rtp_length_int = rtp_sender_->BuildRTPheader( | 740 int rtp_length_int = rtp_sender_->BuildRTPheader( |
| 741 packet_, kPayload, kMarkerBit, timestamp, capture_time_ms); | 741 packet_, kPayload, kMarkerBit, timestamp, capture_time_ms); |
| 742 const uint32_t media_packet_timestamp = timestamp; |
| 742 ASSERT_NE(-1, rtp_length_int); | 743 ASSERT_NE(-1, rtp_length_int); |
| 743 size_t rtp_length = static_cast<size_t>(rtp_length_int); | 744 size_t rtp_length = static_cast<size_t>(rtp_length_int); |
| 744 | 745 |
| 745 // Packet should be stored in a send bucket. | 746 // Packet should be stored in a send bucket. |
| 746 EXPECT_EQ(0, rtp_sender_->SendToNetwork(packet_, | 747 EXPECT_EQ(0, rtp_sender_->SendToNetwork(packet_, |
| 747 0, | 748 0, |
| 748 rtp_length, | 749 rtp_length, |
| 749 capture_time_ms, | 750 capture_time_ms, |
| 750 kAllowRetransmission, | 751 kAllowRetransmission, |
| 751 PacedSender::kNormalPriority)); | 752 PacedSender::kNormalPriority)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 772 // Process send bucket. Padding should now be sent. | 773 // Process send bucket. Padding should now be sent. |
| 773 EXPECT_EQ(++total_packets_sent, transport_.packets_sent_); | 774 EXPECT_EQ(++total_packets_sent, transport_.packets_sent_); |
| 774 EXPECT_EQ(kMaxPaddingLength + rtp_header_len, | 775 EXPECT_EQ(kMaxPaddingLength + rtp_header_len, |
| 775 transport_.last_sent_packet_len_); | 776 transport_.last_sent_packet_len_); |
| 776 // Parse sent packet. | 777 // Parse sent packet. |
| 777 ASSERT_TRUE(rtp_parser->Parse(transport_.last_sent_packet_, | 778 ASSERT_TRUE(rtp_parser->Parse(transport_.last_sent_packet_, |
| 778 transport_.last_sent_packet_len_, | 779 transport_.last_sent_packet_len_, |
| 779 &rtp_header)); | 780 &rtp_header)); |
| 780 EXPECT_EQ(kMaxPaddingLength, rtp_header.paddingLength); | 781 EXPECT_EQ(kMaxPaddingLength, rtp_header.paddingLength); |
| 781 | 782 |
| 782 // Verify sequence number and timestamp. | 783 // Verify sequence number and timestamp. The timestamp should be the same |
| 784 // as the last media packet. |
| 783 EXPECT_EQ(seq_num++, rtp_header.sequenceNumber); | 785 EXPECT_EQ(seq_num++, rtp_header.sequenceNumber); |
| 784 EXPECT_EQ(timestamp, rtp_header.timestamp); | 786 EXPECT_EQ(media_packet_timestamp, rtp_header.timestamp); |
| 785 // Verify transmission time offset. | 787 // Verify transmission time offset. |
| 786 EXPECT_EQ(0, rtp_header.extension.transmissionTimeOffset); | 788 int offset = timestamp - media_packet_timestamp; |
| 789 EXPECT_EQ(offset, rtp_header.extension.transmissionTimeOffset); |
| 787 uint64_t expected_send_time = | 790 uint64_t expected_send_time = |
| 788 ConvertMsToAbsSendTime(fake_clock_.TimeInMilliseconds()); | 791 ConvertMsToAbsSendTime(fake_clock_.TimeInMilliseconds()); |
| 789 EXPECT_EQ(expected_send_time, rtp_header.extension.absoluteSendTime); | 792 EXPECT_EQ(expected_send_time, rtp_header.extension.absoluteSendTime); |
| 790 fake_clock_.AdvanceTimeMilliseconds(kPaddingPeriodMs); | 793 fake_clock_.AdvanceTimeMilliseconds(kPaddingPeriodMs); |
| 791 timestamp += 90 * kPaddingPeriodMs; | 794 timestamp += 90 * kPaddingPeriodMs; |
| 792 } | 795 } |
| 793 | 796 |
| 794 // Send a regular video packet again. | 797 // Send a regular video packet again. |
| 795 capture_time_ms = fake_clock_.TimeInMilliseconds(); | 798 capture_time_ms = fake_clock_.TimeInMilliseconds(); |
| 796 rtp_length_int = rtp_sender_->BuildRTPheader( | 799 rtp_length_int = rtp_sender_->BuildRTPheader( |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), | 1376 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), |
| 1374 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); | 1377 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); |
| 1375 | 1378 |
| 1376 // Verify that this packet does have CVO byte. | 1379 // Verify that this packet does have CVO byte. |
| 1377 VerifyCVOPacket( | 1380 VerifyCVOPacket( |
| 1378 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), | 1381 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), |
| 1379 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, | 1382 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, |
| 1380 hdr.rotation); | 1383 hdr.rotation); |
| 1381 } | 1384 } |
| 1382 } // namespace webrtc | 1385 } // namespace webrtc |
| OLD | NEW |