| 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 |
| 11 #include <list> | 11 #include <list> |
| 12 | 12 |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "webrtc/base/random.h" | 14 #include "webrtc/base/random.h" |
| 15 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 15 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 16 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" | 16 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" |
| 17 | 17 |
| 18 using webrtc::ForwardErrorCorrection; | 18 using webrtc::ForwardErrorCorrection; |
| 19 | 19 |
| 20 // Minimum RTP header size in bytes. | 20 // Minimum RTP header size in bytes. |
| 21 const uint8_t kRtpHeaderSize = 12; | 21 const uint8_t kRtpHeaderSize = 12; |
| 22 | 22 |
| 23 // Transport header size in bytes. Assume UDP/IPv4 as a reasonable minimum. | 23 // Transport header size in bytes. Assume UDP/IPv4 as a reasonable minimum. |
| 24 const uint8_t kTransportOverhead = 28; | 24 const uint8_t kTransportOverhead = 28; |
| 25 | 25 |
| 26 // Maximum number of media packets used in the FEC (RFC 5109). | 26 // Maximum number of media packets used in the FEC (RFC 5109). |
| 27 const uint8_t kMaxNumberMediaPackets = ForwardErrorCorrection::kMaxMediaPackets; | 27 const uint8_t kMaxNumberMediaPackets = ForwardErrorCorrection::kMaxMediaPackets; |
| 28 | 28 |
| 29 typedef std::list<ForwardErrorCorrection::Packet*> PacketList; | 29 using PacketList = ForwardErrorCorrection::PacketList; |
| 30 typedef std::list<ForwardErrorCorrection::ReceivedPacket*> ReceivedPacketList; | 30 using ReceivedPacketList = ForwardErrorCorrection::ReceivedPacketList; |
| 31 typedef std::list<ForwardErrorCorrection::RecoveredPacket*> RecoveredPacketList; | 31 using RecoveredPacketList = ForwardErrorCorrection::RecoveredPacketList; |
| 32 | 32 |
| 33 template <typename T> void ClearList(std::list<T*>* my_list) { | 33 template <typename T> void ClearList(std::list<T*>* my_list) { |
| 34 T* packet = NULL; | 34 T* packet = NULL; |
| 35 while (!my_list->empty()) { | 35 while (!my_list->empty()) { |
| 36 packet = my_list->front(); | 36 packet = my_list->front(); |
| 37 delete packet; | 37 delete packet; |
| 38 my_list->pop_front(); | 38 my_list->pop_front(); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 } | 938 } |
| 939 // Last packet, set marker bit. | 939 // Last packet, set marker bit. |
| 940 assert(media_packet != NULL); | 940 assert(media_packet != NULL); |
| 941 media_packet->data[1] |= 0x80; | 941 media_packet->data[1] |= 0x80; |
| 942 return sequence_number; | 942 return sequence_number; |
| 943 } | 943 } |
| 944 | 944 |
| 945 int RtpFecTest::ConstructMediaPackets(int num_media_packets) { | 945 int RtpFecTest::ConstructMediaPackets(int num_media_packets) { |
| 946 return ConstructMediaPacketsSeqNum(num_media_packets, random_.Rand<int>()); | 946 return ConstructMediaPacketsSeqNum(num_media_packets, random_.Rand<int>()); |
| 947 } | 947 } |
| OLD | NEW |