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 <algorithm> | 11 #include <algorithm> |
12 #include <list> | 12 #include <list> |
13 #include <memory> | |
13 | 14 |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "webrtc/base/random.h" | 16 #include "webrtc/base/random.h" |
16 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 17 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
18 #include "webrtc/modules/rtp_rtcp/source/fec_test_helper.h" | |
17 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" | 19 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" |
18 | 20 |
19 using webrtc::ForwardErrorCorrection; | 21 namespace webrtc { |
20 | 22 |
21 // Minimum RTP header size in bytes. | 23 namespace { |
22 constexpr uint8_t kRtpHeaderSize = 12; | 24 // Transport header size in bytes. Assume UDP/IPv4 as a reasonable minimum. |
25 constexpr size_t kTransportOverhead = 28; | |
26 } // namespace | |
23 | 27 |
24 // Transport header size in bytes. Assume UDP/IPv4 as a reasonable minimum. | 28 template <typename ForwardErrorCorrectionType> |
25 constexpr uint8_t kTransportOverhead = 28; | |
26 | |
27 // Maximum number of media packets used in the FEC (RFC 5109). | |
28 constexpr uint8_t kMaxNumberMediaPackets = | |
29 ForwardErrorCorrection::kMaxMediaPackets; | |
30 | |
31 using PacketList = ForwardErrorCorrection::PacketList; | |
32 using ReceivedPacketList = ForwardErrorCorrection::ReceivedPacketList; | |
33 using RecoveredPacketList = ForwardErrorCorrection::RecoveredPacketList; | |
34 | |
35 class RtpFecTest : public ::testing::Test { | 29 class RtpFecTest : public ::testing::Test { |
36 protected: | 30 protected: |
37 RtpFecTest() | 31 RtpFecTest() |
38 : random_(0xfec133700742), | 32 : random_(0xabcdef123456), |
39 ssrc_(random_.Rand<uint32_t>()), | 33 media_packet_generator_( |
40 fec_seq_num_(0) {} | 34 kRtpHeaderSize, // minimum packet size |
danilchap
2016/08/23 13:08:50
Start comments with uppcase, end with '.'
brandtr
2016/08/23 14:05:07
Done.
| |
41 | 35 IP_PACKET_SIZE - kRtpHeaderSize - kTransportOverhead - |
42 // Construct the media packet list, up to |num_media_packets| packets. | 36 fec_.MaxPacketOverhead(), // maximum packet size |
danilchap
2016/08/23 13:08:50
same here
brandtr
2016/08/23 14:05:07
Done.
| |
43 // Returns the next sequence number after the last media packet. | 37 &random_) {} |
44 // (this will be the sequence of the first FEC packet) | |
45 int ConstructMediaPacketsSeqNum(int num_media_packets, int start_seq_num); | |
46 int ConstructMediaPackets(int num_media_packets); | |
47 | 38 |
48 // Deep copies |src| to |dst|, but only keeps every Nth packet. | 39 // Deep copies |src| to |dst|, but only keeps every Nth packet. |
49 void DeepCopyEveryNthPacket(const PacketList& src, int n, PacketList* dst); | 40 static void DeepCopyEveryNthPacket( |
41 const ForwardErrorCorrection::PacketList& src, | |
42 int n, | |
43 ForwardErrorCorrection::PacketList* dst); | |
50 | 44 |
51 // Construct |received_packet_list_|: a subset of the media and FEC packets. | 45 // Construct |received_packets_|: a subset of the media and FEC packets. |
52 // | 46 // |
53 // Media packet "i" is lost if media_loss_mask_[i] = 1, received if | 47 // Media packet "i" is lost if media_loss_mask_[i] = 1, received if |
54 // media_loss_mask_[i] = 0. | 48 // media_loss_mask_[i] = 0. |
55 // FEC packet "i" is lost if fec_loss_mask_[i] = 1, received if | 49 // FEC packet "i" is lost if fec_loss_mask_[i] = 1, received if |
56 // fec_loss_mask_[i] = 0. | 50 // fec_loss_mask_[i] = 0. |
57 void NetworkReceivedPackets(int* media_loss_mask, int* fec_loss_mask); | 51 void NetworkReceivedPackets(int* media_loss_mask, int* fec_loss_mask); |
58 | 52 |
59 // Add packet from |packet_list| to list of received packets, using the | 53 // Add packet from |packet_list| to list of received packets, using the |
60 // |loss_mask|. | 54 // |loss_mask|. |
61 // The |packet_list| may be a media packet list (is_fec = false), or a | 55 // The |packet_list| may be a media packet list (is_fec = false), or a |
62 // FEC packet list (is_fec = true). | 56 // FEC packet list (is_fec = true). |
63 template <typename T> | 57 template <typename T> |
64 void ReceivedPackets(const T& packet_list, int* loss_mask, bool is_fec); | 58 void ReceivedPackets(const T& packet_list, int* loss_mask, bool is_fec); |
65 | 59 |
66 // Check for complete recovery after FEC decoding. | 60 // Check for complete recovery after FEC decoding. |
67 bool IsRecoveryComplete(); | 61 bool IsRecoveryComplete(); |
68 | 62 |
69 // Delete the media and FEC packets. | 63 ForwardErrorCorrectionType fec_; |
70 void TearDown(); | |
71 | 64 |
72 webrtc::Random random_; | 65 Random random_; |
73 ForwardErrorCorrection fec_; | 66 test::fec::MediaPacketGenerator media_packet_generator_; |
74 int ssrc_; | |
75 uint16_t fec_seq_num_; | |
76 | 67 |
77 PacketList media_packet_list_; | 68 ForwardErrorCorrection::PacketList* media_packets_; |
78 std::list<ForwardErrorCorrection::Packet*> fec_packet_list_; | 69 std::list<ForwardErrorCorrection::Packet*> generated_fec_packets_; |
79 ReceivedPacketList received_packet_list_; | 70 ForwardErrorCorrection::ReceivedPacketList received_packets_; |
80 RecoveredPacketList recovered_packet_list_; | 71 ForwardErrorCorrection::RecoveredPacketList recovered_packets_; |
81 | 72 |
82 int media_loss_mask_[kMaxNumberMediaPackets]; | 73 int media_loss_mask_[ForwardErrorCorrection::kMaxMediaPackets]; |
83 int fec_loss_mask_[kMaxNumberMediaPackets]; | 74 int fec_loss_mask_[ForwardErrorCorrection::kMaxMediaPackets]; |
84 }; | 75 }; |
85 | 76 |
86 TEST_F(RtpFecTest, FecRecoveryNoLoss) { | 77 // Define gTest typed test to loop over both ULPFEC and FlexFEC. |
78 // Since the tests now are parameterized, we need to access | |
79 // member variables using |this|, thereby enforcing runtime | |
80 // resolution. | |
81 typedef ::testing::Types<ForwardErrorCorrection> FecTypes; | |
danilchap
2016/08/23 13:08:50
prefer using over typedef:
using FecTypes = ::test
brandtr
2016/08/23 14:05:07
Done.
| |
82 TYPED_TEST_CASE(RtpFecTest, FecTypes); | |
83 | |
84 TYPED_TEST(RtpFecTest, FecRecoveryNoLoss) { | |
87 constexpr int kNumImportantPackets = 0; | 85 constexpr int kNumImportantPackets = 0; |
88 constexpr bool kUseUnequalProtection = false; | 86 constexpr bool kUseUnequalProtection = false; |
89 constexpr int kNumMediaPackets = 4; | 87 constexpr int kNumMediaPackets = 4; |
90 constexpr uint8_t kProtectionFactor = 60; | 88 constexpr uint8_t kProtectionFactor = 60; |
91 | 89 |
92 fec_seq_num_ = ConstructMediaPackets(kNumMediaPackets); | 90 this->media_packet_generator_.ConstructMediaPackets(kNumMediaPackets); |
91 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
93 | 92 |
94 EXPECT_EQ(0, fec_.GenerateFec(media_packet_list_, kProtectionFactor, | 93 EXPECT_EQ( |
95 kNumImportantPackets, kUseUnequalProtection, | 94 0, this->fec_.EncodeFec(*this->media_packets_, kProtectionFactor, |
96 webrtc::kFecMaskBursty, &fec_packet_list_)); | 95 kNumImportantPackets, kUseUnequalProtection, |
96 kFecMaskBursty, &this->generated_fec_packets_)); | |
97 | 97 |
98 // Expect 1 FEC packet. | 98 // Expect 1 FEC packet. |
99 EXPECT_EQ(1u, fec_packet_list_.size()); | 99 EXPECT_EQ(1u, this->generated_fec_packets_.size()); |
100 | 100 |
101 // No packets lost. | 101 // No packets lost. |
102 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 102 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
103 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 103 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
104 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 104 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
105 | 105 |
106 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 106 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
107 &this->recovered_packets_)); | |
107 | 108 |
108 // No packets lost, expect complete recovery. | 109 // No packets lost, expect complete recovery. |
109 EXPECT_TRUE(IsRecoveryComplete()); | 110 EXPECT_TRUE(this->IsRecoveryComplete()); |
110 } | 111 } |
111 | 112 |
112 TEST_F(RtpFecTest, FecRecoveryWithLoss) { | 113 TYPED_TEST(RtpFecTest, FecRecoveryWithLoss) { |
113 constexpr int kNumImportantPackets = 0; | 114 constexpr int kNumImportantPackets = 0; |
114 constexpr bool kUseUnequalProtection = false; | 115 constexpr bool kUseUnequalProtection = false; |
115 constexpr int kNumMediaPackets = 4; | 116 constexpr int kNumMediaPackets = 4; |
116 constexpr uint8_t kProtectionFactor = 60; | 117 constexpr uint8_t kProtectionFactor = 60; |
117 | 118 |
118 fec_seq_num_ = ConstructMediaPackets(kNumMediaPackets); | 119 this->media_packet_generator_.ConstructMediaPackets(kNumMediaPackets); |
120 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
119 | 121 |
120 EXPECT_EQ(0, fec_.GenerateFec(media_packet_list_, kProtectionFactor, | 122 EXPECT_EQ( |
121 kNumImportantPackets, kUseUnequalProtection, | 123 0, this->fec_.EncodeFec(*this->media_packets_, kProtectionFactor, |
122 webrtc::kFecMaskBursty, &fec_packet_list_)); | 124 kNumImportantPackets, kUseUnequalProtection, |
125 kFecMaskBursty, &this->generated_fec_packets_)); | |
123 | 126 |
124 // Expect 1 FEC packet. | 127 // Expect 1 FEC packet. |
125 EXPECT_EQ(1u, fec_packet_list_.size()); | 128 EXPECT_EQ(1u, this->generated_fec_packets_.size()); |
126 | 129 |
127 // 1 media packet lost | 130 // 1 media packet lost |
128 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 131 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
129 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 132 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
130 media_loss_mask_[3] = 1; | 133 this->media_loss_mask_[3] = 1; |
131 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 134 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
132 | 135 |
133 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 136 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
137 &this->recovered_packets_)); | |
134 | 138 |
135 // One packet lost, one FEC packet, expect complete recovery. | 139 // One packet lost, one FEC packet, expect complete recovery. |
136 EXPECT_TRUE(IsRecoveryComplete()); | 140 EXPECT_TRUE(this->IsRecoveryComplete()); |
137 recovered_packet_list_.clear(); | 141 this->recovered_packets_.clear(); |
138 | 142 |
139 // 2 media packets lost. | 143 // 2 media packets lost. |
140 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 144 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
141 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 145 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
142 media_loss_mask_[1] = 1; | 146 this->media_loss_mask_[1] = 1; |
143 media_loss_mask_[3] = 1; | 147 this->media_loss_mask_[3] = 1; |
144 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 148 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
145 | 149 |
146 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 150 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
151 &this->recovered_packets_)); | |
147 | 152 |
148 // 2 packets lost, one FEC packet, cannot get complete recovery. | 153 // 2 packets lost, one FEC packet, cannot get complete recovery. |
149 EXPECT_FALSE(IsRecoveryComplete()); | 154 EXPECT_FALSE(this->IsRecoveryComplete()); |
150 } | 155 } |
151 | 156 |
152 // Verify that we don't use an old FEC packet for FEC decoding. | 157 // Verify that we don't use an old FEC packet for FEC decoding. |
153 TEST_F(RtpFecTest, FecRecoveryWithSeqNumGapTwoFrames) { | 158 TYPED_TEST(RtpFecTest, FecRecoveryWithSeqNumGapTwoFrames) { |
154 constexpr int kNumImportantPackets = 0; | 159 constexpr int kNumImportantPackets = 0; |
155 constexpr bool kUseUnequalProtection = false; | 160 constexpr bool kUseUnequalProtection = false; |
156 constexpr uint8_t kProtectionFactor = 20; | 161 constexpr uint8_t kProtectionFactor = 20; |
157 | 162 |
158 // Two frames: first frame (old) with two media packets and 1 FEC packet. | 163 // Two frames: first frame (old) with two media packets and 1 FEC packet. |
159 // Second frame (new) with 3 media packets, and no FEC packets. | 164 // Second frame (new) with 3 media packets, and no FEC packets. |
160 // ---Frame 1---- ----Frame 2------ | 165 // ---Frame 1---- ----Frame 2------ |
161 // #0(media) #1(media) #2(FEC) #65535(media) #0(media) #1(media). | 166 // #0(media) #1(media) #2(FEC) #65535(media) #0(media) #1(media). |
162 // If we lose either packet 0 or 1 of second frame, FEC decoding should not | 167 // If we lose either packet 0 or 1 of second frame, FEC decoding should not |
163 // try to decode using "old" FEC packet #2. | 168 // try to decode using "old" FEC packet #2. |
164 | 169 |
165 // Construct media packets for first frame, starting at sequence number 0. | 170 // Construct media packets for first frame, starting at sequence number 0. |
166 fec_seq_num_ = ConstructMediaPacketsSeqNum(2, 0); | 171 this->media_packet_generator_.ConstructMediaPacketsSeqNum(2, 0); |
172 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
167 | 173 |
168 EXPECT_EQ(0, fec_.GenerateFec(media_packet_list_, kProtectionFactor, | 174 EXPECT_EQ( |
169 kNumImportantPackets, kUseUnequalProtection, | 175 0, this->fec_.EncodeFec(*this->media_packets_, kProtectionFactor, |
170 webrtc::kFecMaskBursty, &fec_packet_list_)); | 176 kNumImportantPackets, kUseUnequalProtection, |
177 kFecMaskBursty, &this->generated_fec_packets_)); | |
171 // Expect 1 FEC packet. | 178 // Expect 1 FEC packet. |
172 EXPECT_EQ(1u, fec_packet_list_.size()); | 179 EXPECT_EQ(1u, this->generated_fec_packets_.size()); |
173 // Add FEC packet (seq#2) of this first frame to received list (i.e., assume | 180 // Add FEC packet (seq#2) of this first frame to received list (i.e., assume |
174 // the two media packet were lost). | 181 // the two media packet were lost). |
175 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 182 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
176 ReceivedPackets(fec_packet_list_, fec_loss_mask_, true); | 183 this->ReceivedPackets(this->generated_fec_packets_, this->fec_loss_mask_, |
184 true); | |
177 | 185 |
178 // Construct media packets for second frame, with sequence number wrap. | 186 // Construct media packets for second frame, with sequence number wrap. |
179 media_packet_list_.clear(); | 187 this->media_packets_->clear(); |
180 fec_seq_num_ = ConstructMediaPacketsSeqNum(3, 65535); | 188 this->media_packet_generator_.ConstructMediaPacketsSeqNum(3, 65535); |
danilchap
2016/08/23 13:08:50
ConstructMediaPackets and GetMediaPackets seems al
brandtr
2016/08/23 14:05:07
Done.
| |
189 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
181 | 190 |
182 // Expect 3 media packets for this frame. | 191 // Expect 3 media packets for this frame. |
183 EXPECT_EQ(3u, media_packet_list_.size()); | 192 EXPECT_EQ(3u, this->media_packets_->size()); |
184 | 193 |
185 // Second media packet lost (seq#0). | 194 // Second media packet lost (seq#0). |
186 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 195 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
187 media_loss_mask_[1] = 1; | 196 this->media_loss_mask_[1] = 1; |
188 // Add packets #65535, and #1 to received list. | 197 // Add packets #65535, and #1 to received list. |
189 ReceivedPackets(media_packet_list_, media_loss_mask_, false); | 198 this->ReceivedPackets(*this->media_packets_, this->media_loss_mask_, false); |
190 | 199 |
191 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 200 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
201 &this->recovered_packets_)); | |
192 | 202 |
193 // Expect that no decoding is done to get missing packet (seq#0) of second | 203 // Expect that no decoding is done to get missing packet (seq#0) of second |
194 // frame, using old FEC packet (seq#2) from first (old) frame. So number of | 204 // frame, using old FEC packet (seq#2) from first (old) frame. So number of |
195 // recovered packets is 2, and not equal to number of media packets (=3). | 205 // recovered packets is 2, and not equal to number of media packets (=3). |
196 EXPECT_EQ(2u, recovered_packet_list_.size()); | 206 EXPECT_EQ(2u, this->recovered_packets_.size()); |
197 EXPECT_TRUE(recovered_packet_list_.size() != media_packet_list_.size()); | 207 EXPECT_TRUE(this->recovered_packets_.size() != this->media_packets_->size()); |
198 } | 208 } |
199 | 209 |
200 // Verify we can still recover frame if sequence number wrap occurs within | 210 // Verify we can still recover frame if sequence number wrap occurs within |
201 // the frame and FEC packet following wrap is received after media packets. | 211 // the frame and FEC packet following wrap is received after media packets. |
202 TEST_F(RtpFecTest, FecRecoveryWithSeqNumGapOneFrameRecovery) { | 212 TYPED_TEST(RtpFecTest, FecRecoveryWithSeqNumGapOneFrameRecovery) { |
203 constexpr int kNumImportantPackets = 0; | 213 constexpr int kNumImportantPackets = 0; |
204 constexpr bool kUseUnequalProtection = false; | 214 constexpr bool kUseUnequalProtection = false; |
205 constexpr uint8_t kProtectionFactor = 20; | 215 constexpr uint8_t kProtectionFactor = 20; |
206 | 216 |
207 // One frame, with sequence number wrap in media packets. | 217 // One frame, with sequence number wrap in media packets. |
208 // -----Frame 1---- | 218 // -----Frame 1---- |
209 // #65534(media) #65535(media) #0(media) #1(FEC). | 219 // #65534(media) #65535(media) #0(media) #1(FEC). |
210 fec_seq_num_ = ConstructMediaPacketsSeqNum(3, 65534); | 220 this->media_packet_generator_.ConstructMediaPacketsSeqNum(3, 65534); |
221 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
211 | 222 |
212 EXPECT_EQ(0, fec_.GenerateFec(media_packet_list_, kProtectionFactor, | 223 EXPECT_EQ( |
213 kNumImportantPackets, kUseUnequalProtection, | 224 0, this->fec_.EncodeFec(*this->media_packets_, kProtectionFactor, |
214 webrtc::kFecMaskBursty, &fec_packet_list_)); | 225 kNumImportantPackets, kUseUnequalProtection, |
226 kFecMaskBursty, &this->generated_fec_packets_)); | |
215 | 227 |
216 // Expect 1 FEC packet. | 228 // Expect 1 FEC packet. |
217 EXPECT_EQ(1u, fec_packet_list_.size()); | 229 EXPECT_EQ(1u, this->generated_fec_packets_.size()); |
218 | 230 |
219 // Lose one media packet (seq# 65535). | 231 // Lose one media packet (seq# 65535). |
220 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 232 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
221 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 233 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
222 media_loss_mask_[1] = 1; | 234 this->media_loss_mask_[1] = 1; |
223 ReceivedPackets(media_packet_list_, media_loss_mask_, false); | 235 this->ReceivedPackets(*this->media_packets_, this->media_loss_mask_, false); |
224 // Add FEC packet to received list following the media packets. | 236 // Add FEC packet to received list following the media packets. |
225 ReceivedPackets(fec_packet_list_, fec_loss_mask_, true); | 237 this->ReceivedPackets(this->generated_fec_packets_, this->fec_loss_mask_, |
238 true); | |
226 | 239 |
227 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 240 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
241 &this->recovered_packets_)); | |
228 | 242 |
229 // Expect 3 media packets in recovered list, and complete recovery. | 243 // Expect 3 media packets in recovered list, and complete recovery. |
230 // Wrap-around won't remove FEC packet, as it follows the wrap. | 244 // Wrap-around won't remove FEC packet, as it follows the wrap. |
231 EXPECT_EQ(3u, recovered_packet_list_.size()); | 245 EXPECT_EQ(3u, this->recovered_packets_.size()); |
232 EXPECT_TRUE(IsRecoveryComplete()); | 246 EXPECT_TRUE(this->IsRecoveryComplete()); |
233 } | 247 } |
234 | 248 |
235 // Sequence number wrap occurs within the FEC packets for the frame. | 249 // Sequence number wrap occurs within the FEC packets for the frame. |
236 // In this case we will discard FEC packet and full recovery is not expected. | 250 // In this case we will discard FEC packet and full recovery is not expected. |
237 // Same problem will occur if wrap is within media packets but FEC packet is | 251 // Same problem will occur if wrap is within media packets but FEC packet is |
238 // received before the media packets. This may be improved if timing information | 252 // received before the media packets. This may be improved if timing information |
239 // is used to detect old FEC packets. | 253 // is used to detect old FEC packets. |
240 // TODO(marpan): Update test if wrap-around handling changes in FEC decoding. | 254 // TODO(marpan): Update test if wrap-around handling changes in FEC decoding. |
241 TEST_F(RtpFecTest, FecRecoveryWithSeqNumGapOneFrameNoRecovery) { | 255 TYPED_TEST(RtpFecTest, FecRecoveryWithSeqNumGapOneFrameNoRecovery) { |
242 constexpr int kNumImportantPackets = 0; | 256 constexpr int kNumImportantPackets = 0; |
243 constexpr bool kUseUnequalProtection = false; | 257 constexpr bool kUseUnequalProtection = false; |
244 constexpr uint8_t kProtectionFactor = 200; | 258 constexpr uint8_t kProtectionFactor = 200; |
245 | 259 |
246 // 1 frame: 3 media packets and 2 FEC packets. | 260 // 1 frame: 3 media packets and 2 FEC packets. |
247 // Sequence number wrap in FEC packets. | 261 // Sequence number wrap in FEC packets. |
248 // -----Frame 1---- | 262 // -----Frame 1---- |
249 // #65532(media) #65533(media) #65534(media) #65535(FEC) #0(FEC). | 263 // #65532(media) #65533(media) #65534(media) #65535(FEC) #0(FEC). |
250 fec_seq_num_ = ConstructMediaPacketsSeqNum(3, 65532); | 264 this->media_packet_generator_.ConstructMediaPacketsSeqNum(3, 65532); |
265 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
251 | 266 |
252 EXPECT_EQ(0, fec_.GenerateFec(media_packet_list_, kProtectionFactor, | 267 EXPECT_EQ( |
253 kNumImportantPackets, kUseUnequalProtection, | 268 0, this->fec_.EncodeFec(*this->media_packets_, kProtectionFactor, |
254 webrtc::kFecMaskBursty, &fec_packet_list_)); | 269 kNumImportantPackets, kUseUnequalProtection, |
270 kFecMaskBursty, &this->generated_fec_packets_)); | |
255 | 271 |
256 // Expect 2 FEC packets. | 272 // Expect 2 FEC packets. |
257 EXPECT_EQ(2u, fec_packet_list_.size()); | 273 EXPECT_EQ(2u, this->generated_fec_packets_.size()); |
258 | 274 |
259 // Lose the last two media packets (seq# 65533, 65534). | 275 // Lose the last two media packets (seq# 65533, 65534). |
260 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 276 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
261 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 277 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
262 media_loss_mask_[1] = 1; | 278 this->media_loss_mask_[1] = 1; |
263 media_loss_mask_[2] = 1; | 279 this->media_loss_mask_[2] = 1; |
264 ReceivedPackets(media_packet_list_, media_loss_mask_, false); | 280 this->ReceivedPackets(*this->media_packets_, this->media_loss_mask_, false); |
265 ReceivedPackets(fec_packet_list_, fec_loss_mask_, true); | 281 this->ReceivedPackets(this->generated_fec_packets_, this->fec_loss_mask_, |
282 true); | |
266 | 283 |
267 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 284 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
285 &this->recovered_packets_)); | |
268 | 286 |
269 // The two FEC packets are received and should allow for complete recovery, | 287 // The two FEC packets are received and should allow for complete recovery, |
270 // but because of the wrap the second FEC packet will be discarded, and only | 288 // but because of the wrap the second FEC packet will be discarded, and only |
271 // one media packet is recoverable. So exepct 2 media packets on recovered | 289 // one media packet is recoverable. So exepct 2 media packets on recovered |
272 // list and no complete recovery. | 290 // list and no complete recovery. |
273 EXPECT_EQ(2u, recovered_packet_list_.size()); | 291 EXPECT_EQ(2u, this->recovered_packets_.size()); |
274 EXPECT_TRUE(recovered_packet_list_.size() != media_packet_list_.size()); | 292 EXPECT_TRUE(this->recovered_packets_.size() != this->media_packets_->size()); |
275 EXPECT_FALSE(IsRecoveryComplete()); | 293 EXPECT_FALSE(this->IsRecoveryComplete()); |
276 } | 294 } |
277 | 295 |
278 // Verify we can still recover frame if media packets are reordered. | 296 // Verify we can still recover frame if media packets are reordered. |
279 TEST_F(RtpFecTest, FecRecoveryWithMediaOutOfOrder) { | 297 TYPED_TEST(RtpFecTest, FecRecoveryWithMediaOutOfOrder) { |
280 constexpr int kNumImportantPackets = 0; | 298 constexpr int kNumImportantPackets = 0; |
281 constexpr bool kUseUnequalProtection = false; | 299 constexpr bool kUseUnequalProtection = false; |
282 constexpr uint8_t kProtectionFactor = 20; | 300 constexpr uint8_t kProtectionFactor = 20; |
283 | 301 |
284 // One frame: 3 media packets, 1 FEC packet. | 302 // One frame: 3 media packets, 1 FEC packet. |
285 // -----Frame 1---- | 303 // -----Frame 1---- |
286 // #0(media) #1(media) #2(media) #3(FEC). | 304 // #0(media) #1(media) #2(media) #3(FEC). |
287 fec_seq_num_ = ConstructMediaPacketsSeqNum(3, 0); | 305 this->media_packet_generator_.ConstructMediaPacketsSeqNum(3, 0); |
306 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
288 | 307 |
289 EXPECT_EQ(0, fec_.GenerateFec(media_packet_list_, kProtectionFactor, | 308 EXPECT_EQ( |
290 kNumImportantPackets, kUseUnequalProtection, | 309 0, this->fec_.EncodeFec(*this->media_packets_, kProtectionFactor, |
291 webrtc::kFecMaskBursty, &fec_packet_list_)); | 310 kNumImportantPackets, kUseUnequalProtection, |
311 kFecMaskBursty, &this->generated_fec_packets_)); | |
292 | 312 |
293 // Expect 1 FEC packet. | 313 // Expect 1 FEC packet. |
294 EXPECT_EQ(1u, fec_packet_list_.size()); | 314 EXPECT_EQ(1u, this->generated_fec_packets_.size()); |
295 | 315 |
296 // Lose one media packet (seq# 1). | 316 // Lose one media packet (seq# 1). |
297 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 317 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
298 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 318 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
299 media_loss_mask_[1] = 1; | 319 this->media_loss_mask_[1] = 1; |
300 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 320 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
301 | 321 |
302 // Reorder received media packets. | 322 // Reorder received media packets. |
303 auto it0 = received_packet_list_.begin(); | 323 auto it0 = this->received_packets_.begin(); |
304 auto it2 = received_packet_list_.begin(); | 324 auto it2 = this->received_packets_.begin(); |
305 it2++; | 325 it2++; |
306 std::swap(*it0, *it2); | 326 std::swap(*it0, *it2); |
307 | 327 |
308 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 328 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
329 &this->recovered_packets_)); | |
309 | 330 |
310 // Expect 3 media packets in recovered list, and complete recovery. | 331 // Expect 3 media packets in recovered list, and complete recovery. |
311 EXPECT_EQ(3u, recovered_packet_list_.size()); | 332 EXPECT_EQ(3u, this->recovered_packets_.size()); |
312 EXPECT_TRUE(IsRecoveryComplete()); | 333 EXPECT_TRUE(this->IsRecoveryComplete()); |
313 } | 334 } |
314 | 335 |
315 // Verify we can still recover frame if FEC is received before media packets. | 336 // Verify we can still recover frame if FEC is received before media packets. |
316 TEST_F(RtpFecTest, FecRecoveryWithFecOutOfOrder) { | 337 TYPED_TEST(RtpFecTest, FecRecoveryWithFecOutOfOrder) { |
317 constexpr int kNumImportantPackets = 0; | 338 constexpr int kNumImportantPackets = 0; |
318 constexpr bool kUseUnequalProtection = false; | 339 constexpr bool kUseUnequalProtection = false; |
319 constexpr uint8_t kProtectionFactor = 20; | 340 constexpr uint8_t kProtectionFactor = 20; |
320 | 341 |
321 // One frame: 3 media packets, 1 FEC packet. | 342 // One frame: 3 media packets, 1 FEC packet. |
322 // -----Frame 1---- | 343 // -----Frame 1---- |
323 // #0(media) #1(media) #2(media) #3(FEC). | 344 // #0(media) #1(media) #2(media) #3(FEC). |
324 fec_seq_num_ = ConstructMediaPacketsSeqNum(3, 0); | 345 this->media_packet_generator_.ConstructMediaPacketsSeqNum(3, 0); |
346 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
325 | 347 |
326 EXPECT_EQ(0, fec_.GenerateFec(media_packet_list_, kProtectionFactor, | 348 EXPECT_EQ( |
327 kNumImportantPackets, kUseUnequalProtection, | 349 0, this->fec_.EncodeFec(*this->media_packets_, kProtectionFactor, |
328 webrtc::kFecMaskBursty, &fec_packet_list_)); | 350 kNumImportantPackets, kUseUnequalProtection, |
351 kFecMaskBursty, &this->generated_fec_packets_)); | |
329 | 352 |
330 // Expect 1 FEC packet. | 353 // Expect 1 FEC packet. |
331 EXPECT_EQ(1u, fec_packet_list_.size()); | 354 EXPECT_EQ(1u, this->generated_fec_packets_.size()); |
332 | 355 |
333 // Lose one media packet (seq# 1). | 356 // Lose one media packet (seq# 1). |
334 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 357 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
335 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 358 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
336 media_loss_mask_[1] = 1; | 359 this->media_loss_mask_[1] = 1; |
337 // Add FEC packet to received list before the media packets. | 360 // Add FEC packet to received list before the media packets. |
338 ReceivedPackets(fec_packet_list_, fec_loss_mask_, true); | 361 this->ReceivedPackets(this->generated_fec_packets_, this->fec_loss_mask_, |
362 true); | |
339 // Add media packets to received list. | 363 // Add media packets to received list. |
340 ReceivedPackets(media_packet_list_, media_loss_mask_, false); | 364 this->ReceivedPackets(*this->media_packets_, this->media_loss_mask_, false); |
341 | 365 |
342 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 366 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
367 &this->recovered_packets_)); | |
343 | 368 |
344 // Expect 3 media packets in recovered list, and complete recovery. | 369 // Expect 3 media packets in recovered list, and complete recovery. |
345 EXPECT_EQ(3u, recovered_packet_list_.size()); | 370 EXPECT_EQ(3u, this->recovered_packets_.size()); |
346 EXPECT_TRUE(IsRecoveryComplete()); | 371 EXPECT_TRUE(this->IsRecoveryComplete()); |
347 } | 372 } |
348 | 373 |
349 // Test 50% protection with random mask type: Two cases are considered: | 374 // Test 50% protection with random mask type: Two cases are considered: |
350 // a 50% non-consecutive loss which can be fully recovered, and a 50% | 375 // a 50% non-consecutive loss which can be fully recovered, and a 50% |
351 // consecutive loss which cannot be fully recovered. | 376 // consecutive loss which cannot be fully recovered. |
352 TEST_F(RtpFecTest, FecRecoveryWithLoss50percRandomMask) { | 377 TYPED_TEST(RtpFecTest, FecRecoveryWithLoss50percRandomMask) { |
353 constexpr int kNumImportantPackets = 0; | 378 constexpr int kNumImportantPackets = 0; |
354 constexpr bool kUseUnequalProtection = false; | 379 constexpr bool kUseUnequalProtection = false; |
355 constexpr int kNumMediaPackets = 4; | 380 constexpr int kNumMediaPackets = 4; |
356 constexpr uint8_t kProtectionFactor = 255; | 381 constexpr uint8_t kProtectionFactor = 255; |
357 | 382 |
358 // Packet Mask for (4,4,0) code, from random mask table. | 383 // Packet Mask for (4,4,0) code, from random mask table. |
359 // (kNumMediaPackets = 4; num_fec_packets = 4, kNumImportantPackets = 0) | 384 // (kNumMediaPackets = 4; num_fec_packets = 4, kNumImportantPackets = 0) |
360 | 385 |
361 // media#0 media#1 media#2 media#3 | 386 // media#0 media#1 media#2 media#3 |
362 // fec#0: 1 1 0 0 | 387 // fec#0: 1 1 0 0 |
363 // fec#1: 1 0 1 0 | 388 // fec#1: 1 0 1 0 |
364 // fec#2: 0 0 1 1 | 389 // fec#2: 0 0 1 1 |
365 // fec#3: 0 1 0 1 | 390 // fec#3: 0 1 0 1 |
366 // | 391 // |
367 | 392 |
368 fec_seq_num_ = ConstructMediaPackets(kNumMediaPackets); | 393 this->media_packet_generator_.ConstructMediaPackets(kNumMediaPackets); |
394 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
369 | 395 |
370 EXPECT_EQ(0, fec_.GenerateFec(media_packet_list_, kProtectionFactor, | 396 EXPECT_EQ( |
371 kNumImportantPackets, kUseUnequalProtection, | 397 0, this->fec_.EncodeFec(*this->media_packets_, kProtectionFactor, |
372 webrtc::kFecMaskRandom, &fec_packet_list_)); | 398 kNumImportantPackets, kUseUnequalProtection, |
399 kFecMaskRandom, &this->generated_fec_packets_)); | |
373 | 400 |
374 // Expect 4 FEC packets. | 401 // Expect 4 FEC packets. |
375 EXPECT_EQ(4u, fec_packet_list_.size()); | 402 EXPECT_EQ(4u, this->generated_fec_packets_.size()); |
376 | 403 |
377 // 4 packets lost: 3 media packets (0, 2, 3), and one FEC packet (0) lost. | 404 // 4 packets lost: 3 media packets (0, 2, 3), and one FEC packet (0) lost. |
378 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 405 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
379 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 406 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
380 fec_loss_mask_[0] = 1; | 407 this->fec_loss_mask_[0] = 1; |
381 media_loss_mask_[0] = 1; | 408 this->media_loss_mask_[0] = 1; |
382 media_loss_mask_[2] = 1; | 409 this->media_loss_mask_[2] = 1; |
383 media_loss_mask_[3] = 1; | 410 this->media_loss_mask_[3] = 1; |
384 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 411 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
385 | 412 |
386 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 413 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
414 &this->recovered_packets_)); | |
387 | 415 |
388 // With media packet#1 and FEC packets #1, #2, #3, expect complete recovery. | 416 // With media packet#1 and FEC packets #1, #2, #3, expect complete recovery. |
389 EXPECT_TRUE(IsRecoveryComplete()); | 417 EXPECT_TRUE(this->IsRecoveryComplete()); |
390 recovered_packet_list_.clear(); | 418 this->recovered_packets_.clear(); |
391 | 419 |
392 // 4 consecutive packets lost: media packets 0, 1, 2, 3. | 420 // 4 consecutive packets lost: media packets 0, 1, 2, 3. |
393 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 421 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
394 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 422 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
395 media_loss_mask_[0] = 1; | 423 this->media_loss_mask_[0] = 1; |
396 media_loss_mask_[1] = 1; | 424 this->media_loss_mask_[1] = 1; |
397 media_loss_mask_[2] = 1; | 425 this->media_loss_mask_[2] = 1; |
398 media_loss_mask_[3] = 1; | 426 this->media_loss_mask_[3] = 1; |
399 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 427 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
400 | 428 |
401 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 429 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
430 &this->recovered_packets_)); | |
402 | 431 |
403 // Cannot get complete recovery for this loss configuration with random mask. | 432 // Cannot get complete recovery for this loss configuration with random mask. |
404 EXPECT_FALSE(IsRecoveryComplete()); | 433 EXPECT_FALSE(this->IsRecoveryComplete()); |
405 } | 434 } |
406 | 435 |
407 // Test 50% protection with bursty type: Three cases are considered: | 436 // Test 50% protection with bursty type: Three cases are considered: |
408 // two 50% consecutive losses which can be fully recovered, and one | 437 // two 50% consecutive losses which can be fully recovered, and one |
409 // non-consecutive which cannot be fully recovered. | 438 // non-consecutive which cannot be fully recovered. |
410 TEST_F(RtpFecTest, FecRecoveryWithLoss50percBurstyMask) { | 439 TYPED_TEST(RtpFecTest, FecRecoveryWithLoss50percBurstyMask) { |
411 constexpr int kNumImportantPackets = 0; | 440 constexpr int kNumImportantPackets = 0; |
412 constexpr bool kUseUnequalProtection = false; | 441 constexpr bool kUseUnequalProtection = false; |
413 constexpr int kNumMediaPackets = 4; | 442 constexpr int kNumMediaPackets = 4; |
414 constexpr uint8_t kProtectionFactor = 255; | 443 constexpr uint8_t kProtectionFactor = 255; |
415 | 444 |
416 // Packet Mask for (4,4,0) code, from bursty mask table. | 445 // Packet Mask for (4,4,0) code, from bursty mask table. |
417 // (kNumMediaPackets = 4; num_fec_packets = 4, kNumImportantPackets = 0) | 446 // (kNumMediaPackets = 4; num_fec_packets = 4, kNumImportantPackets = 0) |
418 | 447 |
419 // media#0 media#1 media#2 media#3 | 448 // media#0 media#1 media#2 media#3 |
420 // fec#0: 1 0 0 0 | 449 // fec#0: 1 0 0 0 |
421 // fec#1: 1 1 0 0 | 450 // fec#1: 1 1 0 0 |
422 // fec#2: 0 1 1 0 | 451 // fec#2: 0 1 1 0 |
423 // fec#3: 0 0 1 1 | 452 // fec#3: 0 0 1 1 |
424 // | 453 // |
425 | 454 |
426 fec_seq_num_ = ConstructMediaPackets(kNumMediaPackets); | 455 this->media_packet_generator_.ConstructMediaPackets(kNumMediaPackets); |
456 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
427 | 457 |
428 EXPECT_EQ(0, fec_.GenerateFec(media_packet_list_, kProtectionFactor, | 458 EXPECT_EQ( |
429 kNumImportantPackets, kUseUnequalProtection, | 459 0, this->fec_.EncodeFec(*this->media_packets_, kProtectionFactor, |
430 webrtc::kFecMaskBursty, &fec_packet_list_)); | 460 kNumImportantPackets, kUseUnequalProtection, |
461 kFecMaskBursty, &this->generated_fec_packets_)); | |
431 | 462 |
432 // Expect 4 FEC packets. | 463 // Expect 4 FEC packets. |
433 EXPECT_EQ(4u, fec_packet_list_.size()); | 464 EXPECT_EQ(4u, this->generated_fec_packets_.size()); |
434 | 465 |
435 // 4 consecutive packets lost: media packets 0,1,2,3. | 466 // 4 consecutive packets lost: media packets 0,1,2,3. |
436 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 467 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
437 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 468 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
438 media_loss_mask_[0] = 1; | 469 this->media_loss_mask_[0] = 1; |
439 media_loss_mask_[1] = 1; | 470 this->media_loss_mask_[1] = 1; |
440 media_loss_mask_[2] = 1; | 471 this->media_loss_mask_[2] = 1; |
441 media_loss_mask_[3] = 1; | 472 this->media_loss_mask_[3] = 1; |
442 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 473 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
443 | 474 |
444 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 475 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
476 &this->recovered_packets_)); | |
445 | 477 |
446 // Expect complete recovery for consecutive packet loss <= 50%. | 478 // Expect complete recovery for consecutive packet loss <= 50%. |
447 EXPECT_TRUE(IsRecoveryComplete()); | 479 EXPECT_TRUE(this->IsRecoveryComplete()); |
448 recovered_packet_list_.clear(); | 480 this->recovered_packets_.clear(); |
449 | 481 |
450 // 4 consecutive packets lost: media packets 1,2, 3, and FEC packet 0. | 482 // 4 consecutive packets lost: media packets 1,2, 3, and FEC packet 0. |
451 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 483 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
452 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 484 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
453 fec_loss_mask_[0] = 1; | 485 this->fec_loss_mask_[0] = 1; |
454 media_loss_mask_[1] = 1; | 486 this->media_loss_mask_[1] = 1; |
455 media_loss_mask_[2] = 1; | 487 this->media_loss_mask_[2] = 1; |
456 media_loss_mask_[3] = 1; | 488 this->media_loss_mask_[3] = 1; |
457 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 489 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
458 | 490 |
459 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 491 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
492 &this->recovered_packets_)); | |
460 | 493 |
461 // Expect complete recovery for consecutive packet loss <= 50%. | 494 // Expect complete recovery for consecutive packet loss <= 50%. |
462 EXPECT_TRUE(IsRecoveryComplete()); | 495 EXPECT_TRUE(this->IsRecoveryComplete()); |
463 recovered_packet_list_.clear(); | 496 this->recovered_packets_.clear(); |
464 | 497 |
465 // 4 packets lost (non-consecutive loss): media packets 0, 3, and FEC# 0, 3. | 498 // 4 packets lost (non-consecutive loss): media packets 0, 3, and FEC# 0, 3. |
466 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 499 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
467 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 500 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
468 fec_loss_mask_[0] = 1; | 501 this->fec_loss_mask_[0] = 1; |
469 fec_loss_mask_[3] = 1; | 502 this->fec_loss_mask_[3] = 1; |
470 media_loss_mask_[0] = 1; | 503 this->media_loss_mask_[0] = 1; |
471 media_loss_mask_[3] = 1; | 504 this->media_loss_mask_[3] = 1; |
472 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 505 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
473 | 506 |
474 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 507 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
508 &this->recovered_packets_)); | |
475 | 509 |
476 // Cannot get complete recovery for this loss configuration. | 510 // Cannot get complete recovery for this loss configuration. |
477 EXPECT_FALSE(IsRecoveryComplete()); | 511 EXPECT_FALSE(this->IsRecoveryComplete()); |
478 } | 512 } |
479 | 513 |
480 TEST_F(RtpFecTest, FecRecoveryNoLossUep) { | 514 TYPED_TEST(RtpFecTest, FecRecoveryNoLossUep) { |
481 constexpr int kNumImportantPackets = 2; | 515 constexpr int kNumImportantPackets = 2; |
482 constexpr bool kUseUnequalProtection = true; | 516 constexpr bool kUseUnequalProtection = true; |
483 constexpr int kNumMediaPackets = 4; | 517 constexpr int kNumMediaPackets = 4; |
484 constexpr uint8_t kProtectionFactor = 60; | 518 constexpr uint8_t kProtectionFactor = 60; |
485 | 519 |
486 fec_seq_num_ = ConstructMediaPackets(kNumMediaPackets); | 520 this->media_packet_generator_.ConstructMediaPackets(kNumMediaPackets); |
521 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
487 | 522 |
488 EXPECT_EQ(0, fec_.GenerateFec(media_packet_list_, kProtectionFactor, | 523 EXPECT_EQ( |
489 kNumImportantPackets, kUseUnequalProtection, | 524 0, this->fec_.EncodeFec(*this->media_packets_, kProtectionFactor, |
490 webrtc::kFecMaskBursty, &fec_packet_list_)); | 525 kNumImportantPackets, kUseUnequalProtection, |
526 kFecMaskBursty, &this->generated_fec_packets_)); | |
491 | 527 |
492 // Expect 1 FEC packet. | 528 // Expect 1 FEC packet. |
493 EXPECT_EQ(1u, fec_packet_list_.size()); | 529 EXPECT_EQ(1u, this->generated_fec_packets_.size()); |
494 | 530 |
495 // No packets lost. | 531 // No packets lost. |
496 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 532 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
497 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 533 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
498 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 534 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
499 | 535 |
500 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 536 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
537 &this->recovered_packets_)); | |
501 | 538 |
502 // No packets lost, expect complete recovery. | 539 // No packets lost, expect complete recovery. |
503 EXPECT_TRUE(IsRecoveryComplete()); | 540 EXPECT_TRUE(this->IsRecoveryComplete()); |
504 } | 541 } |
505 | 542 |
506 TEST_F(RtpFecTest, FecRecoveryWithLossUep) { | 543 TYPED_TEST(RtpFecTest, FecRecoveryWithLossUep) { |
507 constexpr int kNumImportantPackets = 2; | 544 constexpr int kNumImportantPackets = 2; |
508 constexpr bool kUseUnequalProtection = true; | 545 constexpr bool kUseUnequalProtection = true; |
509 constexpr int kNumMediaPackets = 4; | 546 constexpr int kNumMediaPackets = 4; |
510 constexpr uint8_t kProtectionFactor = 60; | 547 constexpr uint8_t kProtectionFactor = 60; |
511 | 548 |
512 fec_seq_num_ = ConstructMediaPackets(kNumMediaPackets); | 549 this->media_packet_generator_.ConstructMediaPackets(kNumMediaPackets); |
550 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
513 | 551 |
514 EXPECT_EQ(0, fec_.GenerateFec(media_packet_list_, kProtectionFactor, | 552 EXPECT_EQ( |
515 kNumImportantPackets, kUseUnequalProtection, | 553 0, this->fec_.EncodeFec(*this->media_packets_, kProtectionFactor, |
516 webrtc::kFecMaskBursty, &fec_packet_list_)); | 554 kNumImportantPackets, kUseUnequalProtection, |
555 kFecMaskBursty, &this->generated_fec_packets_)); | |
517 | 556 |
518 // Expect 1 FEC packet. | 557 // Expect 1 FEC packet. |
519 EXPECT_EQ(1u, fec_packet_list_.size()); | 558 EXPECT_EQ(1u, this->generated_fec_packets_.size()); |
520 | 559 |
521 // 1 media packet lost. | 560 // 1 media packet lost. |
522 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 561 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
523 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 562 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
524 media_loss_mask_[3] = 1; | 563 this->media_loss_mask_[3] = 1; |
525 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 564 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
526 | 565 |
527 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 566 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
567 &this->recovered_packets_)); | |
528 | 568 |
529 // One packet lost, one FEC packet, expect complete recovery. | 569 // One packet lost, one FEC packet, expect complete recovery. |
530 EXPECT_TRUE(IsRecoveryComplete()); | 570 EXPECT_TRUE(this->IsRecoveryComplete()); |
531 recovered_packet_list_.clear(); | 571 this->recovered_packets_.clear(); |
532 | 572 |
533 // 2 media packets lost. | 573 // 2 media packets lost. |
534 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 574 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
535 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 575 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
536 media_loss_mask_[1] = 1; | 576 this->media_loss_mask_[1] = 1; |
537 media_loss_mask_[3] = 1; | 577 this->media_loss_mask_[3] = 1; |
538 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 578 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
539 | 579 |
540 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 580 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
581 &this->recovered_packets_)); | |
541 | 582 |
542 // 2 packets lost, one FEC packet, cannot get complete recovery. | 583 // 2 packets lost, one FEC packet, cannot get complete recovery. |
543 EXPECT_FALSE(IsRecoveryComplete()); | 584 EXPECT_FALSE(this->IsRecoveryComplete()); |
544 } | 585 } |
545 | 586 |
546 // Test 50% protection with random mask type for UEP on. | 587 // Test 50% protection with random mask type for UEP on. |
547 TEST_F(RtpFecTest, FecRecoveryWithLoss50percUepRandomMask) { | 588 TYPED_TEST(RtpFecTest, FecRecoveryWithLoss50percUepRandomMask) { |
548 constexpr int kNumImportantPackets = 1; | 589 constexpr int kNumImportantPackets = 1; |
549 constexpr bool kUseUnequalProtection = true; | 590 constexpr bool kUseUnequalProtection = true; |
550 constexpr int kNumMediaPackets = 4; | 591 constexpr int kNumMediaPackets = 4; |
551 constexpr uint8_t kProtectionFactor = 255; | 592 constexpr uint8_t kProtectionFactor = 255; |
552 | 593 |
553 // Packet Mask for (4,4,1) code, from random mask table. | 594 // Packet Mask for (4,4,1) code, from random mask table. |
554 // (kNumMediaPackets = 4; num_fec_packets = 4, kNumImportantPackets = 1) | 595 // (kNumMediaPackets = 4; num_fec_packets = 4, kNumImportantPackets = 1) |
555 | 596 |
556 // media#0 media#1 media#2 media#3 | 597 // media#0 media#1 media#2 media#3 |
557 // fec#0: 1 0 0 0 | 598 // fec#0: 1 0 0 0 |
558 // fec#1: 1 1 0 0 | 599 // fec#1: 1 1 0 0 |
559 // fec#2: 1 0 1 1 | 600 // fec#2: 1 0 1 1 |
560 // fec#3: 0 1 1 0 | 601 // fec#3: 0 1 1 0 |
561 // | 602 // |
562 | 603 |
563 fec_seq_num_ = ConstructMediaPackets(kNumMediaPackets); | 604 this->media_packet_generator_.ConstructMediaPackets(kNumMediaPackets); |
564 | 605 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); |
565 EXPECT_EQ(0, fec_.GenerateFec(media_packet_list_, kProtectionFactor, | 606 |
566 kNumImportantPackets, kUseUnequalProtection, | 607 EXPECT_EQ( |
567 webrtc::kFecMaskRandom, &fec_packet_list_)); | 608 0, this->fec_.EncodeFec(*this->media_packets_, kProtectionFactor, |
609 kNumImportantPackets, kUseUnequalProtection, | |
610 kFecMaskRandom, &this->generated_fec_packets_)); | |
568 | 611 |
569 // Expect 4 FEC packets. | 612 // Expect 4 FEC packets. |
570 EXPECT_EQ(4u, fec_packet_list_.size()); | 613 EXPECT_EQ(4u, this->generated_fec_packets_.size()); |
571 | 614 |
572 // 4 packets lost: 3 media packets and FEC packet#1 lost. | 615 // 4 packets lost: 3 media packets and FEC packet#1 lost. |
573 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 616 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
574 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 617 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
575 fec_loss_mask_[1] = 1; | 618 this->fec_loss_mask_[1] = 1; |
576 media_loss_mask_[0] = 1; | 619 this->media_loss_mask_[0] = 1; |
577 media_loss_mask_[2] = 1; | 620 this->media_loss_mask_[2] = 1; |
578 media_loss_mask_[3] = 1; | 621 this->media_loss_mask_[3] = 1; |
579 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 622 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
580 | 623 |
581 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 624 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
625 &this->recovered_packets_)); | |
582 | 626 |
583 // With media packet#3 and FEC packets #0, #1, #3, expect complete recovery. | 627 // With media packet#3 and FEC packets #0, #1, #3, expect complete recovery. |
584 EXPECT_TRUE(IsRecoveryComplete()); | 628 EXPECT_TRUE(this->IsRecoveryComplete()); |
585 recovered_packet_list_.clear(); | 629 this->recovered_packets_.clear(); |
586 | 630 |
587 // 5 packets lost: 4 media packets and one FEC packet#2 lost. | 631 // 5 packets lost: 4 media packets and one FEC packet#2 lost. |
588 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 632 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
589 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 633 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
590 fec_loss_mask_[2] = 1; | 634 this->fec_loss_mask_[2] = 1; |
591 media_loss_mask_[0] = 1; | 635 this->media_loss_mask_[0] = 1; |
592 media_loss_mask_[1] = 1; | 636 this->media_loss_mask_[1] = 1; |
593 media_loss_mask_[2] = 1; | 637 this->media_loss_mask_[2] = 1; |
594 media_loss_mask_[3] = 1; | 638 this->media_loss_mask_[3] = 1; |
595 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 639 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
596 | 640 |
597 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 641 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
642 &this->recovered_packets_)); | |
598 | 643 |
599 // Cannot get complete recovery for this loss configuration. | 644 // Cannot get complete recovery for this loss configuration. |
600 EXPECT_FALSE(IsRecoveryComplete()); | 645 EXPECT_FALSE(this->IsRecoveryComplete()); |
601 } | 646 } |
602 | 647 |
603 TEST_F(RtpFecTest, FecRecoveryNonConsecutivePackets) { | 648 TYPED_TEST(RtpFecTest, FecRecoveryNonConsecutivePackets) { |
604 constexpr int kNumImportantPackets = 0; | 649 constexpr int kNumImportantPackets = 0; |
605 constexpr bool kUseUnequalProtection = false; | 650 constexpr bool kUseUnequalProtection = false; |
606 constexpr int kNumMediaPackets = 5; | 651 constexpr int kNumMediaPackets = 5; |
607 constexpr uint8_t kProtectionFactor = 60; | 652 constexpr uint8_t kProtectionFactor = 60; |
608 | 653 |
609 fec_seq_num_ = ConstructMediaPackets(kNumMediaPackets); | 654 this->media_packet_generator_.ConstructMediaPackets(kNumMediaPackets); |
655 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
610 | 656 |
611 // Create a new temporary packet list for generating FEC packets. | 657 // Create a new temporary packet list for generating FEC packets. |
612 // This list should have every other packet removed. | 658 // This list should have every other packet removed. |
613 PacketList protected_media_packets; | 659 ForwardErrorCorrection::PacketList protected_media_packets; |
614 DeepCopyEveryNthPacket(media_packet_list_, 2, &protected_media_packets); | 660 TestFixture::DeepCopyEveryNthPacket(*this->media_packets_, 2, |
615 | 661 &protected_media_packets); |
616 EXPECT_EQ(0, fec_.GenerateFec(protected_media_packets, kProtectionFactor, | 662 |
617 kNumImportantPackets, kUseUnequalProtection, | 663 EXPECT_EQ( |
618 webrtc::kFecMaskBursty, &fec_packet_list_)); | 664 0, this->fec_.EncodeFec(protected_media_packets, kProtectionFactor, |
665 kNumImportantPackets, kUseUnequalProtection, | |
666 kFecMaskBursty, &this->generated_fec_packets_)); | |
619 | 667 |
620 // Expect 1 FEC packet. | 668 // Expect 1 FEC packet. |
621 EXPECT_EQ(1u, fec_packet_list_.size()); | 669 EXPECT_EQ(1u, this->generated_fec_packets_.size()); |
622 | 670 |
623 // 1 protected media packet lost | 671 // 1 protected media packet lost |
624 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 672 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
625 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 673 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
626 media_loss_mask_[2] = 1; | 674 this->media_loss_mask_[2] = 1; |
627 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 675 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
628 | 676 |
629 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 677 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
678 &this->recovered_packets_)); | |
630 | 679 |
631 // One packet lost, one FEC packet, expect complete recovery. | 680 // One packet lost, one FEC packet, expect complete recovery. |
632 EXPECT_TRUE(IsRecoveryComplete()); | 681 EXPECT_TRUE(this->IsRecoveryComplete()); |
633 recovered_packet_list_.clear(); | 682 this->recovered_packets_.clear(); |
634 | 683 |
635 // Unprotected packet lost. | 684 // Unprotected packet lost. |
636 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 685 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
637 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 686 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
638 media_loss_mask_[1] = 1; | 687 this->media_loss_mask_[1] = 1; |
639 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 688 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
640 | 689 |
641 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 690 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
691 &this->recovered_packets_)); | |
642 | 692 |
643 // Unprotected packet lost. Recovery not possible. | 693 // Unprotected packet lost. Recovery not possible. |
644 EXPECT_FALSE(IsRecoveryComplete()); | 694 EXPECT_FALSE(this->IsRecoveryComplete()); |
645 recovered_packet_list_.clear(); | 695 this->recovered_packets_.clear(); |
646 | 696 |
647 // 2 media packets lost. | 697 // 2 media packets lost. |
648 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 698 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
649 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 699 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
650 media_loss_mask_[0] = 1; | 700 this->media_loss_mask_[0] = 1; |
651 media_loss_mask_[2] = 1; | 701 this->media_loss_mask_[2] = 1; |
652 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 702 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
653 | 703 |
654 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 704 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
705 &this->recovered_packets_)); | |
655 | 706 |
656 // 2 protected packets lost, one FEC packet, cannot get complete recovery. | 707 // 2 protected packets lost, one FEC packet, cannot get complete recovery. |
657 EXPECT_FALSE(IsRecoveryComplete()); | 708 EXPECT_FALSE(this->IsRecoveryComplete()); |
658 } | 709 } |
659 | 710 |
660 TEST_F(RtpFecTest, FecRecoveryNonConsecutivePacketsExtension) { | 711 TYPED_TEST(RtpFecTest, FecRecoveryNonConsecutivePacketsExtension) { |
661 constexpr int kNumImportantPackets = 0; | 712 constexpr int kNumImportantPackets = 0; |
662 constexpr bool kUseUnequalProtection = false; | 713 constexpr bool kUseUnequalProtection = false; |
663 constexpr int kNumMediaPackets = 21; | 714 constexpr int kNumMediaPackets = 21; |
664 uint8_t kProtectionFactor = 127; | 715 uint8_t kProtectionFactor = 127; |
665 | 716 |
666 fec_seq_num_ = ConstructMediaPackets(kNumMediaPackets); | 717 this->media_packet_generator_.ConstructMediaPackets(kNumMediaPackets); |
718 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
667 | 719 |
668 // Create a new temporary packet list for generating FEC packets. | 720 // Create a new temporary packet list for generating FEC packets. |
669 // This list should have every other packet removed. | 721 // This list should have every other packet removed. |
670 PacketList protected_media_packets; | 722 ForwardErrorCorrection::PacketList protected_media_packets; |
671 DeepCopyEveryNthPacket(media_packet_list_, 2, &protected_media_packets); | 723 TestFixture::DeepCopyEveryNthPacket(*this->media_packets_, 2, |
724 &protected_media_packets); | |
672 | 725 |
673 // Zero column insertion will have to extend the size of the packet | 726 // Zero column insertion will have to extend the size of the packet |
674 // mask since the number of actual packets are 21, while the number | 727 // mask since the number of actual packets are 21, while the number |
675 // of protected packets are 11. | 728 // of protected packets are 11. |
676 EXPECT_EQ(0, fec_.GenerateFec(protected_media_packets, kProtectionFactor, | 729 EXPECT_EQ( |
677 kNumImportantPackets, kUseUnequalProtection, | 730 0, this->fec_.EncodeFec(protected_media_packets, kProtectionFactor, |
678 webrtc::kFecMaskBursty, &fec_packet_list_)); | 731 kNumImportantPackets, kUseUnequalProtection, |
732 kFecMaskBursty, &this->generated_fec_packets_)); | |
679 | 733 |
680 // Expect 5 FEC packet. | 734 // Expect 5 FEC packet. |
681 EXPECT_EQ(5u, fec_packet_list_.size()); | 735 EXPECT_EQ(5u, this->generated_fec_packets_.size()); |
682 | 736 |
683 // Last protected media packet lost | 737 // Last protected media packet lost |
684 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 738 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
685 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 739 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
686 media_loss_mask_[kNumMediaPackets - 1] = 1; | 740 this->media_loss_mask_[kNumMediaPackets - 1] = 1; |
687 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 741 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
688 | 742 |
689 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 743 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
744 &this->recovered_packets_)); | |
690 | 745 |
691 // One packet lost, one FEC packet, expect complete recovery. | 746 // One packet lost, one FEC packet, expect complete recovery. |
692 EXPECT_TRUE(IsRecoveryComplete()); | 747 EXPECT_TRUE(this->IsRecoveryComplete()); |
693 recovered_packet_list_.clear(); | 748 this->recovered_packets_.clear(); |
694 | 749 |
695 // Last unprotected packet lost. | 750 // Last unprotected packet lost. |
696 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 751 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
697 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 752 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
698 media_loss_mask_[kNumMediaPackets - 2] = 1; | 753 this->media_loss_mask_[kNumMediaPackets - 2] = 1; |
699 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 754 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
700 | 755 |
701 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 756 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
757 &this->recovered_packets_)); | |
702 | 758 |
703 // Unprotected packet lost. Recovery not possible. | 759 // Unprotected packet lost. Recovery not possible. |
704 EXPECT_FALSE(IsRecoveryComplete()); | 760 EXPECT_FALSE(this->IsRecoveryComplete()); |
705 recovered_packet_list_.clear(); | 761 this->recovered_packets_.clear(); |
706 | 762 |
707 // 6 media packets lost. | 763 // 6 media packets lost. |
708 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 764 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
709 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 765 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
710 media_loss_mask_[kNumMediaPackets - 11] = 1; | 766 this->media_loss_mask_[kNumMediaPackets - 11] = 1; |
711 media_loss_mask_[kNumMediaPackets - 9] = 1; | 767 this->media_loss_mask_[kNumMediaPackets - 9] = 1; |
712 media_loss_mask_[kNumMediaPackets - 7] = 1; | 768 this->media_loss_mask_[kNumMediaPackets - 7] = 1; |
713 media_loss_mask_[kNumMediaPackets - 5] = 1; | 769 this->media_loss_mask_[kNumMediaPackets - 5] = 1; |
714 media_loss_mask_[kNumMediaPackets - 3] = 1; | 770 this->media_loss_mask_[kNumMediaPackets - 3] = 1; |
715 media_loss_mask_[kNumMediaPackets - 1] = 1; | 771 this->media_loss_mask_[kNumMediaPackets - 1] = 1; |
716 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 772 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
717 | 773 |
718 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 774 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
775 &this->recovered_packets_)); | |
719 | 776 |
720 // 5 protected packets lost, one FEC packet, cannot get complete recovery. | 777 // 5 protected packets lost, one FEC packet, cannot get complete recovery. |
721 EXPECT_FALSE(IsRecoveryComplete()); | 778 EXPECT_FALSE(this->IsRecoveryComplete()); |
722 } | 779 } |
723 | 780 |
724 TEST_F(RtpFecTest, FecRecoveryNonConsecutivePacketsWrap) { | 781 TYPED_TEST(RtpFecTest, FecRecoveryNonConsecutivePacketsWrap) { |
725 constexpr int kNumImportantPackets = 0; | 782 constexpr int kNumImportantPackets = 0; |
726 constexpr bool kUseUnequalProtection = false; | 783 constexpr bool kUseUnequalProtection = false; |
727 constexpr int kNumMediaPackets = 21; | 784 constexpr int kNumMediaPackets = 21; |
728 uint8_t kProtectionFactor = 127; | 785 uint8_t kProtectionFactor = 127; |
729 | 786 |
730 fec_seq_num_ = ConstructMediaPacketsSeqNum(kNumMediaPackets, 0xFFFF - 5); | 787 this->media_packet_generator_.ConstructMediaPacketsSeqNum(kNumMediaPackets, |
788 0xFFFF - 5); | |
789 this->media_packets_ = this->media_packet_generator_.GetMediaPackets(); | |
731 | 790 |
732 // Create a new temporary packet list for generating FEC packets. | 791 // Create a new temporary packet list for generating FEC packets. |
733 // This list should have every other packet removed. | 792 // This list should have every other packet removed. |
734 PacketList protected_media_packets; | 793 ForwardErrorCorrection::PacketList protected_media_packets; |
735 DeepCopyEveryNthPacket(media_packet_list_, 2, &protected_media_packets); | 794 TestFixture::DeepCopyEveryNthPacket(*this->media_packets_, 2, |
795 &protected_media_packets); | |
736 | 796 |
737 // Zero column insertion will have to extend the size of the packet | 797 // Zero column insertion will have to extend the size of the packet |
738 // mask since the number of actual packets are 21, while the number | 798 // mask since the number of actual packets are 21, while the number |
739 // of protected packets are 11. | 799 // of protected packets are 11. |
740 EXPECT_EQ(0, fec_.GenerateFec(protected_media_packets, kProtectionFactor, | 800 EXPECT_EQ( |
741 kNumImportantPackets, kUseUnequalProtection, | 801 0, this->fec_.EncodeFec(protected_media_packets, kProtectionFactor, |
742 webrtc::kFecMaskBursty, &fec_packet_list_)); | 802 kNumImportantPackets, kUseUnequalProtection, |
803 kFecMaskBursty, &this->generated_fec_packets_)); | |
743 | 804 |
744 // Expect 5 FEC packet. | 805 // Expect 5 FEC packet. |
745 EXPECT_EQ(5u, fec_packet_list_.size()); | 806 EXPECT_EQ(5u, this->generated_fec_packets_.size()); |
746 | 807 |
747 // Last protected media packet lost | 808 // Last protected media packet lost |
748 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 809 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
749 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 810 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
750 media_loss_mask_[kNumMediaPackets - 1] = 1; | 811 this->media_loss_mask_[kNumMediaPackets - 1] = 1; |
751 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 812 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
752 | 813 |
753 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 814 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
815 &this->recovered_packets_)); | |
754 | 816 |
755 // One packet lost, one FEC packet, expect complete recovery. | 817 // One packet lost, one FEC packet, expect complete recovery. |
756 EXPECT_TRUE(IsRecoveryComplete()); | 818 EXPECT_TRUE(this->IsRecoveryComplete()); |
757 recovered_packet_list_.clear(); | 819 this->recovered_packets_.clear(); |
758 | 820 |
759 // Last unprotected packet lost. | 821 // Last unprotected packet lost. |
760 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 822 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
761 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 823 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
762 media_loss_mask_[kNumMediaPackets - 2] = 1; | 824 this->media_loss_mask_[kNumMediaPackets - 2] = 1; |
763 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 825 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
764 | 826 |
765 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 827 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
828 &this->recovered_packets_)); | |
766 | 829 |
767 // Unprotected packet lost. Recovery not possible. | 830 // Unprotected packet lost. Recovery not possible. |
768 EXPECT_FALSE(IsRecoveryComplete()); | 831 EXPECT_FALSE(this->IsRecoveryComplete()); |
769 recovered_packet_list_.clear(); | 832 this->recovered_packets_.clear(); |
770 | 833 |
771 // 6 media packets lost. | 834 // 6 media packets lost. |
772 memset(media_loss_mask_, 0, sizeof(media_loss_mask_)); | 835 memset(this->media_loss_mask_, 0, sizeof(this->media_loss_mask_)); |
773 memset(fec_loss_mask_, 0, sizeof(fec_loss_mask_)); | 836 memset(this->fec_loss_mask_, 0, sizeof(this->fec_loss_mask_)); |
774 media_loss_mask_[kNumMediaPackets - 11] = 1; | 837 this->media_loss_mask_[kNumMediaPackets - 11] = 1; |
775 media_loss_mask_[kNumMediaPackets - 9] = 1; | 838 this->media_loss_mask_[kNumMediaPackets - 9] = 1; |
776 media_loss_mask_[kNumMediaPackets - 7] = 1; | 839 this->media_loss_mask_[kNumMediaPackets - 7] = 1; |
777 media_loss_mask_[kNumMediaPackets - 5] = 1; | 840 this->media_loss_mask_[kNumMediaPackets - 5] = 1; |
778 media_loss_mask_[kNumMediaPackets - 3] = 1; | 841 this->media_loss_mask_[kNumMediaPackets - 3] = 1; |
779 media_loss_mask_[kNumMediaPackets - 1] = 1; | 842 this->media_loss_mask_[kNumMediaPackets - 1] = 1; |
780 NetworkReceivedPackets(media_loss_mask_, fec_loss_mask_); | 843 this->NetworkReceivedPackets(this->media_loss_mask_, this->fec_loss_mask_); |
781 | 844 |
782 EXPECT_EQ(0, fec_.DecodeFec(&received_packet_list_, &recovered_packet_list_)); | 845 EXPECT_EQ(0, this->fec_.DecodeFec(&this->received_packets_, |
846 &this->recovered_packets_)); | |
783 | 847 |
784 // 5 protected packets lost, one FEC packet, cannot get complete recovery. | 848 // 5 protected packets lost, one FEC packet, cannot get complete recovery. |
785 EXPECT_FALSE(IsRecoveryComplete()); | 849 EXPECT_FALSE(this->IsRecoveryComplete()); |
786 } | 850 } |
787 | 851 |
788 void RtpFecTest::TearDown() { | 852 template <typename ForwardErrorCorrectionType> |
789 fec_.ResetState(&recovered_packet_list_); | 853 bool RtpFecTest<ForwardErrorCorrectionType>::IsRecoveryComplete() { |
790 recovered_packet_list_.clear(); | |
791 media_packet_list_.clear(); | |
792 EXPECT_TRUE(media_packet_list_.empty()); | |
793 } | |
794 | |
795 bool RtpFecTest::IsRecoveryComplete() { | |
796 // We must have equally many recovered packets as original packets. | 854 // We must have equally many recovered packets as original packets. |
797 if (recovered_packet_list_.size() != media_packet_list_.size()) { | 855 if (recovered_packets_.size() != media_packets_->size()) { |
798 return false; | 856 return false; |
799 } | 857 } |
800 | 858 |
801 // All recovered packets must be identical to the corresponding | 859 // All recovered packets must be identical to the corresponding |
802 // original packets. | 860 // original packets. |
803 using PacketPtr = std::unique_ptr<ForwardErrorCorrection::Packet>; | 861 using PacketPtr = std::unique_ptr<ForwardErrorCorrection::Packet>; |
804 using RecoveredPacketPtr = | 862 using RecoveredPacketPtr = |
805 std::unique_ptr<ForwardErrorCorrection::RecoveredPacket>; | 863 std::unique_ptr<ForwardErrorCorrection::RecoveredPacket>; |
806 auto cmp = [](const PacketPtr& media_packet, | 864 auto cmp = [](const PacketPtr& media_packet, |
807 const RecoveredPacketPtr& recovered_packet) { | 865 const RecoveredPacketPtr& recovered_packet) { |
808 if (media_packet->length != recovered_packet->pkt->length) { | 866 if (media_packet->length != recovered_packet->pkt->length) { |
809 return false; | 867 return false; |
810 } | 868 } |
811 if (memcmp(media_packet->data, | 869 if (memcmp(media_packet->data, |
812 recovered_packet->pkt->data, | 870 recovered_packet->pkt->data, |
813 media_packet->length) != 0) { | 871 media_packet->length) != 0) { |
814 return false; | 872 return false; |
815 } | 873 } |
816 return true; | 874 return true; |
817 }; | 875 }; |
818 return std::equal(media_packet_list_.cbegin(), media_packet_list_.cend(), | 876 return std::equal(media_packets_->cbegin(), media_packets_->cend(), |
819 recovered_packet_list_.cbegin(), cmp); | 877 recovered_packets_.cbegin(), cmp); |
820 } | 878 } |
821 | 879 |
822 void RtpFecTest::NetworkReceivedPackets(int* media_loss_mask, | 880 template <typename ForwardErrorCorrectionType> |
823 int* fec_loss_mask) { | 881 void RtpFecTest<ForwardErrorCorrectionType>::NetworkReceivedPackets( |
882 int* media_loss_mask, | |
883 int* fec_loss_mask) { | |
824 constexpr bool kFecPacket = true; | 884 constexpr bool kFecPacket = true; |
825 ReceivedPackets(media_packet_list_, media_loss_mask, !kFecPacket); | 885 ReceivedPackets(*media_packets_, media_loss_mask, !kFecPacket); |
826 ReceivedPackets(fec_packet_list_, fec_loss_mask, kFecPacket); | 886 ReceivedPackets(generated_fec_packets_, fec_loss_mask, kFecPacket); |
827 } | 887 } |
828 | 888 |
829 template <typename T> | 889 template <typename ForwardErrorCorrectionType> |
830 void RtpFecTest::ReceivedPackets(const T& packet_list, int* loss_mask, | 890 template <typename PacketListType> |
831 bool is_fec) { | 891 void RtpFecTest<ForwardErrorCorrectionType>::ReceivedPackets( |
832 int seq_num = fec_seq_num_; | 892 const PacketListType& packet_list, |
893 int* loss_mask, | |
894 bool is_fec) { | |
895 uint16_t fec_seq_num = media_packet_generator_.GetFecSeqNum(); | |
896 uint32_t ssrc = media_packet_generator_.GetSsrc(); | |
833 int packet_idx = 0; | 897 int packet_idx = 0; |
834 | 898 |
835 for (const auto& packet : packet_list) { | 899 for (const auto& packet : packet_list) { |
836 if (loss_mask[packet_idx] == 0) { | 900 if (loss_mask[packet_idx] == 0) { |
837 std::unique_ptr<ForwardErrorCorrection::ReceivedPacket> received_packet( | 901 std::unique_ptr<ForwardErrorCorrection::ReceivedPacket> received_packet( |
838 new ForwardErrorCorrection::ReceivedPacket()); | 902 new ForwardErrorCorrection::ReceivedPacket()); |
839 received_packet->pkt = new ForwardErrorCorrection::Packet(); | 903 received_packet->pkt = new ForwardErrorCorrection::Packet(); |
840 received_packet->pkt->length = packet->length; | 904 received_packet->pkt->length = packet->length; |
841 memcpy(received_packet->pkt->data, packet->data, packet->length); | 905 memcpy(received_packet->pkt->data, packet->data, packet->length); |
842 received_packet->is_fec = is_fec; | 906 received_packet->is_fec = is_fec; |
843 if (!is_fec) { | 907 if (!is_fec) { |
844 // For media packets, the sequence number and marker bit is | 908 // For media packets, the sequence number and marker bit is |
845 // obtained from RTP header. These were set in ConstructMediaPackets(). | 909 // obtained from RTP header. These were set in ConstructMediaPackets(). |
846 received_packet->seq_num = | 910 received_packet->seq_num = |
847 webrtc::ByteReader<uint16_t>::ReadBigEndian(&packet->data[2]); | 911 ByteReader<uint16_t>::ReadBigEndian(&packet->data[2]); |
848 } else { | 912 } else { |
849 // The sequence number, marker bit, and ssrc number are defined in the | 913 // The sequence number, marker bit, and ssrc number are defined in the |
850 // RTP header of the FEC packet, which is not constructed in this test. | 914 // RTP header of the FEC packet, which is not constructed in this test. |
851 // So we set these values below based on the values generated in | 915 // So we set these values below based on the values generated in |
852 // ConstructMediaPackets(). | 916 // ConstructMediaPackets(). |
853 received_packet->seq_num = seq_num; | 917 received_packet->seq_num = fec_seq_num; |
854 // The ssrc value for FEC packets is set to the one used for the | 918 // The ssrc value for FEC packets is set to the one used for the |
855 // media packets in ConstructMediaPackets(). | 919 // media packets in ConstructMediaPackets(). |
856 received_packet->ssrc = ssrc_; | 920 received_packet->ssrc = ssrc; |
857 } | 921 } |
858 received_packet_list_.push_back(std::move(received_packet)); | 922 received_packets_.push_back(std::move(received_packet)); |
859 } | 923 } |
860 packet_idx++; | 924 packet_idx++; |
861 // Sequence number of FEC packets are defined as increment by 1 from | 925 // Sequence number of FEC packets are defined as increment by 1 from |
862 // last media packet in frame. | 926 // last media packet in frame. |
863 if (is_fec) seq_num++; | 927 if (is_fec) |
928 fec_seq_num++; | |
864 } | 929 } |
865 } | 930 } |
866 | 931 |
867 int RtpFecTest::ConstructMediaPacketsSeqNum(int num_media_packets, | 932 template <typename ForwardErrorCorrectionType> |
868 int start_seq_num) { | 933 void RtpFecTest<ForwardErrorCorrectionType>::DeepCopyEveryNthPacket( |
danilchap
2016/08/23 13:08:50
does it need to be templated or member of the RtpF
brandtr
2016/08/23 14:05:07
Done.
| |
869 RTC_DCHECK_GT(num_media_packets, 0); | 934 const ForwardErrorCorrection::PacketList& src, |
danilchap
2016/08/23 13:08:50
if you expect PacketList would be different for di
brandtr
2016/08/23 14:05:07
Nope, the PacketList will always be the same type.
| |
870 int sequence_number = start_seq_num; | 935 int n, |
871 int time_stamp = random_.Rand<int>(); | 936 ForwardErrorCorrection::PacketList* dst) { |
872 | |
873 for (int i = 0; i < num_media_packets; ++i) { | |
874 std::unique_ptr<ForwardErrorCorrection::Packet> media_packet( | |
875 new ForwardErrorCorrection::Packet()); | |
876 constexpr uint32_t kMinPacketSize = kRtpHeaderSize; | |
877 const uint32_t kMaxPacketSize = IP_PACKET_SIZE - kRtpHeaderSize - | |
878 kTransportOverhead - | |
879 fec_.MaxPacketOverhead(); | |
880 media_packet->length = random_.Rand(kMinPacketSize, kMaxPacketSize); | |
881 | |
882 // Generate random values for the first 2 bytes | |
883 media_packet->data[0] = random_.Rand<uint8_t>(); | |
884 media_packet->data[1] = random_.Rand<uint8_t>(); | |
885 | |
886 // The first two bits are assumed to be 10 by the FEC encoder. | |
887 // In fact the FEC decoder will set the two first bits to 10 regardless of | |
888 // what they actually were. Set the first two bits to 10 so that a memcmp | |
889 // can be performed for the whole restored packet. | |
890 media_packet->data[0] |= 0x80; | |
891 media_packet->data[0] &= 0xbf; | |
892 | |
893 // FEC is applied to a whole frame. | |
894 // A frame is signaled by multiple packets without the marker bit set | |
895 // followed by the last packet of the frame for which the marker bit is set. | |
896 // Only push one (fake) frame to the FEC. | |
897 media_packet->data[1] &= 0x7f; | |
898 | |
899 webrtc::ByteWriter<uint16_t>::WriteBigEndian(&media_packet->data[2], | |
900 sequence_number); | |
901 webrtc::ByteWriter<uint32_t>::WriteBigEndian(&media_packet->data[4], | |
902 time_stamp); | |
903 webrtc::ByteWriter<uint32_t>::WriteBigEndian(&media_packet->data[8], ssrc_); | |
904 | |
905 // Generate random values for payload. | |
906 for (size_t j = 12; j < media_packet->length; ++j) { | |
907 media_packet->data[j] = random_.Rand<uint8_t>(); | |
908 } | |
909 sequence_number++; | |
910 media_packet_list_.push_back(std::move(media_packet)); | |
911 } | |
912 // Last packet, set marker bit. | |
913 ForwardErrorCorrection::Packet* media_packet = | |
914 media_packet_list_.back().get(); | |
915 RTC_DCHECK(media_packet); | |
916 media_packet->data[1] |= 0x80; | |
917 return sequence_number; | |
918 } | |
919 | |
920 int RtpFecTest::ConstructMediaPackets(int num_media_packets) { | |
921 return ConstructMediaPacketsSeqNum(num_media_packets, random_.Rand<int>()); | |
922 } | |
923 | |
924 void RtpFecTest::DeepCopyEveryNthPacket(const PacketList& src, int n, | |
925 PacketList* dst) { | |
926 RTC_DCHECK_GT(n, 0); | 937 RTC_DCHECK_GT(n, 0); |
927 int i = 0; | 938 int i = 0; |
928 for (const auto& packet : src) { | 939 for (const auto& packet : src) { |
929 if (i % n == 0) { | 940 if (i % n == 0) { |
930 dst->emplace_back(new ForwardErrorCorrection::Packet(*packet)); | 941 dst->emplace_back(new ForwardErrorCorrection::Packet(*packet)); |
931 } | 942 } |
932 ++i; | 943 ++i; |
933 } | 944 } |
934 } | 945 } |
946 | |
947 } // namespace webrtc | |
OLD | NEW |