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

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

Issue 2553863003: Parse FlexFEC RTP headers in Call and add integration with BWE. (Closed)
Patch Set: Rebase and changes, including adressing danilchap's early comments. Created 4 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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
11 #include <algorithm> 11 #include <algorithm>
12 #include <memory> 12 #include <memory>
13 13
14 #include "webrtc/base/basictypes.h" 14 #include "webrtc/base/basictypes.h"
15 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra te_estimator.h"
15 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h" 16 #include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h"
16 #include "webrtc/modules/rtp_rtcp/mocks/mock_recovered_packet_receiver.h" 17 #include "webrtc/modules/rtp_rtcp/mocks/mock_recovered_packet_receiver.h"
17 #include "webrtc/modules/rtp_rtcp/source/fec_test_helper.h" 18 #include "webrtc/modules/rtp_rtcp/source/fec_test_helper.h"
18 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" 19 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h"
20 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h"
21 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h"
22 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
19 #include "webrtc/test/gmock.h" 23 #include "webrtc/test/gmock.h"
20 #include "webrtc/test/gtest.h" 24 #include "webrtc/test/gtest.h"
21 25
22 namespace webrtc { 26 namespace webrtc {
23 27
24 namespace { 28 namespace {
25 29
26 using ::testing::_; 30 using ::testing::_;
27 using ::testing::Args; 31 using ::testing::Args;
28 using ::testing::ElementsAreArray; 32 using ::testing::ElementsAreArray;
29 using ::testing::Return; 33 using ::testing::Return;
34 using ::testing::SaveArg;
30 35
31 using test::fec::FlexfecPacketGenerator; 36 using test::fec::FlexfecPacketGenerator;
32 using Packet = ForwardErrorCorrection::Packet; 37 using Packet = ForwardErrorCorrection::Packet;
33 using PacketList = ForwardErrorCorrection::PacketList; 38 using PacketList = ForwardErrorCorrection::PacketList;
34 39
35 constexpr size_t kPayloadLength = 500; 40 constexpr size_t kPayloadLength = 500;
36 constexpr uint32_t kFlexfecSsrc = 42984; 41 constexpr uint32_t kFlexfecSsrc = 42984;
37 constexpr uint32_t kMediaSsrc = 8353; 42 constexpr uint32_t kMediaSsrc = 8353;
38 43
44 template <typename T>
45 RtpPacketReceived ParsePacket(const std::unique_ptr<T>& packet) {
danilchap 2016/12/13 14:11:24 probably better to use const reference to object t
brandtr 2016/12/14 12:55:49 Done. Could remove the templatization then too :)
46 RtpPacketReceived parsed_packet(nullptr);
47 RTC_DCHECK(parsed_packet.Parse(packet->data, packet->length));
48 return parsed_packet;
49 }
50
39 } // namespace 51 } // namespace
40 52
41 class FlexfecReceiverTest : public ::testing::Test { 53 class FlexfecReceiverTest : public ::testing::Test {
42 protected: 54 protected:
43 FlexfecReceiverTest() 55 FlexfecReceiverTest()
44 : receiver_(kFlexfecSsrc, kMediaSsrc, &recovered_packet_receiver_), 56 : receiver_(kFlexfecSsrc,
57 kMediaSsrc,
58 &recovered_packet_receiver_,
59 &remote_bitrate_estimator_),
45 erasure_code_(ForwardErrorCorrection::CreateFlexfec()), 60 erasure_code_(ForwardErrorCorrection::CreateFlexfec()),
46 packet_generator_(kMediaSsrc, kFlexfecSsrc) {} 61 packet_generator_(kMediaSsrc, kFlexfecSsrc) {}
47 62
48 // Generates |num_media_packets| corresponding to a single frame. 63 // Generates |num_media_packets| corresponding to a single frame.
49 void PacketizeFrame(size_t num_media_packets, 64 void PacketizeFrame(size_t num_media_packets,
50 size_t frame_offset, 65 size_t frame_offset,
51 PacketList* media_packets); 66 PacketList* media_packets);
52 67
53 // Generates |num_fec_packets| FEC packets, given |media_packets|. 68 // Generates |num_fec_packets| FEC packets, given |media_packets|.
54 std::list<Packet*> EncodeFec(const PacketList& media_packets, 69 std::list<Packet*> EncodeFec(const PacketList& media_packets,
55 size_t num_fec_packets); 70 size_t num_fec_packets);
56 71
57 FlexfecReceiver receiver_; 72 FlexfecReceiver receiver_;
58 std::unique_ptr<ForwardErrorCorrection> erasure_code_; 73 std::unique_ptr<ForwardErrorCorrection> erasure_code_;
59 74
60 FlexfecPacketGenerator packet_generator_; 75 FlexfecPacketGenerator packet_generator_;
61 testing::StrictMock<MockRecoveredPacketReceiver> recovered_packet_receiver_; 76 testing::StrictMock<MockRecoveredPacketReceiver> recovered_packet_receiver_;
77 MockRemoteBitrateEstimator remote_bitrate_estimator_;
62 }; 78 };
63 79
64 void FlexfecReceiverTest::PacketizeFrame(size_t num_media_packets, 80 void FlexfecReceiverTest::PacketizeFrame(size_t num_media_packets,
65 size_t frame_offset, 81 size_t frame_offset,
66 PacketList* media_packets) { 82 PacketList* media_packets) {
67 packet_generator_.NewFrame(num_media_packets); 83 packet_generator_.NewFrame(num_media_packets);
68 for (size_t i = 0; i < num_media_packets; ++i) { 84 for (size_t i = 0; i < num_media_packets; ++i) {
69 std::unique_ptr<Packet> next_packet( 85 std::unique_ptr<Packet> next_packet(
70 packet_generator_.NextPacket(frame_offset + i, kPayloadLength)); 86 packet_generator_.NextPacket(frame_offset + i, kPayloadLength));
71 media_packets->push_back(std::move(next_packet)); 87 media_packets->push_back(std::move(next_packet));
(...skipping 14 matching lines...) Expand all
86 kUseUnequalProtection, kFecMaskType, &fec_packets)); 102 kUseUnequalProtection, kFecMaskType, &fec_packets));
87 EXPECT_EQ(num_fec_packets, fec_packets.size()); 103 EXPECT_EQ(num_fec_packets, fec_packets.size());
88 return fec_packets; 104 return fec_packets;
89 } 105 }
90 106
91 TEST_F(FlexfecReceiverTest, ReceivesMediaPacket) { 107 TEST_F(FlexfecReceiverTest, ReceivesMediaPacket) {
92 packet_generator_.NewFrame(1); 108 packet_generator_.NewFrame(1);
93 std::unique_ptr<Packet> media_packet( 109 std::unique_ptr<Packet> media_packet(
94 packet_generator_.NextPacket(0, kPayloadLength)); 110 packet_generator_.NextPacket(0, kPayloadLength));
95 111
96 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(media_packet->data, 112 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(ParsePacket(media_packet)));
97 media_packet->length));
98 }
99
100 TEST_F(FlexfecReceiverTest, FailsOnTruncatedMediaPacket) {
101 const size_t kNoPayload = 0;
102
103 packet_generator_.NewFrame(1);
104 std::unique_ptr<Packet> media_packet(
105 packet_generator_.NextPacket(0, kNoPayload));
106 // Simulate truncated media packet.
107 media_packet->length = kRtpHeaderSize - 1;
108
109 EXPECT_FALSE(receiver_.AddAndProcessReceivedPacket(media_packet->data,
110 media_packet->length));
111 } 113 }
112 114
113 TEST_F(FlexfecReceiverTest, ReceivesMediaAndFecPackets) { 115 TEST_F(FlexfecReceiverTest, ReceivesMediaAndFecPackets) {
114 const size_t kNumMediaPackets = 1; 116 const size_t kNumMediaPackets = 1;
115 const size_t kNumFecPackets = 1; 117 const size_t kNumFecPackets = 1;
116 118
117 PacketList media_packets; 119 PacketList media_packets;
118 PacketizeFrame(kNumMediaPackets, 0, &media_packets); 120 PacketizeFrame(kNumMediaPackets, 0, &media_packets);
119 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets); 121 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets);
120 auto media_packet = media_packets.front().get(); 122 const auto& media_packet = media_packets.front();
121 auto fec_packet = packet_generator_.BuildFlexfecPacket(*fec_packets.front()); 123 auto fec_packet = packet_generator_.BuildFlexfecPacket(*fec_packets.front());
122 124
123 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(media_packet->data, 125 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(ParsePacket(media_packet)));
124 media_packet->length)); 126 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(ParsePacket(fec_packet)));
125 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(fec_packet->data,
126 fec_packet->length));
127 } 127 }
128 128
129 TEST_F(FlexfecReceiverTest, FailsOnTruncatedFecPacket) { 129 TEST_F(FlexfecReceiverTest, FailsOnTruncatedFecPacket) {
130 const size_t kNumMediaPackets = 1; 130 const size_t kNumMediaPackets = 1;
131 const size_t kNumFecPackets = 1; 131 const size_t kNumFecPackets = 1;
132 132
133 PacketList media_packets; 133 PacketList media_packets;
134 PacketizeFrame(kNumMediaPackets, 0, &media_packets); 134 PacketizeFrame(kNumMediaPackets, 0, &media_packets);
135 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets); 135 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets);
136 auto media_packet = media_packets.front().get(); 136 const auto& media_packet = media_packets.front();
137 // Simulate truncated FlexFEC payload. 137 // Simulate truncated FlexFEC payload.
138 fec_packets.front()->length = 1; 138 fec_packets.front()->length = 1;
139 auto fec_packet = packet_generator_.BuildFlexfecPacket(*fec_packets.front()); 139 auto fec_packet = packet_generator_.BuildFlexfecPacket(*fec_packets.front());
140 140
141 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(media_packet->data, 141 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(ParsePacket(media_packet)));
142 media_packet->length)); 142 EXPECT_FALSE(receiver_.AddAndProcessReceivedPacket(ParsePacket(fec_packet)));
143 EXPECT_FALSE(receiver_.AddAndProcessReceivedPacket(fec_packet->data,
144 fec_packet->length));
145 } 143 }
146 144
147 TEST_F(FlexfecReceiverTest, FailsOnUnknownMediaSsrc) { 145 TEST_F(FlexfecReceiverTest, FailsOnUnknownMediaSsrc) {
148 const size_t kNumMediaPackets = 1; 146 const size_t kNumMediaPackets = 1;
149 147
150 PacketList media_packets; 148 PacketList media_packets;
151 PacketizeFrame(kNumMediaPackets, 0, &media_packets); 149 PacketizeFrame(kNumMediaPackets, 0, &media_packets);
152 auto media_packet = media_packets.front().get(); 150 auto& media_packet = media_packets.front();
153 // Corrupt the SSRC. 151 // Corrupt the SSRC.
154 media_packet->data[8] = 0; 152 media_packet->data[8] = 0;
155 media_packet->data[9] = 1; 153 media_packet->data[9] = 1;
156 media_packet->data[10] = 2; 154 media_packet->data[10] = 2;
157 media_packet->data[11] = 3; 155 media_packet->data[11] = 3;
158 156
159 EXPECT_FALSE(receiver_.AddAndProcessReceivedPacket(media_packet->data, 157 EXPECT_FALSE(
160 media_packet->length)); 158 receiver_.AddAndProcessReceivedPacket(ParsePacket(media_packet)));
161 } 159 }
162 160
163 TEST_F(FlexfecReceiverTest, FailsOnUnknownFecSsrc) { 161 TEST_F(FlexfecReceiverTest, FailsOnUnknownFecSsrc) {
164 const size_t kNumMediaPackets = 1; 162 const size_t kNumMediaPackets = 1;
165 const size_t kNumFecPackets = 1; 163 const size_t kNumFecPackets = 1;
166 164
167 PacketList media_packets; 165 PacketList media_packets;
168 PacketizeFrame(kNumMediaPackets, 0, &media_packets); 166 PacketizeFrame(kNumMediaPackets, 0, &media_packets);
169 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets); 167 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets);
170 auto media_packet = media_packets.front().get(); 168 const auto& media_packet = media_packets.front();
171 auto fec_packet = packet_generator_.BuildFlexfecPacket(*fec_packets.front()); 169 auto fec_packet = packet_generator_.BuildFlexfecPacket(*fec_packets.front());
172 // Corrupt the SSRC. 170 // Corrupt the SSRC.
173 fec_packet->data[8] = 4; 171 fec_packet->data[8] = 4;
174 fec_packet->data[9] = 5; 172 fec_packet->data[9] = 5;
175 fec_packet->data[10] = 6; 173 fec_packet->data[10] = 6;
176 fec_packet->data[11] = 7; 174 fec_packet->data[11] = 7;
177 175
178 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(media_packet->data, 176 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(ParsePacket(media_packet)));
179 media_packet->length)); 177 EXPECT_FALSE(receiver_.AddAndProcessReceivedPacket(ParsePacket(fec_packet)));
180 EXPECT_FALSE(receiver_.AddAndProcessReceivedPacket(fec_packet->data,
181 fec_packet->length));
182 } 178 }
183 179
184 TEST_F(FlexfecReceiverTest, ReceivesMultiplePackets) { 180 TEST_F(FlexfecReceiverTest, ReceivesMultiplePackets) {
185 const size_t kNumMediaPackets = 2; 181 const size_t kNumMediaPackets = 2;
186 const size_t kNumFecPackets = 1; 182 const size_t kNumFecPackets = 1;
187 183
188 PacketList media_packets; 184 PacketList media_packets;
189 PacketizeFrame(kNumMediaPackets, 0, &media_packets); 185 PacketizeFrame(kNumMediaPackets, 0, &media_packets);
190 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets); 186 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets);
191 187
192 // Receive all media packets. 188 // Receive all media packets.
193 for (const auto& media_packet : media_packets) { 189 for (const auto& media_packet : media_packets) {
194 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(media_packet->data, 190 EXPECT_TRUE(
195 media_packet->length)); 191 receiver_.AddAndProcessReceivedPacket(ParsePacket(media_packet)));
196 } 192 }
197 193
198 // Receive FEC packet. 194 // Receive FEC packet.
199 auto fec_packet = fec_packets.front(); 195 auto fec_packet = fec_packets.front();
200 std::unique_ptr<Packet> packet_with_rtp_header = 196 std::unique_ptr<Packet> packet_with_rtp_header =
201 packet_generator_.BuildFlexfecPacket(*fec_packet); 197 packet_generator_.BuildFlexfecPacket(*fec_packet);
202 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket( 198 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(
203 packet_with_rtp_header->data, packet_with_rtp_header->length)); 199 ParsePacket(packet_with_rtp_header)));
204 } 200 }
205 201
206 TEST_F(FlexfecReceiverTest, RecoversFromSingleMediaLoss) { 202 TEST_F(FlexfecReceiverTest, RecoversFromSingleMediaLoss) {
207 const size_t kNumMediaPackets = 2; 203 const size_t kNumMediaPackets = 2;
208 const size_t kNumFecPackets = 1; 204 const size_t kNumFecPackets = 1;
209 205
210 PacketList media_packets; 206 PacketList media_packets;
211 PacketizeFrame(kNumMediaPackets, 0, &media_packets); 207 PacketizeFrame(kNumMediaPackets, 0, &media_packets);
212 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets); 208 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets);
213 209
214 // Receive first media packet but drop second. 210 // Receive first media packet but drop second.
215 auto media_it = media_packets.begin(); 211 auto media_it = media_packets.begin();
216 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket((*media_it)->data, 212 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(ParsePacket(*media_it)));
217 (*media_it)->length));
218 213
219 // Receive FEC packet and ensure recovery of lost media packet. 214 // Receive FEC packet and ensure recovery of lost media packet.
220 auto fec_it = fec_packets.begin(); 215 auto fec_it = fec_packets.begin();
221 std::unique_ptr<Packet> packet_with_rtp_header = 216 std::unique_ptr<Packet> packet_with_rtp_header =
222 packet_generator_.BuildFlexfecPacket(**fec_it); 217 packet_generator_.BuildFlexfecPacket(**fec_it);
223 media_it++; 218 media_it++;
224 EXPECT_CALL(recovered_packet_receiver_, 219 EXPECT_CALL(recovered_packet_receiver_,
225 OnRecoveredPacket(_, (*media_it)->length)) 220 OnRecoveredPacket(_, (*media_it)->length))
226 .With( 221 .With(
227 Args<0, 1>(ElementsAreArray((*media_it)->data, (*media_it)->length))) 222 Args<0, 1>(ElementsAreArray((*media_it)->data, (*media_it)->length)))
228 .WillOnce(Return(true)); 223 .WillOnce(Return(true));
229 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket( 224 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(
230 packet_with_rtp_header->data, packet_with_rtp_header->length)); 225 ParsePacket(packet_with_rtp_header)));
231 } 226 }
232 227
233 TEST_F(FlexfecReceiverTest, RecoversFromDoubleMediaLoss) { 228 TEST_F(FlexfecReceiverTest, RecoversFromDoubleMediaLoss) {
234 const size_t kNumMediaPackets = 2; 229 const size_t kNumMediaPackets = 2;
235 const size_t kNumFecPackets = 2; 230 const size_t kNumFecPackets = 2;
236 231
237 PacketList media_packets; 232 PacketList media_packets;
238 PacketizeFrame(kNumMediaPackets, 0, &media_packets); 233 PacketizeFrame(kNumMediaPackets, 0, &media_packets);
239 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets); 234 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets);
240 235
241 // Drop both media packets. 236 // Drop both media packets.
242 237
243 // Receive first FEC packet and recover first lost media packet. 238 // Receive first FEC packet and recover first lost media packet.
244 auto fec_it = fec_packets.begin(); 239 auto fec_it = fec_packets.begin();
245 std::unique_ptr<Packet> packet_with_rtp_header = 240 std::unique_ptr<Packet> packet_with_rtp_header =
246 packet_generator_.BuildFlexfecPacket(**fec_it); 241 packet_generator_.BuildFlexfecPacket(**fec_it);
247 auto media_it = media_packets.begin(); 242 auto media_it = media_packets.begin();
248 EXPECT_CALL(recovered_packet_receiver_, 243 EXPECT_CALL(recovered_packet_receiver_,
249 OnRecoveredPacket(_, (*media_it)->length)) 244 OnRecoveredPacket(_, (*media_it)->length))
250 .With( 245 .With(
251 Args<0, 1>(ElementsAreArray((*media_it)->data, (*media_it)->length))) 246 Args<0, 1>(ElementsAreArray((*media_it)->data, (*media_it)->length)))
252 .WillOnce(Return(true)); 247 .WillOnce(Return(true));
253 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket( 248 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(
254 packet_with_rtp_header->data, packet_with_rtp_header->length)); 249 ParsePacket(packet_with_rtp_header)));
255 250
256 // Receive second FEC packet and recover second lost media packet. 251 // Receive second FEC packet and recover second lost media packet.
257 fec_it++; 252 fec_it++;
258 packet_with_rtp_header = packet_generator_.BuildFlexfecPacket(**fec_it); 253 packet_with_rtp_header = packet_generator_.BuildFlexfecPacket(**fec_it);
259 media_it++; 254 media_it++;
260 EXPECT_CALL(recovered_packet_receiver_, 255 EXPECT_CALL(recovered_packet_receiver_,
261 OnRecoveredPacket(_, (*media_it)->length)) 256 OnRecoveredPacket(_, (*media_it)->length))
262 .With( 257 .With(
263 Args<0, 1>(ElementsAreArray((*media_it)->data, (*media_it)->length))) 258 Args<0, 1>(ElementsAreArray((*media_it)->data, (*media_it)->length)))
264 .WillOnce(Return(true)); 259 .WillOnce(Return(true));
265 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket( 260 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(
266 packet_with_rtp_header->data, packet_with_rtp_header->length)); 261 ParsePacket(packet_with_rtp_header)));
267 } 262 }
268 263
269 TEST_F(FlexfecReceiverTest, DoesNotRecoverFromMediaAndFecLoss) { 264 TEST_F(FlexfecReceiverTest, DoesNotRecoverFromMediaAndFecLoss) {
270 const size_t kNumMediaPackets = 2; 265 const size_t kNumMediaPackets = 2;
271 const size_t kNumFecPackets = 1; 266 const size_t kNumFecPackets = 1;
272 267
273 PacketList media_packets; 268 PacketList media_packets;
274 PacketizeFrame(kNumMediaPackets, 0, &media_packets); 269 PacketizeFrame(kNumMediaPackets, 0, &media_packets);
275 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets); 270 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets);
276 271
277 // Receive first media packet. 272 // Receive first media packet.
278 auto media_it = media_packets.begin(); 273 auto media_it = media_packets.begin();
279 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket((*media_it)->data, 274 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(ParsePacket(*media_it)));
280 (*media_it)->length));
281 275
282 // Drop second media packet and FEC packet. Do not expect call back. 276 // Drop second media packet and FEC packet. Do not expect call back.
283 } 277 }
284 278
285 TEST_F(FlexfecReceiverTest, DoesNotCallbackTwice) { 279 TEST_F(FlexfecReceiverTest, DoesNotCallbackTwice) {
286 const size_t kNumMediaPackets = 2; 280 const size_t kNumMediaPackets = 2;
287 const size_t kNumFecPackets = 1; 281 const size_t kNumFecPackets = 1;
288 282
289 PacketList media_packets; 283 PacketList media_packets;
290 PacketizeFrame(kNumMediaPackets, 0, &media_packets); 284 PacketizeFrame(kNumMediaPackets, 0, &media_packets);
291 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets); 285 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets);
292 286
293 // Receive first media packet but drop second. 287 // Receive first media packet but drop second.
294 auto media_it = media_packets.begin(); 288 auto media_it = media_packets.begin();
295 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket((*media_it)->data, 289 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(ParsePacket(*media_it)));
296 (*media_it)->length));
297 290
298 // Receive FEC packet and ensure recovery of lost media packet. 291 // Receive FEC packet and ensure recovery of lost media packet.
299 auto fec_it = fec_packets.begin(); 292 auto fec_it = fec_packets.begin();
300 std::unique_ptr<Packet> packet_with_rtp_header = 293 std::unique_ptr<Packet> packet_with_rtp_header =
301 packet_generator_.BuildFlexfecPacket(**fec_it); 294 packet_generator_.BuildFlexfecPacket(**fec_it);
302 media_it++; 295 media_it++;
303 EXPECT_CALL(recovered_packet_receiver_, 296 EXPECT_CALL(recovered_packet_receiver_,
304 OnRecoveredPacket(_, (*media_it)->length)) 297 OnRecoveredPacket(_, (*media_it)->length))
305 .With( 298 .With(
306 Args<0, 1>(ElementsAreArray((*media_it)->data, (*media_it)->length))) 299 Args<0, 1>(ElementsAreArray((*media_it)->data, (*media_it)->length)))
307 .WillOnce(Return(true)); 300 .WillOnce(Return(true));
308 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket( 301 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(
309 packet_with_rtp_header->data, packet_with_rtp_header->length)); 302 ParsePacket(packet_with_rtp_header)));
310 303
311 // Receive FEC packet again. 304 // Receive FEC packet again.
312 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket( 305 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(
313 packet_with_rtp_header->data, packet_with_rtp_header->length)); 306 ParsePacket(packet_with_rtp_header)));
314 307
315 // Do not call back again. 308 // Do not call back again.
316 } 309 }
317 310
318 // Here we are implicitly assuming packet masks that are suitable for 311 // Here we are implicitly assuming packet masks that are suitable for
319 // this type of 50% correlated loss. If we are changing our precomputed 312 // this type of 50% correlated loss. If we are changing our precomputed
320 // packet masks, this test might need to be updated. 313 // packet masks, this test might need to be updated.
321 TEST_F(FlexfecReceiverTest, RecoversFrom50PercentLoss) { 314 TEST_F(FlexfecReceiverTest, RecoversFrom50PercentLoss) {
322 const size_t kNumFecPackets = 5; 315 const size_t kNumFecPackets = 5;
323 const size_t kNumFrames = 2 * kNumFecPackets; 316 const size_t kNumFrames = 2 * kNumFecPackets;
324 const size_t kNumMediaPacketsPerFrame = 1; 317 const size_t kNumMediaPacketsPerFrame = 1;
325 318
326 PacketList media_packets; 319 PacketList media_packets;
327 for (size_t i = 0; i < kNumFrames; ++i) { 320 for (size_t i = 0; i < kNumFrames; ++i) {
328 PacketizeFrame(kNumMediaPacketsPerFrame, i, &media_packets); 321 PacketizeFrame(kNumMediaPacketsPerFrame, i, &media_packets);
329 } 322 }
330 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets); 323 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets);
331 324
332 // Drop every second media packet. 325 // Drop every second media packet.
333 auto media_it = media_packets.begin(); 326 auto media_it = media_packets.begin();
334 while (media_it != media_packets.end()) { 327 while (media_it != media_packets.end()) {
335 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket((*media_it)->data, 328 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(ParsePacket(*media_it)));
336 (*media_it)->length));
337 ++media_it; 329 ++media_it;
338 if (media_it == media_packets.end()) { 330 if (media_it == media_packets.end()) {
339 break; 331 break;
340 } 332 }
341 ++media_it; 333 ++media_it;
342 } 334 }
343 335
344 // Receive all FEC packets. 336 // Receive all FEC packets.
345 media_it = media_packets.begin(); 337 media_it = media_packets.begin();
346 for (const auto& fec_packet : fec_packets) { 338 for (const auto& fec_packet : fec_packets) {
347 std::unique_ptr<Packet> fec_packet_with_rtp_header = 339 std::unique_ptr<Packet> fec_packet_with_rtp_header =
348 packet_generator_.BuildFlexfecPacket(*fec_packet); 340 packet_generator_.BuildFlexfecPacket(*fec_packet);
349 ++media_it; 341 ++media_it;
350 if (media_it == media_packets.end()) { 342 if (media_it == media_packets.end()) {
351 break; 343 break;
352 } 344 }
353 EXPECT_CALL(recovered_packet_receiver_, 345 EXPECT_CALL(recovered_packet_receiver_,
354 OnRecoveredPacket(_, (*media_it)->length)) 346 OnRecoveredPacket(_, (*media_it)->length))
355 .With(Args<0, 1>( 347 .With(Args<0, 1>(
356 ElementsAreArray((*media_it)->data, (*media_it)->length))) 348 ElementsAreArray((*media_it)->data, (*media_it)->length)))
357 .WillOnce(Return(true)); 349 .WillOnce(Return(true));
358 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket( 350 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(
359 fec_packet_with_rtp_header->data, fec_packet_with_rtp_header->length)); 351 ParsePacket(fec_packet_with_rtp_header)));
360 ++media_it; 352 ++media_it;
361 } 353 }
362 } 354 }
363 355
364 TEST_F(FlexfecReceiverTest, DelayedFecPacketDoesHelp) { 356 TEST_F(FlexfecReceiverTest, DelayedFecPacketDoesHelp) {
365 // These values need to be updated if the underlying erasure code 357 // These values need to be updated if the underlying erasure code
366 // implementation changes. 358 // implementation changes.
367 const size_t kNumFrames = 48; 359 const size_t kNumFrames = 48;
368 const size_t kNumMediaPacketsPerFrame = 1; 360 const size_t kNumMediaPacketsPerFrame = 1;
369 const size_t kNumFecPackets = 1; 361 const size_t kNumFecPackets = 1;
370 362
371 PacketList media_packets; 363 PacketList media_packets;
372 PacketizeFrame(kNumMediaPacketsPerFrame, 0, &media_packets); 364 PacketizeFrame(kNumMediaPacketsPerFrame, 0, &media_packets);
373 PacketizeFrame(kNumMediaPacketsPerFrame, 1, &media_packets); 365 PacketizeFrame(kNumMediaPacketsPerFrame, 1, &media_packets);
374 // Protect two first frames. 366 // Protect two first frames.
375 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets); 367 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets);
376 for (size_t i = 2; i < kNumFrames; ++i) { 368 for (size_t i = 2; i < kNumFrames; ++i) {
377 PacketizeFrame(kNumMediaPacketsPerFrame, i, &media_packets); 369 PacketizeFrame(kNumMediaPacketsPerFrame, i, &media_packets);
378 } 370 }
379 371
380 // Drop first media packet and delay FEC packet. 372 // Drop first media packet and delay FEC packet.
381 auto media_it = media_packets.begin(); 373 auto media_it = media_packets.begin();
382 ++media_it; 374 ++media_it;
383 375
384 // Receive all other media packets. 376 // Receive all other media packets.
385 while (media_it != media_packets.end()) { 377 while (media_it != media_packets.end()) {
386 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket((*media_it)->data, 378 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(ParsePacket(*media_it)));
387 (*media_it)->length));
388 ++media_it; 379 ++media_it;
389 } 380 }
390 381
391 // Receive FEC packet and recover first media packet. 382 // Receive FEC packet and recover first media packet.
392 auto fec_it = fec_packets.begin(); 383 auto fec_it = fec_packets.begin();
393 std::unique_ptr<Packet> packet_with_rtp_header = 384 std::unique_ptr<Packet> packet_with_rtp_header =
394 packet_generator_.BuildFlexfecPacket(**fec_it); 385 packet_generator_.BuildFlexfecPacket(**fec_it);
395 media_it = media_packets.begin(); 386 media_it = media_packets.begin();
396 EXPECT_CALL(recovered_packet_receiver_, 387 EXPECT_CALL(recovered_packet_receiver_,
397 OnRecoveredPacket(_, (*media_it)->length)) 388 OnRecoveredPacket(_, (*media_it)->length))
398 .With( 389 .With(
399 Args<0, 1>(ElementsAreArray((*media_it)->data, (*media_it)->length))) 390 Args<0, 1>(ElementsAreArray((*media_it)->data, (*media_it)->length)))
400 .WillOnce(Return(true)); 391 .WillOnce(Return(true));
401 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket( 392 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(
402 packet_with_rtp_header->data, packet_with_rtp_header->length)); 393 ParsePacket(packet_with_rtp_header)));
403 } 394 }
404 395
405 TEST_F(FlexfecReceiverTest, TooDelayedFecPacketDoesNotHelp) { 396 TEST_F(FlexfecReceiverTest, TooDelayedFecPacketDoesNotHelp) {
406 // These values need to be updated if the underlying erasure code 397 // These values need to be updated if the underlying erasure code
407 // implementation changes. 398 // implementation changes.
408 const size_t kNumFrames = 49; 399 const size_t kNumFrames = 49;
409 const size_t kNumMediaPacketsPerFrame = 1; 400 const size_t kNumMediaPacketsPerFrame = 1;
410 const size_t kNumFecPackets = 1; 401 const size_t kNumFecPackets = 1;
411 402
412 PacketList media_packets; 403 PacketList media_packets;
413 PacketizeFrame(kNumMediaPacketsPerFrame, 0, &media_packets); 404 PacketizeFrame(kNumMediaPacketsPerFrame, 0, &media_packets);
414 PacketizeFrame(kNumMediaPacketsPerFrame, 1, &media_packets); 405 PacketizeFrame(kNumMediaPacketsPerFrame, 1, &media_packets);
415 // Protect two first frames. 406 // Protect two first frames.
416 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets); 407 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets);
417 for (size_t i = 2; i < kNumFrames; ++i) { 408 for (size_t i = 2; i < kNumFrames; ++i) {
418 PacketizeFrame(kNumMediaPacketsPerFrame, i, &media_packets); 409 PacketizeFrame(kNumMediaPacketsPerFrame, i, &media_packets);
419 } 410 }
420 411
421 // Drop first media packet and delay FEC packet. 412 // Drop first media packet and delay FEC packet.
422 auto media_it = media_packets.begin(); 413 auto media_it = media_packets.begin();
423 ++media_it; 414 ++media_it;
424 415
425 // Receive all other media packets. 416 // Receive all other media packets.
426 while (media_it != media_packets.end()) { 417 while (media_it != media_packets.end()) {
427 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket((*media_it)->data, 418 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(ParsePacket(*media_it)));
428 (*media_it)->length));
429 ++media_it; 419 ++media_it;
430 } 420 }
431 421
432 // Receive FEC packet. 422 // Receive FEC packet.
433 auto fec_it = fec_packets.begin(); 423 auto fec_it = fec_packets.begin();
434 std::unique_ptr<Packet> packet_with_rtp_header = 424 std::unique_ptr<Packet> packet_with_rtp_header =
435 packet_generator_.BuildFlexfecPacket(**fec_it); 425 packet_generator_.BuildFlexfecPacket(**fec_it);
436 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket( 426 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(
437 packet_with_rtp_header->data, packet_with_rtp_header->length)); 427 ParsePacket(packet_with_rtp_header)));
438 428
439 // Do not expect a call back. 429 // Do not expect a call back.
440 } 430 }
441 431
442 TEST_F(FlexfecReceiverTest, RecoversWithMediaPacketsOutOfOrder) { 432 TEST_F(FlexfecReceiverTest, RecoversWithMediaPacketsOutOfOrder) {
443 const size_t kNumMediaPackets = 6; 433 const size_t kNumMediaPackets = 6;
444 const size_t kNumFecPackets = 2; 434 const size_t kNumFecPackets = 2;
445 435
446 PacketList media_packets; 436 PacketList media_packets;
447 PacketizeFrame(kNumMediaPackets, 0, &media_packets); 437 PacketizeFrame(kNumMediaPackets, 0, &media_packets);
448 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets); 438 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets);
449 439
450 // Lose two media packets, and receive the others out of order. 440 // Lose two media packets, and receive the others out of order.
451 auto media_it = media_packets.begin(); 441 auto media_it = media_packets.begin();
452 auto media_packet0 = media_it++; 442 auto media_packet0 = media_it++;
453 auto media_packet1 = media_it++; 443 auto media_packet1 = media_it++;
454 auto media_packet2 = media_it++; 444 auto media_packet2 = media_it++;
455 auto media_packet3 = media_it++; 445 auto media_packet3 = media_it++;
456 auto media_packet4 = media_it++; 446 auto media_packet4 = media_it++;
457 auto media_packet5 = media_it++; 447 auto media_packet5 = media_it++;
458 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket((*media_packet5)->data, 448 EXPECT_TRUE(
459 (*media_packet5)->length)); 449 receiver_.AddAndProcessReceivedPacket(ParsePacket(*media_packet5)));
460 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket((*media_packet2)->data, 450 EXPECT_TRUE(
461 (*media_packet2)->length)); 451 receiver_.AddAndProcessReceivedPacket(ParsePacket(*media_packet2)));
462 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket((*media_packet3)->data, 452 EXPECT_TRUE(
463 (*media_packet3)->length)); 453 receiver_.AddAndProcessReceivedPacket(ParsePacket(*media_packet3)));
464 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket((*media_packet0)->data, 454 EXPECT_TRUE(
465 (*media_packet0)->length)); 455 receiver_.AddAndProcessReceivedPacket(ParsePacket(*media_packet0)));
466 456
467 // Expect to recover lost media packets. 457 // Expect to recover lost media packets.
468 EXPECT_CALL(recovered_packet_receiver_, 458 EXPECT_CALL(recovered_packet_receiver_,
469 OnRecoveredPacket(_, (*media_packet1)->length)) 459 OnRecoveredPacket(_, (*media_packet1)->length))
470 .With(Args<0, 1>( 460 .With(Args<0, 1>(
471 ElementsAreArray((*media_packet1)->data, (*media_packet1)->length))) 461 ElementsAreArray((*media_packet1)->data, (*media_packet1)->length)))
472 .WillOnce(Return(true)); 462 .WillOnce(Return(true));
473 EXPECT_CALL(recovered_packet_receiver_, 463 EXPECT_CALL(recovered_packet_receiver_,
474 OnRecoveredPacket(_, (*media_packet4)->length)) 464 OnRecoveredPacket(_, (*media_packet4)->length))
475 .With(Args<0, 1>( 465 .With(Args<0, 1>(
476 ElementsAreArray((*media_packet4)->data, (*media_packet4)->length))) 466 ElementsAreArray((*media_packet4)->data, (*media_packet4)->length)))
477 .WillOnce(Return(true)); 467 .WillOnce(Return(true));
478 468
479 // Add FEC packets. 469 // Add FEC packets.
480 auto fec_it = fec_packets.begin(); 470 auto fec_it = fec_packets.begin();
481 std::unique_ptr<Packet> packet_with_rtp_header; 471 std::unique_ptr<Packet> packet_with_rtp_header;
482 while (fec_it != fec_packets.end()) { 472 while (fec_it != fec_packets.end()) {
483 packet_with_rtp_header = packet_generator_.BuildFlexfecPacket(**fec_it); 473 packet_with_rtp_header = packet_generator_.BuildFlexfecPacket(**fec_it);
484 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket( 474 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(
485 packet_with_rtp_header->data, packet_with_rtp_header->length)); 475 ParsePacket(packet_with_rtp_header)));
486 ++fec_it; 476 ++fec_it;
487 } 477 }
488 } 478 }
489 479
480 TEST_F(FlexfecReceiverTest,
481 NotifiesBweOfReceivedFecPacketWithTransportSequenceNumberExtension) {
482 // Set up receiver.
483 testing::StrictMock<MockRecoveredPacketReceiver> recovered_packet_receiver;
484 testing::StrictMock<MockRemoteBitrateEstimator> remote_bitrate_estimator;
485 FlexfecReceiver receiver(kFlexfecSsrc, kMediaSsrc, &recovered_packet_receiver,
486 &remote_bitrate_estimator);
487
488 // Set up RTP header extensions.
489 RtpHeaderExtensionMap rtp_header_extension_map;
490 rtp_header_extension_map.Register<TransportSequenceNumber>(7);
491
492 // Generate media and FEC payloads.
493 const size_t kNumMediaPackets = 1;
494 const size_t kNumFecPackets = 1;
495 PacketList media_packets;
496 PacketizeFrame(kNumMediaPackets, 0, &media_packets);
497 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets);
498
499 // Add transport-wide sequence numbers to packets.
500 ASSERT_EQ(1u, media_packets.size());
501 auto media_packet_raw = media_packets.front().get();
danilchap 2016/12/13 14:11:24 may be use "auto*" to stress it is a raw pointer
502 RtpPacketReceived media_packet;
503 media_packet.Parse(media_packet_raw->data, media_packet_raw->length);
danilchap 2016/12/13 14:11:24 may be RtpPacketReceived media_packet = ParsePacke
504 RtpPacketReceived media_packet_ext(&rtp_header_extension_map);
505 media_packet_ext.CopyHeaderFrom(media_packet);
506 media_packet_ext.SetExtension<TransportSequenceNumber>(1);
507 auto payload = media_packet.payload();
508 uint8_t* ext_payload = media_packet_ext.AllocatePayload(payload.size());
509 memcpy(ext_payload, payload.data(), payload.size());
510
511 ASSERT_EQ(1u, fec_packets.size());
512 auto fec_packet_raw =
513 packet_generator_.BuildFlexfecPacket(*fec_packets.front());
514 RtpPacketReceived fec_packet;
danilchap 2016/12/13 14:11:24 ditto
515 fec_packet.Parse(fec_packet_raw->data, fec_packet_raw->length);
516 RtpPacketReceived fec_packet_ext(&rtp_header_extension_map);
517 fec_packet_ext.CopyHeaderFrom(fec_packet);
518 fec_packet_ext.SetExtension<TransportSequenceNumber>(2);
519 payload = fec_packet.payload();
520 ext_payload = fec_packet_ext.AllocatePayload(payload.size());
521 memcpy(ext_payload, payload.data(), payload.size());
522
523 // Expect BWE notification for FEC packet, but not media packet.
524 RTPHeader reported_header;
525 EXPECT_CALL(remote_bitrate_estimator,
526 IncomingPacket(_, fec_packet_ext.payload_size(), _))
527 .WillOnce(SaveArg<2>(&reported_header));
528
529 // Add packets to receiver.
530 EXPECT_TRUE(receiver.AddAndProcessReceivedPacket(media_packet_ext));
531 EXPECT_TRUE(receiver.AddAndProcessReceivedPacket(fec_packet_ext));
532
533 // Ensure that the BWE was notified of the FlexFEC packet.
534 EXPECT_EQ(kFlexfecSsrc, reported_header.ssrc);
535 EXPECT_EQ(2, reported_header.extension.transportSequenceNumber);
536 }
537
490 TEST_F(FlexfecReceiverTest, CalculatesNumberOfPackets) { 538 TEST_F(FlexfecReceiverTest, CalculatesNumberOfPackets) {
491 const size_t kNumMediaPackets = 2; 539 const size_t kNumMediaPackets = 2;
492 const size_t kNumFecPackets = 1; 540 const size_t kNumFecPackets = 1;
493 541
494 PacketList media_packets; 542 PacketList media_packets;
495 PacketizeFrame(kNumMediaPackets, 0, &media_packets); 543 PacketizeFrame(kNumMediaPackets, 0, &media_packets);
496 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets); 544 std::list<Packet*> fec_packets = EncodeFec(media_packets, kNumFecPackets);
497 545
498 // Receive first media packet but drop second. 546 // Receive first media packet but drop second.
499 auto media_it = media_packets.begin(); 547 auto media_it = media_packets.begin();
500 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket((*media_it)->data, 548 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(ParsePacket(*media_it)));
501 (*media_it)->length));
502 549
503 // Receive FEC packet and ensure recovery of lost media packet. 550 // Receive FEC packet and ensure recovery of lost media packet.
504 auto fec_it = fec_packets.begin(); 551 auto fec_it = fec_packets.begin();
505 std::unique_ptr<Packet> packet_with_rtp_header = 552 std::unique_ptr<Packet> packet_with_rtp_header =
506 packet_generator_.BuildFlexfecPacket(**fec_it); 553 packet_generator_.BuildFlexfecPacket(**fec_it);
507 media_it++; 554 media_it++;
508 EXPECT_CALL(recovered_packet_receiver_, 555 EXPECT_CALL(recovered_packet_receiver_,
509 OnRecoveredPacket(_, (*media_it)->length)) 556 OnRecoveredPacket(_, (*media_it)->length))
510 .With( 557 .With(
511 Args<0, 1>(ElementsAreArray((*media_it)->data, (*media_it)->length))) 558 Args<0, 1>(ElementsAreArray((*media_it)->data, (*media_it)->length)))
512 .WillOnce(Return(true)); 559 .WillOnce(Return(true));
513 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket( 560 EXPECT_TRUE(receiver_.AddAndProcessReceivedPacket(
514 packet_with_rtp_header->data, packet_with_rtp_header->length)); 561 ParsePacket(packet_with_rtp_header)));
515 562
516 // Check stats calculations. 563 // Check stats calculations.
517 FecPacketCounter packet_counter = receiver_.GetPacketCounter(); 564 FecPacketCounter packet_counter = receiver_.GetPacketCounter();
518 EXPECT_EQ(2U, packet_counter.num_packets); 565 EXPECT_EQ(2U, packet_counter.num_packets);
519 EXPECT_EQ(1U, packet_counter.num_fec_packets); 566 EXPECT_EQ(1U, packet_counter.num_fec_packets);
520 EXPECT_EQ(1U, packet_counter.num_recovered_packets); 567 EXPECT_EQ(1U, packet_counter.num_recovered_packets);
521 } 568 }
522 569
523 } // namespace webrtc 570 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698