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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 // Packet should be stored in a send bucket. | 759 // Packet should be stored in a send bucket. |
760 EXPECT_EQ(0, rtp_sender_->SendToNetwork(packet_, 0, rtp_length, | 760 EXPECT_EQ(0, rtp_sender_->SendToNetwork(packet_, 0, rtp_length, |
761 capture_time_ms, kAllowRetransmission, | 761 capture_time_ms, kAllowRetransmission, |
762 RtpPacketSender::kNormalPriority)); | 762 RtpPacketSender::kNormalPriority)); |
763 | 763 |
764 EXPECT_EQ(0, transport_.packets_sent_); | 764 EXPECT_EQ(0, transport_.packets_sent_); |
765 | 765 |
766 const int kStoredTimeInMs = 100; | 766 const int kStoredTimeInMs = 100; |
767 fake_clock_.AdvanceTimeMilliseconds(kStoredTimeInMs); | 767 fake_clock_.AdvanceTimeMilliseconds(kStoredTimeInMs); |
768 | 768 |
769 rtp_sender_->TimeToSendPacket(kSeqNum, capture_time_ms, false); | 769 rtp_sender_->TimeToSendPacket(kSeqNum, capture_time_ms, false, |
| 770 PacketInfo::kNotAProbe); |
770 | 771 |
771 // Process send bucket. Packet should now be sent. | 772 // Process send bucket. Packet should now be sent. |
772 EXPECT_EQ(1, transport_.packets_sent_); | 773 EXPECT_EQ(1, transport_.packets_sent_); |
773 EXPECT_EQ(rtp_length, transport_.last_sent_packet_len_); | 774 EXPECT_EQ(rtp_length, transport_.last_sent_packet_len_); |
774 // Parse sent packet. | 775 // Parse sent packet. |
775 webrtc::RtpUtility::RtpHeaderParser rtp_parser(transport_.last_sent_packet_, | 776 webrtc::RtpUtility::RtpHeaderParser rtp_parser(transport_.last_sent_packet_, |
776 rtp_length); | 777 rtp_length); |
777 webrtc::RTPHeader rtp_header; | 778 webrtc::RTPHeader rtp_header; |
778 RtpHeaderExtensionMap map; | 779 RtpHeaderExtensionMap map; |
779 map.Register(kRtpExtensionTransmissionTimeOffset, | 780 map.Register(kRtpExtensionTransmissionTimeOffset, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 | 819 |
819 EXPECT_CALL(mock_paced_sender_, InsertPacket(RtpPacketSender::kNormalPriority, | 820 EXPECT_CALL(mock_paced_sender_, InsertPacket(RtpPacketSender::kNormalPriority, |
820 _, kSeqNum, _, _, _)); | 821 _, kSeqNum, _, _, _)); |
821 | 822 |
822 const int kStoredTimeInMs = 100; | 823 const int kStoredTimeInMs = 100; |
823 fake_clock_.AdvanceTimeMilliseconds(kStoredTimeInMs); | 824 fake_clock_.AdvanceTimeMilliseconds(kStoredTimeInMs); |
824 | 825 |
825 EXPECT_EQ(rtp_length_int, rtp_sender_->ReSendPacket(kSeqNum)); | 826 EXPECT_EQ(rtp_length_int, rtp_sender_->ReSendPacket(kSeqNum)); |
826 EXPECT_EQ(0, transport_.packets_sent_); | 827 EXPECT_EQ(0, transport_.packets_sent_); |
827 | 828 |
828 rtp_sender_->TimeToSendPacket(kSeqNum, capture_time_ms, false); | 829 rtp_sender_->TimeToSendPacket(kSeqNum, capture_time_ms, false, |
| 830 PacketInfo::kNotAProbe); |
829 | 831 |
830 // Process send bucket. Packet should now be sent. | 832 // Process send bucket. Packet should now be sent. |
831 EXPECT_EQ(1, transport_.packets_sent_); | 833 EXPECT_EQ(1, transport_.packets_sent_); |
832 EXPECT_EQ(rtp_length, transport_.last_sent_packet_len_); | 834 EXPECT_EQ(rtp_length, transport_.last_sent_packet_len_); |
833 | 835 |
834 // Parse sent packet. | 836 // Parse sent packet. |
835 webrtc::RtpUtility::RtpHeaderParser rtp_parser(transport_.last_sent_packet_, | 837 webrtc::RtpUtility::RtpHeaderParser rtp_parser(transport_.last_sent_packet_, |
836 rtp_length); | 838 rtp_length); |
837 webrtc::RTPHeader rtp_header; | 839 webrtc::RTPHeader rtp_header; |
838 RtpHeaderExtensionMap map; | 840 RtpHeaderExtensionMap map; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 // Packet should be stored in a send bucket. | 896 // Packet should be stored in a send bucket. |
895 EXPECT_EQ(0, rtp_sender_->SendToNetwork(packet_, 0, rtp_length, | 897 EXPECT_EQ(0, rtp_sender_->SendToNetwork(packet_, 0, rtp_length, |
896 capture_time_ms, kAllowRetransmission, | 898 capture_time_ms, kAllowRetransmission, |
897 RtpPacketSender::kNormalPriority)); | 899 RtpPacketSender::kNormalPriority)); |
898 | 900 |
899 int total_packets_sent = 0; | 901 int total_packets_sent = 0; |
900 EXPECT_EQ(total_packets_sent, transport_.packets_sent_); | 902 EXPECT_EQ(total_packets_sent, transport_.packets_sent_); |
901 | 903 |
902 const int kStoredTimeInMs = 100; | 904 const int kStoredTimeInMs = 100; |
903 fake_clock_.AdvanceTimeMilliseconds(kStoredTimeInMs); | 905 fake_clock_.AdvanceTimeMilliseconds(kStoredTimeInMs); |
904 rtp_sender_->TimeToSendPacket(seq_num++, capture_time_ms, false); | 906 rtp_sender_->TimeToSendPacket(seq_num++, capture_time_ms, false, |
| 907 PacketInfo::kNotAProbe); |
905 // Packet should now be sent. This test doesn't verify the regular video | 908 // Packet should now be sent. This test doesn't verify the regular video |
906 // packet, since it is tested in another test. | 909 // packet, since it is tested in another test. |
907 EXPECT_EQ(++total_packets_sent, transport_.packets_sent_); | 910 EXPECT_EQ(++total_packets_sent, transport_.packets_sent_); |
908 timestamp += 90 * kStoredTimeInMs; | 911 timestamp += 90 * kStoredTimeInMs; |
909 | 912 |
910 // Send padding 4 times, waiting 50 ms between each. | 913 // Send padding 4 times, waiting 50 ms between each. |
911 for (int i = 0; i < 4; ++i) { | 914 for (int i = 0; i < 4; ++i) { |
912 const int kPaddingPeriodMs = 50; | 915 const int kPaddingPeriodMs = 50; |
913 const size_t kPaddingBytes = 100; | 916 const size_t kPaddingBytes = 100; |
914 const size_t kMaxPaddingLength = 224; // Value taken from rtp_sender.cc. | 917 const size_t kMaxPaddingLength = 224; // Value taken from rtp_sender.cc. |
915 // Padding will be forced to full packets. | 918 // Padding will be forced to full packets. |
916 EXPECT_EQ(kMaxPaddingLength, rtp_sender_->TimeToSendPadding(kPaddingBytes)); | 919 EXPECT_EQ(kMaxPaddingLength, rtp_sender_->TimeToSendPadding( |
| 920 kPaddingBytes, PacketInfo::kNotAProbe)); |
917 | 921 |
918 // Process send bucket. Padding should now be sent. | 922 // Process send bucket. Padding should now be sent. |
919 EXPECT_EQ(++total_packets_sent, transport_.packets_sent_); | 923 EXPECT_EQ(++total_packets_sent, transport_.packets_sent_); |
920 EXPECT_EQ(kMaxPaddingLength + rtp_header_len, | 924 EXPECT_EQ(kMaxPaddingLength + rtp_header_len, |
921 transport_.last_sent_packet_len_); | 925 transport_.last_sent_packet_len_); |
922 // Parse sent packet. | 926 // Parse sent packet. |
923 ASSERT_TRUE(rtp_parser->Parse(transport_.last_sent_packet_, | 927 ASSERT_TRUE(rtp_parser->Parse(transport_.last_sent_packet_, |
924 transport_.last_sent_packet_len_, | 928 transport_.last_sent_packet_len_, |
925 &rtp_header)); | 929 &rtp_header)); |
926 EXPECT_EQ(kMaxPaddingLength, rtp_header.paddingLength); | 930 EXPECT_EQ(kMaxPaddingLength, rtp_header.paddingLength); |
(...skipping 20 matching lines...) Expand all Loading... |
947 rtp_length = static_cast<size_t>(rtp_length_int); | 951 rtp_length = static_cast<size_t>(rtp_length_int); |
948 | 952 |
949 EXPECT_CALL(mock_paced_sender_, | 953 EXPECT_CALL(mock_paced_sender_, |
950 InsertPacket(RtpPacketSender::kNormalPriority, _, _, _, _, _)); | 954 InsertPacket(RtpPacketSender::kNormalPriority, _, _, _, _, _)); |
951 | 955 |
952 // Packet should be stored in a send bucket. | 956 // Packet should be stored in a send bucket. |
953 EXPECT_EQ(0, rtp_sender_->SendToNetwork(packet_, 0, rtp_length, | 957 EXPECT_EQ(0, rtp_sender_->SendToNetwork(packet_, 0, rtp_length, |
954 capture_time_ms, kAllowRetransmission, | 958 capture_time_ms, kAllowRetransmission, |
955 RtpPacketSender::kNormalPriority)); | 959 RtpPacketSender::kNormalPriority)); |
956 | 960 |
957 rtp_sender_->TimeToSendPacket(seq_num, capture_time_ms, false); | 961 rtp_sender_->TimeToSendPacket(seq_num, capture_time_ms, false, |
| 962 PacketInfo::kNotAProbe); |
958 // Process send bucket. | 963 // Process send bucket. |
959 EXPECT_EQ(++total_packets_sent, transport_.packets_sent_); | 964 EXPECT_EQ(++total_packets_sent, transport_.packets_sent_); |
960 EXPECT_EQ(rtp_length, transport_.last_sent_packet_len_); | 965 EXPECT_EQ(rtp_length, transport_.last_sent_packet_len_); |
961 // Parse sent packet. | 966 // Parse sent packet. |
962 ASSERT_TRUE( | 967 ASSERT_TRUE( |
963 rtp_parser->Parse(transport_.last_sent_packet_, rtp_length, &rtp_header)); | 968 rtp_parser->Parse(transport_.last_sent_packet_, rtp_length, &rtp_header)); |
964 | 969 |
965 // Verify sequence number and timestamp. | 970 // Verify sequence number and timestamp. |
966 EXPECT_EQ(seq_num, rtp_header.sequenceNumber); | 971 EXPECT_EQ(seq_num, rtp_header.sequenceNumber); |
967 EXPECT_EQ(timestamp, rtp_header.timestamp); | 972 EXPECT_EQ(timestamp, rtp_header.timestamp); |
(...skipping 12 matching lines...) Expand all Loading... |
980 EXPECT_CALL(send_packet_observer_, | 985 EXPECT_CALL(send_packet_observer_, |
981 OnSendPacket(kTransportSequenceNumber, _, _)) | 986 OnSendPacket(kTransportSequenceNumber, _, _)) |
982 .Times(1); | 987 .Times(1); |
983 EXPECT_CALL(seq_num_allocator_, AllocateSequenceNumber()) | 988 EXPECT_CALL(seq_num_allocator_, AllocateSequenceNumber()) |
984 .WillOnce(testing::Return(kTransportSequenceNumber)); | 989 .WillOnce(testing::Return(kTransportSequenceNumber)); |
985 EXPECT_CALL(mock_paced_sender_, InsertPacket(_, _, _, _, _, _)).Times(1); | 990 EXPECT_CALL(mock_paced_sender_, InsertPacket(_, _, _, _, _, _)).Times(1); |
986 | 991 |
987 SendGenericPayload(); // Packet passed to pacer. | 992 SendGenericPayload(); // Packet passed to pacer. |
988 const bool kIsRetransmit = false; | 993 const bool kIsRetransmit = false; |
989 rtp_sender_->TimeToSendPacket(kSeqNum, fake_clock_.TimeInMilliseconds(), | 994 rtp_sender_->TimeToSendPacket(kSeqNum, fake_clock_.TimeInMilliseconds(), |
990 kIsRetransmit); | 995 kIsRetransmit, PacketInfo::kNotAProbe); |
991 EXPECT_EQ(1, transport_.packets_sent_); | 996 EXPECT_EQ(1, transport_.packets_sent_); |
992 } | 997 } |
993 | 998 |
994 TEST_F(RtpSenderTest, OnSendPacketNotUpdatedForRetransmits) { | 999 TEST_F(RtpSenderTest, OnSendPacketNotUpdatedForRetransmits) { |
995 EXPECT_CALL(mock_rtc_event_log_, // Ignore rtc event calls. | 1000 EXPECT_CALL(mock_rtc_event_log_, // Ignore rtc event calls. |
996 LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _)); | 1001 LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _)); |
997 rtp_sender_->SetStorePacketsStatus(true, 10); | 1002 rtp_sender_->SetStorePacketsStatus(true, 10); |
998 | 1003 |
999 EXPECT_CALL(send_packet_observer_, OnSendPacket(_, _, _)).Times(0); | 1004 EXPECT_CALL(send_packet_observer_, OnSendPacket(_, _, _)).Times(0); |
1000 EXPECT_CALL(seq_num_allocator_, AllocateSequenceNumber()) | 1005 EXPECT_CALL(seq_num_allocator_, AllocateSequenceNumber()) |
1001 .WillOnce(testing::Return(kTransportSequenceNumber)); | 1006 .WillOnce(testing::Return(kTransportSequenceNumber)); |
1002 EXPECT_CALL(mock_paced_sender_, InsertPacket(_, _, _, _, _, _)).Times(1); | 1007 EXPECT_CALL(mock_paced_sender_, InsertPacket(_, _, _, _, _, _)).Times(1); |
1003 | 1008 |
1004 SendGenericPayload(); // Packet passed to pacer. | 1009 SendGenericPayload(); // Packet passed to pacer. |
1005 const bool kIsRetransmit = true; | 1010 const bool kIsRetransmit = true; |
1006 rtp_sender_->TimeToSendPacket(kSeqNum, fake_clock_.TimeInMilliseconds(), | 1011 rtp_sender_->TimeToSendPacket(kSeqNum, fake_clock_.TimeInMilliseconds(), |
1007 kIsRetransmit); | 1012 kIsRetransmit, PacketInfo::kNotAProbe); |
1008 EXPECT_EQ(1, transport_.packets_sent_); | 1013 EXPECT_EQ(1, transport_.packets_sent_); |
1009 } | 1014 } |
1010 | 1015 |
1011 TEST_F(RtpSenderTest, OnSendPacketNotUpdatedWithoutSeqNumAllocator) { | 1016 TEST_F(RtpSenderTest, OnSendPacketNotUpdatedWithoutSeqNumAllocator) { |
1012 rtp_sender_.reset(new RTPSender( | 1017 rtp_sender_.reset(new RTPSender( |
1013 false, &fake_clock_, &transport_, &mock_paced_sender_, | 1018 false, &fake_clock_, &transport_, &mock_paced_sender_, |
1014 nullptr /* TransportSequenceNumberAllocator */, nullptr, nullptr, nullptr, | 1019 nullptr /* TransportSequenceNumberAllocator */, nullptr, nullptr, nullptr, |
1015 nullptr, nullptr, &send_packet_observer_)); | 1020 nullptr, nullptr, &send_packet_observer_)); |
1016 rtp_sender_->SetSequenceNumber(kSeqNum); | 1021 rtp_sender_->SetSequenceNumber(kSeqNum); |
1017 rtp_sender_->SetStorePacketsStatus(true, 10); | 1022 rtp_sender_->SetStorePacketsStatus(true, 10); |
1018 | 1023 |
1019 EXPECT_CALL(send_packet_observer_, OnSendPacket(_, _, _)).Times(0); | 1024 EXPECT_CALL(send_packet_observer_, OnSendPacket(_, _, _)).Times(0); |
1020 EXPECT_CALL(mock_paced_sender_, InsertPacket(_, _, _, _, _, _)).Times(1); | 1025 EXPECT_CALL(mock_paced_sender_, InsertPacket(_, _, _, _, _, _)).Times(1); |
1021 | 1026 |
1022 SendGenericPayload(); // Packet passed to pacer. | 1027 SendGenericPayload(); // Packet passed to pacer. |
1023 const bool kIsRetransmit = false; | 1028 const bool kIsRetransmit = false; |
1024 rtp_sender_->TimeToSendPacket(kSeqNum, fake_clock_.TimeInMilliseconds(), | 1029 rtp_sender_->TimeToSendPacket(kSeqNum, fake_clock_.TimeInMilliseconds(), |
1025 kIsRetransmit); | 1030 kIsRetransmit, PacketInfo::kNotAProbe); |
1026 EXPECT_EQ(1, transport_.packets_sent_); | 1031 EXPECT_EQ(1, transport_.packets_sent_); |
1027 } | 1032 } |
1028 | 1033 |
1029 TEST_F(RtpSenderTest, SendRedundantPayloads) { | 1034 TEST_F(RtpSenderTest, SendRedundantPayloads) { |
1030 MockTransport transport; | 1035 MockTransport transport; |
1031 rtp_sender_.reset(new RTPSender( | 1036 rtp_sender_.reset(new RTPSender( |
1032 false, &fake_clock_, &transport, &mock_paced_sender_, nullptr, nullptr, | 1037 false, &fake_clock_, &transport, &mock_paced_sender_, nullptr, nullptr, |
1033 nullptr, nullptr, nullptr, &mock_rtc_event_log_, nullptr)); | 1038 nullptr, nullptr, nullptr, &mock_rtc_event_log_, nullptr)); |
1034 | 1039 |
1035 rtp_sender_->SetSequenceNumber(kSeqNum); | 1040 rtp_sender_->SetSequenceNumber(kSeqNum); |
(...skipping 29 matching lines...) Expand all Loading... |
1065 .Times(kNumPayloadSizes); | 1070 .Times(kNumPayloadSizes); |
1066 EXPECT_CALL(mock_rtc_event_log_, | 1071 EXPECT_CALL(mock_rtc_event_log_, |
1067 LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _)) | 1072 LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _)) |
1068 .Times(kNumPayloadSizes); | 1073 .Times(kNumPayloadSizes); |
1069 | 1074 |
1070 // Send 10 packets of increasing size. | 1075 // Send 10 packets of increasing size. |
1071 for (size_t i = 0; i < kNumPayloadSizes; ++i) { | 1076 for (size_t i = 0; i < kNumPayloadSizes; ++i) { |
1072 int64_t capture_time_ms = fake_clock_.TimeInMilliseconds(); | 1077 int64_t capture_time_ms = fake_clock_.TimeInMilliseconds(); |
1073 EXPECT_CALL(transport, SendRtp(_, _, _)).WillOnce(testing::Return(true)); | 1078 EXPECT_CALL(transport, SendRtp(_, _, _)).WillOnce(testing::Return(true)); |
1074 SendPacket(capture_time_ms, kPayloadSizes[i]); | 1079 SendPacket(capture_time_ms, kPayloadSizes[i]); |
1075 rtp_sender_->TimeToSendPacket(seq_num++, capture_time_ms, false); | 1080 rtp_sender_->TimeToSendPacket(seq_num++, capture_time_ms, false, |
| 1081 PacketInfo::kNotAProbe); |
1076 fake_clock_.AdvanceTimeMilliseconds(33); | 1082 fake_clock_.AdvanceTimeMilliseconds(33); |
1077 } | 1083 } |
1078 | 1084 |
1079 EXPECT_CALL(mock_rtc_event_log_, | 1085 EXPECT_CALL(mock_rtc_event_log_, |
1080 LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _)) | 1086 LogRtpHeader(PacketDirection::kOutgoingPacket, _, _, _)) |
1081 .Times(::testing::AtLeast(4)); | 1087 .Times(::testing::AtLeast(4)); |
1082 | 1088 |
1083 // The amount of padding to send it too small to send a payload packet. | 1089 // The amount of padding to send it too small to send a payload packet. |
1084 EXPECT_CALL(transport, SendRtp(_, kMaxPaddingSize + rtp_header_len, _)) | 1090 EXPECT_CALL(transport, SendRtp(_, kMaxPaddingSize + rtp_header_len, _)) |
1085 .WillOnce(testing::Return(true)); | 1091 .WillOnce(testing::Return(true)); |
1086 EXPECT_EQ(kMaxPaddingSize, rtp_sender_->TimeToSendPadding(49)); | 1092 EXPECT_EQ(kMaxPaddingSize, |
| 1093 rtp_sender_->TimeToSendPadding(49, PacketInfo::kNotAProbe)); |
1087 | 1094 |
1088 EXPECT_CALL(transport, | 1095 EXPECT_CALL(transport, |
1089 SendRtp(_, kPayloadSizes[0] + rtp_header_len + kRtxHeaderSize, _)) | 1096 SendRtp(_, kPayloadSizes[0] + rtp_header_len + kRtxHeaderSize, _)) |
1090 .WillOnce(testing::Return(true)); | 1097 .WillOnce(testing::Return(true)); |
1091 EXPECT_EQ(kPayloadSizes[0], rtp_sender_->TimeToSendPadding(500)); | 1098 EXPECT_EQ(kPayloadSizes[0], |
| 1099 rtp_sender_->TimeToSendPadding(500, PacketInfo::kNotAProbe)); |
1092 | 1100 |
1093 EXPECT_CALL(transport, SendRtp(_, kPayloadSizes[kNumPayloadSizes - 1] + | 1101 EXPECT_CALL(transport, SendRtp(_, kPayloadSizes[kNumPayloadSizes - 1] + |
1094 rtp_header_len + kRtxHeaderSize, | 1102 rtp_header_len + kRtxHeaderSize, |
1095 _)) | 1103 _)) |
1096 .WillOnce(testing::Return(true)); | 1104 .WillOnce(testing::Return(true)); |
1097 EXPECT_CALL(transport, SendRtp(_, kMaxPaddingSize + rtp_header_len, _)) | 1105 EXPECT_CALL(transport, SendRtp(_, kMaxPaddingSize + rtp_header_len, _)) |
1098 .WillOnce(testing::Return(true)); | 1106 .WillOnce(testing::Return(true)); |
1099 EXPECT_EQ(kPayloadSizes[kNumPayloadSizes - 1] + kMaxPaddingSize, | 1107 EXPECT_EQ(kPayloadSizes[kNumPayloadSizes - 1] + kMaxPaddingSize, |
1100 rtp_sender_->TimeToSendPadding(999)); | 1108 rtp_sender_->TimeToSendPadding(999, PacketInfo::kNotAProbe)); |
1101 } | 1109 } |
1102 | 1110 |
1103 TEST_F(RtpSenderTestWithoutPacer, SendGenericVideo) { | 1111 TEST_F(RtpSenderTestWithoutPacer, SendGenericVideo) { |
1104 char payload_name[RTP_PAYLOAD_NAME_SIZE] = "GENERIC"; | 1112 char payload_name[RTP_PAYLOAD_NAME_SIZE] = "GENERIC"; |
1105 const uint8_t payload_type = 127; | 1113 const uint8_t payload_type = 127; |
1106 ASSERT_EQ(0, rtp_sender_->RegisterPayload(payload_name, payload_type, 90000, | 1114 ASSERT_EQ(0, rtp_sender_->RegisterPayload(payload_name, payload_type, 90000, |
1107 0, 1500)); | 1115 0, 1500)); |
1108 uint8_t payload[] = {47, 11, 32, 93, 89}; | 1116 uint8_t payload[] = {47, 11, 32, 93, 89}; |
1109 | 1117 |
1110 // Send keyframe | 1118 // Send keyframe |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 expected.transmitted.payload_bytes = 12; | 1361 expected.transmitted.payload_bytes = 12; |
1354 expected.transmitted.header_bytes = 24; | 1362 expected.transmitted.header_bytes = 24; |
1355 expected.transmitted.packets = 2; | 1363 expected.transmitted.packets = 2; |
1356 expected.retransmitted.payload_bytes = 6; | 1364 expected.retransmitted.payload_bytes = 6; |
1357 expected.retransmitted.header_bytes = 12; | 1365 expected.retransmitted.header_bytes = 12; |
1358 expected.retransmitted.padding_bytes = 0; | 1366 expected.retransmitted.padding_bytes = 0; |
1359 expected.retransmitted.packets = 1; | 1367 expected.retransmitted.packets = 1; |
1360 callback.Matches(ssrc, expected); | 1368 callback.Matches(ssrc, expected); |
1361 | 1369 |
1362 // Send padding. | 1370 // Send padding. |
1363 rtp_sender_->TimeToSendPadding(kMaxPaddingSize); | 1371 rtp_sender_->TimeToSendPadding(kMaxPaddingSize, PacketInfo::kNotAProbe); |
1364 expected.transmitted.payload_bytes = 12; | 1372 expected.transmitted.payload_bytes = 12; |
1365 expected.transmitted.header_bytes = 36; | 1373 expected.transmitted.header_bytes = 36; |
1366 expected.transmitted.padding_bytes = kMaxPaddingSize; | 1374 expected.transmitted.padding_bytes = kMaxPaddingSize; |
1367 expected.transmitted.packets = 3; | 1375 expected.transmitted.packets = 3; |
1368 callback.Matches(ssrc, expected); | 1376 callback.Matches(ssrc, expected); |
1369 | 1377 |
1370 // Send FEC. | 1378 // Send FEC. |
1371 rtp_sender_->SetGenericFECStatus(true, kRedPayloadType, kUlpfecPayloadType); | 1379 rtp_sender_->SetGenericFECStatus(true, kRedPayloadType, kUlpfecPayloadType); |
1372 FecProtectionParams fec_params; | 1380 FecProtectionParams fec_params; |
1373 fec_params.fec_mask_type = kFecMaskRandom; | 1381 fec_params.fec_mask_type = kFecMaskRandom; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 | 1518 |
1511 ASSERT_EQ(0, rtp_sender_->RegisterPayload(kPayloadName, kPayloadType, 90000, | 1519 ASSERT_EQ(0, rtp_sender_->RegisterPayload(kPayloadName, kPayloadType, 90000, |
1512 0, 1500)); | 1520 0, 1500)); |
1513 uint8_t payload[] = {47, 11, 32, 93, 89}; | 1521 uint8_t payload[] = {47, 11, 32, 93, 89}; |
1514 | 1522 |
1515 ASSERT_EQ( | 1523 ASSERT_EQ( |
1516 0, rtp_sender_->SendOutgoingData(kVideoFrameKey, kPayloadType, 1234, 4321, | 1524 0, rtp_sender_->SendOutgoingData(kVideoFrameKey, kPayloadType, 1234, 4321, |
1517 payload, sizeof(payload), 0)); | 1525 payload, sizeof(payload), 0)); |
1518 | 1526 |
1519 // Will send 2 full-size padding packets. | 1527 // Will send 2 full-size padding packets. |
1520 rtp_sender_->TimeToSendPadding(1); | 1528 rtp_sender_->TimeToSendPadding(1, PacketInfo::kNotAProbe); |
1521 rtp_sender_->TimeToSendPadding(1); | 1529 rtp_sender_->TimeToSendPadding(1, PacketInfo::kNotAProbe); |
1522 | 1530 |
1523 StreamDataCounters rtp_stats; | 1531 StreamDataCounters rtp_stats; |
1524 StreamDataCounters rtx_stats; | 1532 StreamDataCounters rtx_stats; |
1525 rtp_sender_->GetDataCounters(&rtp_stats, &rtx_stats); | 1533 rtp_sender_->GetDataCounters(&rtp_stats, &rtx_stats); |
1526 | 1534 |
1527 // Payload + 1-byte generic header. | 1535 // Payload + 1-byte generic header. |
1528 EXPECT_GT(rtp_stats.first_packet_time_ms, -1); | 1536 EXPECT_GT(rtp_stats.first_packet_time_ms, -1); |
1529 EXPECT_EQ(rtp_stats.transmitted.payload_bytes, sizeof(payload) + 1); | 1537 EXPECT_EQ(rtp_stats.transmitted.payload_bytes, sizeof(payload) + 1); |
1530 EXPECT_EQ(rtp_stats.transmitted.header_bytes, 12u); | 1538 EXPECT_EQ(rtp_stats.transmitted.header_bytes, 12u); |
1531 EXPECT_EQ(rtp_stats.transmitted.padding_bytes, 0u); | 1539 EXPECT_EQ(rtp_stats.transmitted.padding_bytes, 0u); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), | 1609 reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()), |
1602 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); | 1610 transport_.sent_packets_[0]->size(), true, &map, kSeqNum, hdr.rotation); |
1603 | 1611 |
1604 // Verify that this packet does have CVO byte. | 1612 // Verify that this packet does have CVO byte. |
1605 VerifyCVOPacket( | 1613 VerifyCVOPacket( |
1606 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), | 1614 reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()), |
1607 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, | 1615 transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1, |
1608 hdr.rotation); | 1616 hdr.rotation); |
1609 } | 1617 } |
1610 } // namespace webrtc | 1618 } // namespace webrtc |
OLD | NEW |