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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 mock_paced_sender_(), | 134 mock_paced_sender_(), |
135 rtp_sender_(), | 135 rtp_sender_(), |
136 payload_(kPayload), | 136 payload_(kPayload), |
137 transport_(), | 137 transport_(), |
138 kMarkerBit(true) { | 138 kMarkerBit(true) { |
139 } | 139 } |
140 | 140 |
141 void SetUp() override { SetUpRtpSender(true); } | 141 void SetUp() override { SetUpRtpSender(true); } |
142 | 142 |
143 void SetUpRtpSender(bool pacer) { | 143 void SetUpRtpSender(bool pacer) { |
144 rtp_sender_.reset(new RTPSender(false, &fake_clock_, &transport_, nullptr, | 144 rtp_sender_.reset(new RTPSender(false, &fake_clock_, &transport_, |
145 pacer ? &mock_paced_sender_ : nullptr, | 145 pacer ? &mock_paced_sender_ : nullptr, |
146 &seq_num_allocator_, nullptr, nullptr, | 146 &seq_num_allocator_, nullptr, nullptr, |
147 nullptr, nullptr, &mock_rtc_event_log_)); | 147 nullptr, nullptr, &mock_rtc_event_log_)); |
148 rtp_sender_->SetSequenceNumber(kSeqNum); | 148 rtp_sender_->SetSequenceNumber(kSeqNum); |
149 } | 149 } |
150 | 150 |
151 SimulatedClock fake_clock_; | 151 SimulatedClock fake_clock_; |
152 MockRtcEventLog mock_rtc_event_log_; | 152 MockRtcEventLog mock_rtc_event_log_; |
153 MockRtpPacketSender mock_paced_sender_; | 153 MockRtpPacketSender mock_paced_sender_; |
154 MockTransportSequenceNumberAllocator seq_num_allocator_; | 154 MockTransportSequenceNumberAllocator seq_num_allocator_; |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 // Verify transmission time offset. This packet is sent without delay. | 947 // Verify transmission time offset. This packet is sent without delay. |
948 EXPECT_EQ(0, rtp_header.extension.transmissionTimeOffset); | 948 EXPECT_EQ(0, rtp_header.extension.transmissionTimeOffset); |
949 uint64_t expected_send_time = | 949 uint64_t expected_send_time = |
950 ConvertMsToAbsSendTime(fake_clock_.TimeInMilliseconds()); | 950 ConvertMsToAbsSendTime(fake_clock_.TimeInMilliseconds()); |
951 EXPECT_EQ(expected_send_time, rtp_header.extension.absoluteSendTime); | 951 EXPECT_EQ(expected_send_time, rtp_header.extension.absoluteSendTime); |
952 } | 952 } |
953 | 953 |
954 TEST_F(RtpSenderTest, SendRedundantPayloads) { | 954 TEST_F(RtpSenderTest, SendRedundantPayloads) { |
955 MockTransport transport; | 955 MockTransport transport; |
956 rtp_sender_.reset(new RTPSender( | 956 rtp_sender_.reset(new RTPSender( |
957 false, &fake_clock_, &transport, nullptr, &mock_paced_sender_, nullptr, | 957 false, &fake_clock_, &transport, &mock_paced_sender_, nullptr, |
958 nullptr, nullptr, nullptr, nullptr, &mock_rtc_event_log_)); | 958 nullptr, nullptr, nullptr, nullptr, &mock_rtc_event_log_)); |
959 rtp_sender_->SetSequenceNumber(kSeqNum); | 959 rtp_sender_->SetSequenceNumber(kSeqNum); |
960 rtp_sender_->SetRtxPayloadType(kRtxPayload, kPayload); | 960 rtp_sender_->SetRtxPayloadType(kRtxPayload, kPayload); |
961 | 961 |
962 uint16_t seq_num = kSeqNum; | 962 uint16_t seq_num = kSeqNum; |
963 rtp_sender_->SetStorePacketsStatus(true, 10); | 963 rtp_sender_->SetStorePacketsStatus(true, 10); |
964 int32_t rtp_header_len = kRtpHeaderSize; | 964 int32_t rtp_header_len = kRtpHeaderSize; |
965 EXPECT_EQ( | 965 EXPECT_EQ( |
966 0, rtp_sender_->RegisterRtpHeaderExtension(kRtpExtensionAbsoluteSendTime, | 966 0, rtp_sender_->RegisterRtpHeaderExtension(kRtpExtensionAbsoluteSendTime, |
967 kAbsoluteSendTimeExtensionId)); | 967 kAbsoluteSendTimeExtensionId)); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 ++num_calls_; | 1089 ++num_calls_; |
1090 ssrc_ = ssrc; | 1090 ssrc_ = ssrc; |
1091 frame_counts_ = frame_counts; | 1091 frame_counts_ = frame_counts; |
1092 } | 1092 } |
1093 | 1093 |
1094 uint32_t num_calls_; | 1094 uint32_t num_calls_; |
1095 uint32_t ssrc_; | 1095 uint32_t ssrc_; |
1096 FrameCounts frame_counts_; | 1096 FrameCounts frame_counts_; |
1097 } callback; | 1097 } callback; |
1098 | 1098 |
1099 rtp_sender_.reset(new RTPSender(false, &fake_clock_, &transport_, nullptr, | 1099 rtp_sender_.reset(new RTPSender(false, &fake_clock_, &transport_, |
1100 &mock_paced_sender_, nullptr, nullptr, | 1100 &mock_paced_sender_, nullptr, nullptr, |
1101 nullptr, &callback, nullptr, nullptr)); | 1101 nullptr, &callback, nullptr, nullptr)); |
1102 | 1102 |
1103 char payload_name[RTP_PAYLOAD_NAME_SIZE] = "GENERIC"; | 1103 char payload_name[RTP_PAYLOAD_NAME_SIZE] = "GENERIC"; |
1104 const uint8_t payload_type = 127; | 1104 const uint8_t payload_type = 127; |
1105 ASSERT_EQ(0, rtp_sender_->RegisterPayload(payload_name, payload_type, 90000, | 1105 ASSERT_EQ(0, rtp_sender_->RegisterPayload(payload_name, payload_type, 90000, |
1106 0, 1500)); | 1106 0, 1500)); |
1107 uint8_t payload[] = {47, 11, 32, 93, 89}; | 1107 uint8_t payload[] = {47, 11, 32, 93, 89}; |
1108 rtp_sender_->SetStorePacketsStatus(true, 1); | 1108 rtp_sender_->SetStorePacketsStatus(true, 1); |
1109 uint32_t ssrc = rtp_sender_->SSRC(); | 1109 uint32_t ssrc = rtp_sender_->SSRC(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 ssrc_ = ssrc; | 1145 ssrc_ = ssrc; |
1146 total_stats_ = total_stats; | 1146 total_stats_ = total_stats; |
1147 retransmit_stats_ = retransmit_stats; | 1147 retransmit_stats_ = retransmit_stats; |
1148 } | 1148 } |
1149 | 1149 |
1150 uint32_t num_calls_; | 1150 uint32_t num_calls_; |
1151 uint32_t ssrc_; | 1151 uint32_t ssrc_; |
1152 BitrateStatistics total_stats_; | 1152 BitrateStatistics total_stats_; |
1153 BitrateStatistics retransmit_stats_; | 1153 BitrateStatistics retransmit_stats_; |
1154 } callback; | 1154 } callback; |
1155 rtp_sender_.reset(new RTPSender(false, &fake_clock_, &transport_, nullptr, | 1155 rtp_sender_.reset(new RTPSender(false, &fake_clock_, &transport_, |
1156 nullptr, nullptr, nullptr, &callback, nullptr, | 1156 nullptr, nullptr, nullptr, &callback, nullptr, |
1157 nullptr, nullptr)); | 1157 nullptr, nullptr)); |
1158 | 1158 |
1159 // Simulate kNumPackets sent with kPacketInterval ms intervals. | 1159 // Simulate kNumPackets sent with kPacketInterval ms intervals. |
1160 const uint32_t kNumPackets = 15; | 1160 const uint32_t kNumPackets = 15; |
1161 const uint32_t kPacketInterval = 20; | 1161 const uint32_t kPacketInterval = 20; |
1162 // Overhead = 12 bytes RTP header + 1 byte generic header. | 1162 // Overhead = 12 bytes RTP header + 1 byte generic header. |
1163 const uint32_t kPacketOverhead = 13; | 1163 const uint32_t kPacketOverhead = 13; |
1164 | 1164 |
1165 char payload_name[RTP_PAYLOAD_NAME_SIZE] = "GENERIC"; | 1165 char payload_name[RTP_PAYLOAD_NAME_SIZE] = "GENERIC"; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 | 1198 |
1199 rtp_sender_.reset(); | 1199 rtp_sender_.reset(); |
1200 } | 1200 } |
1201 | 1201 |
1202 class RtpSenderAudioTest : public RtpSenderTest { | 1202 class RtpSenderAudioTest : public RtpSenderTest { |
1203 protected: | 1203 protected: |
1204 RtpSenderAudioTest() {} | 1204 RtpSenderAudioTest() {} |
1205 | 1205 |
1206 void SetUp() override { | 1206 void SetUp() override { |
1207 payload_ = kAudioPayload; | 1207 payload_ = kAudioPayload; |
1208 rtp_sender_.reset(new RTPSender(true, &fake_clock_, &transport_, nullptr, | 1208 rtp_sender_.reset(new RTPSender(true, &fake_clock_, &transport_, |
1209 nullptr, nullptr, nullptr, nullptr, nullptr, | 1209 nullptr, nullptr, nullptr, nullptr, nullptr, |
1210 nullptr, nullptr)); | 1210 nullptr, nullptr)); |
1211 rtp_sender_->SetSequenceNumber(kSeqNum); | 1211 rtp_sender_->SetSequenceNumber(kSeqNum); |
1212 } | 1212 } |
1213 }; | 1213 }; |
1214 | 1214 |
1215 TEST_F(RtpSenderTestWithoutPacer, StreamDataCountersCallbacks) { | 1215 TEST_F(RtpSenderTestWithoutPacer, StreamDataCountersCallbacks) { |
1216 class TestCallback : public StreamDataCountersCallback { | 1216 class TestCallback : public StreamDataCountersCallback { |
1217 public: | 1217 public: |
1218 TestCallback() : StreamDataCountersCallback(), ssrc_(0), counters_() {} | 1218 TestCallback() : StreamDataCountersCallback(), ssrc_(0), counters_() {} |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), | 1526 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), |
1527 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); | 1527 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); |
1528 | 1528 |
1529 // Verify that this packet does have CVO byte. | 1529 // Verify that this packet does have CVO byte. |
1530 VerifyCVOPacket( | 1530 VerifyCVOPacket( |
1531 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), | 1531 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), |
1532 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, | 1532 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, |
1533 hdr.rotation); | 1533 hdr.rotation); |
1534 } | 1534 } |
1535 } // namespace webrtc | 1535 } // namespace webrtc |
OLD | NEW |