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

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

Issue 2267393002: Generalize FEC unit tests and rename GenerateFec. (pt. 3) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@header_reader_writer-pt2-producer_fec_mini_fixes
Patch Set: Rebase. Created 4 years, 4 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // Output packet 87 // Output packet
88 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 88 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
89 // | FEC Header (10 octets) | 89 // | FEC Header (10 octets) |
90 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 90 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
91 // | FEC Level 0 Header | 91 // | FEC Level 0 Header |
92 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 92 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
93 // | FEC Level 0 Payload | 93 // | FEC Level 0 Payload |
94 // | | 94 // | |
95 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 95 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
96 // 96 //
97 // Note that any potential RED headers are added/removed before calling 97 int ForwardErrorCorrection::EncodeFec(const PacketList& media_packets,
98 // GenerateFec() or DecodeFec(). 98 uint8_t protection_factor,
99 int ForwardErrorCorrection::GenerateFec(const PacketList& media_packets, 99 int num_important_packets,
100 uint8_t protection_factor, 100 bool use_unequal_protection,
101 int num_important_packets, 101 FecMaskType fec_mask_type,
102 bool use_unequal_protection, 102 std::list<Packet*>* fec_packets) {
103 FecMaskType fec_mask_type, 103 const size_t num_media_packets = media_packets.size();
104 std::list<Packet*>* fec_packets) { 104
105 const uint16_t num_media_packets = media_packets.size();
106 // Sanity check arguments. 105 // Sanity check arguments.
107 RTC_DCHECK_GT(num_media_packets, 0); 106 RTC_DCHECK_GT(num_media_packets, 0u);
108 RTC_DCHECK_GE(num_important_packets, 0); 107 RTC_DCHECK_GE(num_important_packets, 0);
109 RTC_DCHECK_LE(num_important_packets, num_media_packets); 108 RTC_DCHECK_LE(static_cast<size_t>(num_important_packets), num_media_packets);
danilchap 2016/08/23 13:08:50 may be instead change num_important_packets type t
brandtr 2016/08/23 14:05:07 I would like to, but it also propagates into inter
110 RTC_DCHECK(fec_packets->empty()); 109 RTC_DCHECK(fec_packets->empty());
111 110
112 if (num_media_packets > kMaxMediaPackets) { 111 if (num_media_packets > kMaxMediaPackets) {
113 LOG(LS_WARNING) << "Can't protect " << num_media_packets 112 LOG(LS_WARNING) << "Can't protect " << num_media_packets
114 << " media packets per frame. Max is " << kMaxMediaPackets 113 << " media packets per frame. Max is " << kMaxMediaPackets
115 << "."; 114 << ".";
116 return -1; 115 return -1;
117 } 116 }
118 117
119 bool l_bit = (num_media_packets > 8 * kMaskSizeLBitClear); 118 bool l_bit = (num_media_packets > 8 * kMaskSizeLBitClear);
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 } 769 }
771 InsertPackets(received_packets, recovered_packets); 770 InsertPackets(received_packets, recovered_packets);
772 AttemptRecover(recovered_packets); 771 AttemptRecover(recovered_packets);
773 return 0; 772 return 0;
774 } 773 }
775 774
776 size_t ForwardErrorCorrection::MaxPacketOverhead() const { 775 size_t ForwardErrorCorrection::MaxPacketOverhead() const {
777 return kFecHeaderSize + kUlpHeaderSizeLBitSet; 776 return kFecHeaderSize + kUlpHeaderSizeLBitSet;
778 } 777 }
779 } // namespace webrtc 778 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698