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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // Reset the sequence number here for each FEC code/mask tested | 231 // Reset the sequence number here for each FEC code/mask tested |
232 // below, to avoid sequence number wrap-around. In actual decoding, | 232 // below, to avoid sequence number wrap-around. In actual decoding, |
233 // old FEC packets in list are dropped if sequence number wrap | 233 // old FEC packets in list are dropped if sequence number wrap |
234 // around is detected. This case is currently not handled below. | 234 // around is detected. This case is currently not handled below. |
235 seq_num = 0; | 235 seq_num = 0; |
236 for (uint32_t i = 0; i < num_media_packets; ++i) { | 236 for (uint32_t i = 0; i < num_media_packets; ++i) { |
237 std::unique_ptr<ForwardErrorCorrection::Packet> media_packet( | 237 std::unique_ptr<ForwardErrorCorrection::Packet> media_packet( |
238 new ForwardErrorCorrection::Packet()); | 238 new ForwardErrorCorrection::Packet()); |
239 const uint32_t kMinPacketSize = 12; | 239 const uint32_t kMinPacketSize = 12; |
240 const uint32_t kMaxPacketSize = static_cast<uint32_t>( | 240 const uint32_t kMaxPacketSize = static_cast<uint32_t>( |
241 IP_PACKET_SIZE - 12 - 28 - | 241 IP_PACKET_SIZE - 12 - 28 - fec.MaxPacketOverhead()); |
242 ForwardErrorCorrection::PacketOverhead()); | |
243 media_packet->length = random.Rand(kMinPacketSize, | 242 media_packet->length = random.Rand(kMinPacketSize, |
244 kMaxPacketSize); | 243 kMaxPacketSize); |
245 | 244 |
246 // Generate random values for the first 2 bytes. | 245 // Generate random values for the first 2 bytes. |
247 media_packet->data[0] = random.Rand<uint8_t>(); | 246 media_packet->data[0] = random.Rand<uint8_t>(); |
248 media_packet->data[1] = random.Rand<uint8_t>(); | 247 media_packet->data[1] = random.Rand<uint8_t>(); |
249 | 248 |
250 // The first two bits are assumed to be 10 by the | 249 // The first two bits are assumed to be 10 by the |
251 // FEC encoder. In fact the FEC decoder will set the | 250 // FEC encoder. In fact the FEC decoder will set the |
252 // two first bits to 10 regardless of what they | 251 // two first bits to 10 regardless of what they |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 } // loop over mask types | 447 } // loop over mask types |
449 | 448 |
450 // Have DecodeFec clear the recovered packet list. | 449 // Have DecodeFec clear the recovered packet list. |
451 fec.ResetState(&recovered_packet_list); | 450 fec.ResetState(&recovered_packet_list); |
452 ASSERT_TRUE(recovered_packet_list.empty()) | 451 ASSERT_TRUE(recovered_packet_list.empty()) |
453 << "Recovered packet list is not empty"; | 452 << "Recovered packet list is not empty"; |
454 } | 453 } |
455 | 454 |
456 } // namespace test | 455 } // namespace test |
457 } // namespace webrtc | 456 } // namespace webrtc |
OLD | NEW |