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

Side by Side Diff: modules/rtp_rtcp/source/ulpfec_receiver_impl.cc

Issue 3012243002: Change ForwardErrorCorrection class to accept one received packet at a time. (Closed)
Patch Set: Rebased. Created 3 years, 3 months 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) 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 return 0; 209 return 0;
210 } 210 }
211 211
212 received_packets_.push_back(std::move(received_packet)); 212 received_packets_.push_back(std::move(received_packet));
213 if (second_received_packet) { 213 if (second_received_packet) {
214 received_packets_.push_back(std::move(second_received_packet)); 214 received_packets_.push_back(std::move(second_received_packet));
215 } 215 }
216 return 0; 216 return 0;
217 } 217 }
218 218
219 // TODO(nisse): Drop always-zero return value.
219 int32_t UlpfecReceiverImpl::ProcessReceivedFec() { 220 int32_t UlpfecReceiverImpl::ProcessReceivedFec() {
220 crit_sect_.Enter(); 221 crit_sect_.Enter();
221 if (!received_packets_.empty()) { 222 for (const auto& received_packet : received_packets_) {
222 // Send received media packet to VCM. 223 // Send received media packet to VCM.
223 if (!received_packets_.front()->is_fec) { 224 if (!received_packet->is_fec) {
224 ForwardErrorCorrection::Packet* packet = received_packets_.front()->pkt; 225 ForwardErrorCorrection::Packet* packet = received_packet->pkt;
225 crit_sect_.Leave(); 226 crit_sect_.Leave();
226 recovered_packet_callback_->OnRecoveredPacket(packet->data, 227 recovered_packet_callback_->OnRecoveredPacket(packet->data,
227 packet->length); 228 packet->length);
228 crit_sect_.Enter(); 229 crit_sect_.Enter();
229 } 230 }
230 if (fec_->DecodeFec(&received_packets_, &recovered_packets_) != 0) { 231 fec_->DecodeFec(*received_packet, &recovered_packets_);
231 crit_sect_.Leave();
232 return -1;
233 }
234 RTC_DCHECK(received_packets_.empty());
235 } 232 }
233 received_packets_.clear();
234
236 // Send any recovered media packets to VCM. 235 // Send any recovered media packets to VCM.
237 for (const auto& recovered_packet : recovered_packets_) { 236 for (const auto& recovered_packet : recovered_packets_) {
238 if (recovered_packet->returned) { 237 if (recovered_packet->returned) {
239 // Already sent to the VCM and the jitter buffer. 238 // Already sent to the VCM and the jitter buffer.
240 continue; 239 continue;
241 } 240 }
242 ForwardErrorCorrection::Packet* packet = recovered_packet->pkt; 241 ForwardErrorCorrection::Packet* packet = recovered_packet->pkt;
243 ++packet_counter_.num_recovered_packets; 242 ++packet_counter_.num_recovered_packets;
244 // Set this flag first; in case the recovered packet carries a RED 243 // Set this flag first; in case the recovered packet carries a RED
245 // header, OnRecoveredPacket will recurse back here. 244 // header, OnRecoveredPacket will recurse back here.
246 recovered_packet->returned = true; 245 recovered_packet->returned = true;
247 crit_sect_.Leave(); 246 crit_sect_.Leave();
248 recovered_packet_callback_->OnRecoveredPacket(packet->data, 247 recovered_packet_callback_->OnRecoveredPacket(packet->data,
249 packet->length); 248 packet->length);
250 crit_sect_.Enter(); 249 crit_sect_.Enter();
251 } 250 }
252 crit_sect_.Leave(); 251 crit_sect_.Leave();
253 return 0; 252 return 0;
254 } 253 }
255 254
256 } // namespace webrtc 255 } // namespace webrtc
OLDNEW
« no previous file with comments | « modules/rtp_rtcp/source/ulpfec_receiver_impl.h ('k') | modules/rtp_rtcp/test/testFec/test_fec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698