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