OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 int ForwardErrorCorrection::EncodeFec(const PacketList& media_packets, | 97 int ForwardErrorCorrection::EncodeFec(const PacketList& media_packets, |
98 uint8_t protection_factor, | 98 uint8_t protection_factor, |
99 int num_important_packets, | 99 int num_important_packets, |
100 bool use_unequal_protection, | 100 bool use_unequal_protection, |
101 FecMaskType fec_mask_type, | 101 FecMaskType fec_mask_type, |
102 std::list<Packet*>* fec_packets) { | 102 std::list<Packet*>* fec_packets) { |
103 const size_t num_media_packets = media_packets.size(); | 103 const size_t num_media_packets = media_packets.size(); |
104 | 104 |
105 // Sanity check arguments. | 105 // Sanity check arguments. |
106 RTC_DCHECK_GT(num_media_packets, 0u); | 106 RTC_DCHECK_GT(num_media_packets, 0); |
107 RTC_DCHECK_GE(num_important_packets, 0); | 107 RTC_DCHECK_GE(num_important_packets, 0); |
108 RTC_DCHECK_LE(static_cast<size_t>(num_important_packets), num_media_packets); | 108 RTC_DCHECK_LE(static_cast<size_t>(num_important_packets), num_media_packets); |
109 RTC_DCHECK(fec_packets->empty()); | 109 RTC_DCHECK(fec_packets->empty()); |
110 const size_t max_media_packets = fec_header_writer_->MaxMediaPackets(); | 110 const size_t max_media_packets = fec_header_writer_->MaxMediaPackets(); |
111 if (num_media_packets > max_media_packets) { | 111 if (num_media_packets > max_media_packets) { |
112 LOG(LS_WARNING) << "Can't protect " << num_media_packets | 112 LOG(LS_WARNING) << "Can't protect " << num_media_packets |
113 << " media packets per frame. Max is " << max_media_packets | 113 << " media packets per frame. Max is " << max_media_packets |
114 << "."; | 114 << "."; |
115 return -1; | 115 return -1; |
116 } | 116 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 } | 232 } |
233 media_packets_it++; | 233 media_packets_it++; |
234 if (media_packets_it != media_packets.end()) { | 234 if (media_packets_it != media_packets.end()) { |
235 uint16_t seq_num = ParseSequenceNumber((*media_packets_it)->data); | 235 uint16_t seq_num = ParseSequenceNumber((*media_packets_it)->data); |
236 media_pkt_idx += static_cast<uint16_t>(seq_num - prev_seq_num); | 236 media_pkt_idx += static_cast<uint16_t>(seq_num - prev_seq_num); |
237 prev_seq_num = seq_num; | 237 prev_seq_num = seq_num; |
238 } | 238 } |
239 pkt_mask_idx += media_pkt_idx / 8; | 239 pkt_mask_idx += media_pkt_idx / 8; |
240 media_pkt_idx %= 8; | 240 media_pkt_idx %= 8; |
241 } | 241 } |
242 RTC_DCHECK_GT(fec_packet->length, 0u) | 242 RTC_DCHECK_GT(fec_packet->length, 0) |
243 << "Packet mask is wrong or poorly designed."; | 243 << "Packet mask is wrong or poorly designed."; |
244 } | 244 } |
245 } | 245 } |
246 | 246 |
247 int ForwardErrorCorrection::InsertZerosInPacketMasks( | 247 int ForwardErrorCorrection::InsertZerosInPacketMasks( |
248 const PacketList& media_packets, | 248 const PacketList& media_packets, |
249 size_t num_fec_packets) { | 249 size_t num_fec_packets) { |
250 size_t num_media_packets = media_packets.size(); | 250 size_t num_media_packets = media_packets.size(); |
251 if (num_media_packets <= 1) { | 251 if (num_media_packets <= 1) { |
252 return num_media_packets; | 252 return num_media_packets; |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 | 736 |
737 size_t FecHeaderWriter::MaxFecPackets() const { | 737 size_t FecHeaderWriter::MaxFecPackets() const { |
738 return max_fec_packets_; | 738 return max_fec_packets_; |
739 } | 739 } |
740 | 740 |
741 size_t FecHeaderWriter::MaxPacketOverhead() const { | 741 size_t FecHeaderWriter::MaxPacketOverhead() const { |
742 return max_packet_overhead_; | 742 return max_packet_overhead_; |
743 } | 743 } |
744 | 744 |
745 } // namespace webrtc | 745 } // namespace webrtc |
OLD | NEW |