Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/nack_rtx_unittest.cc

Issue 1427653007: Remove packet initializer in RtpRtcpRtxNackTest. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: potential fix (but wtf) Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 bool SendRtp(const uint8_t* data, 99 bool SendRtp(const uint8_t* data,
100 size_t len, 100 size_t len,
101 const PacketOptions& options) override { 101 const PacketOptions& options) override {
102 count_++; 102 count_++;
103 const unsigned char* ptr = static_cast<const unsigned char*>(data); 103 const unsigned char* ptr = static_cast<const unsigned char*>(data);
104 uint32_t ssrc = (ptr[8] << 24) + (ptr[9] << 16) + (ptr[10] << 8) + ptr[11]; 104 uint32_t ssrc = (ptr[8] << 24) + (ptr[9] << 16) + (ptr[10] << 8) + ptr[11];
105 if (ssrc == rtx_ssrc_) count_rtx_ssrc_++; 105 if (ssrc == rtx_ssrc_) count_rtx_ssrc_++;
106 uint16_t sequence_number = (ptr[2] << 8) + ptr[3]; 106 uint16_t sequence_number = (ptr[2] << 8) + ptr[3];
107 size_t packet_length = len; 107 size_t packet_length = len;
108 // TODO(pbos): Figure out why this needs to be initialized. Likely this 108 uint8_t restored_packet[1500];
109 // is hiding a bug either in test setup or other code.
110 // https://code.google.com/p/webrtc/issues/detail?id=3183
111 uint8_t restored_packet[1500] = {0};
112 RTPHeader header; 109 RTPHeader header;
113 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); 110 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
114 if (!parser->Parse(ptr, len, &header)) { 111 if (!parser->Parse(ptr, len, &header)) {
115 return false; 112 return false;
116 } 113 }
117 114
118 if (!rtp_payload_registry_->IsRtx(header)) { 115 if (!rtp_payload_registry_->IsRtx(header)) {
119 // Don't store retransmitted packets since we compare it to the list 116 // Don't store retransmitted packets since we compare it to the list
120 // created by the receiver. 117 // created by the receiver.
121 expected_sequence_numbers_.insert(expected_sequence_numbers_.end(), 118 expected_sequence_numbers_.insert(expected_sequence_numbers_.end(),
122 sequence_number); 119 sequence_number);
123 } 120 }
124 if (packet_loss_ > 0) { 121 if (packet_loss_ > 0) {
125 if ((count_ % packet_loss_) == 0) { 122 if ((count_ % packet_loss_) == 0) {
126 return true; 123 return true;
127 } 124 }
128 } else if (count_ >= consecutive_drop_start_ && 125 } else if (count_ >= consecutive_drop_start_ &&
129 count_ < consecutive_drop_end_) { 126 count_ < consecutive_drop_end_) {
130 return true; 127 return true;
131 } 128 }
132 if (rtp_payload_registry_->IsRtx(header)) { 129 if (rtp_payload_registry_->IsRtx(header)) {
133 // Remove the RTX header and parse the original RTP header. 130 // Remove the RTX header and parse the original RTP header.
134 EXPECT_TRUE(rtp_payload_registry_->RestoreOriginalPacket( 131 EXPECT_TRUE(rtp_payload_registry_->RestoreOriginalPacket(
135 restored_packet, ptr, &packet_length, rtp_receiver_->SSRC(), header)); 132 restored_packet, ptr, &packet_length, rtp_receiver_->SSRC(), header));
136 if (!parser->Parse(restored_packet, packet_length, &header)) { 133 if (!parser->Parse(restored_packet, packet_length, &header)) {
137 return false; 134 return false;
138 } 135 }
136 ptr = restored_packet;
139 } else { 137 } else {
140 rtp_payload_registry_->SetIncomingPayloadType(header); 138 rtp_payload_registry_->SetIncomingPayloadType(header);
141 } 139 }
142 140
143 const uint8_t* restored_packet_payload =
144 restored_packet + header.headerLength;
145 packet_length -= header.headerLength;
146 PayloadUnion payload_specific; 141 PayloadUnion payload_specific;
147 if (!rtp_payload_registry_->GetPayloadSpecifics(header.payloadType, 142 if (!rtp_payload_registry_->GetPayloadSpecifics(header.payloadType,
148 &payload_specific)) { 143 &payload_specific)) {
149 return false; 144 return false;
150 } 145 }
151 if (!rtp_receiver_->IncomingRtpPacket(header, restored_packet_payload, 146 if (!rtp_receiver_->IncomingRtpPacket(header, ptr + header.headerLength,
152 packet_length, payload_specific, 147 packet_length - header.headerLength,
153 true)) { 148 payload_specific, true)) {
154 return false; 149 return false;
155 } 150 }
156 return true; 151 return true;
157 } 152 }
158 153
159 bool SendRtcp(const uint8_t* data, size_t len) override { 154 bool SendRtcp(const uint8_t* data, size_t len) override {
160 return module_->IncomingRtcpPacket((const uint8_t*)data, len) == 0; 155 return module_->IncomingRtcpPacket((const uint8_t*)data, len) == 0;
161 } 156 }
162 int count_; 157 int count_;
163 int packet_loss_; 158 int packet_loss_;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 338
344 TEST_F(RtpRtcpRtxNackTest, RtxNack) { 339 TEST_F(RtpRtcpRtxNackTest, RtxNack) {
345 RunRtxTest(kRtxRetransmitted, 10); 340 RunRtxTest(kRtxRetransmitted, 10);
346 EXPECT_EQ(kTestSequenceNumber, *(receiver_.sequence_numbers_.begin())); 341 EXPECT_EQ(kTestSequenceNumber, *(receiver_.sequence_numbers_.begin()));
347 EXPECT_EQ(kTestSequenceNumber + kTestNumberOfPackets - 1, 342 EXPECT_EQ(kTestSequenceNumber + kTestNumberOfPackets - 1,
348 *(receiver_.sequence_numbers_.rbegin())); 343 *(receiver_.sequence_numbers_.rbegin()));
349 EXPECT_EQ(kTestNumberOfPackets, receiver_.sequence_numbers_.size()); 344 EXPECT_EQ(kTestNumberOfPackets, receiver_.sequence_numbers_.size());
350 EXPECT_EQ(kTestNumberOfRtxPackets, transport_.count_rtx_ssrc_); 345 EXPECT_EQ(kTestNumberOfRtxPackets, transport_.count_rtx_ssrc_);
351 EXPECT_TRUE(ExpectedPacketsReceived()); 346 EXPECT_TRUE(ExpectedPacketsReceived());
352 } 347 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698