| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 RedPacket::RedPacket(size_t length) | 50 RedPacket::RedPacket(size_t length) |
| 51 : data_(new uint8_t[length]), | 51 : data_(new uint8_t[length]), |
| 52 length_(length), | 52 length_(length), |
| 53 header_length_(0) { | 53 header_length_(0) { |
| 54 } | 54 } |
| 55 | 55 |
| 56 void RedPacket::CreateHeader(const uint8_t* rtp_header, | 56 void RedPacket::CreateHeader(const uint8_t* rtp_header, |
| 57 size_t header_length, | 57 size_t header_length, |
| 58 int red_payload_type, | 58 int red_payload_type, |
| 59 int payload_type) { | 59 int payload_type) { |
| 60 RTC_DCHECK_LT(header_length + kRedForFecHeaderLength, length_); | 60 RTC_DCHECK_LE(header_length + kRedForFecHeaderLength, length_); |
| 61 memcpy(data_.get(), rtp_header, header_length); | 61 memcpy(data_.get(), rtp_header, header_length); |
| 62 // Replace payload type. | 62 // Replace payload type. |
| 63 data_[1] &= 0x80; | 63 data_[1] &= 0x80; |
| 64 data_[1] += red_payload_type; | 64 data_[1] += red_payload_type; |
| 65 // Add RED header | 65 // Add RED header |
| 66 // f-bit always 0 | 66 // f-bit always 0 |
| 67 data_[header_length] = static_cast<uint8_t>(payload_type); | 67 data_[header_length] = static_cast<uint8_t>(payload_type); |
| 68 header_length_ = header_length + kRedForFecHeaderLength; | 68 header_length_ = header_length + kRedForFecHeaderLength; |
| 69 } | 69 } |
| 70 | 70 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 fec_->GetNumberOfFecPackets(media_packets_.size(), params_.fec_rate); | 261 fec_->GetNumberOfFecPackets(media_packets_.size(), params_.fec_rate); |
| 262 // Return the overhead in Q8. | 262 // Return the overhead in Q8. |
| 263 return (num_fec_packets << 8) / media_packets_.size(); | 263 return (num_fec_packets << 8) / media_packets_.size(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void ProducerFec::DeleteMediaPackets() { | 266 void ProducerFec::DeleteMediaPackets() { |
| 267 media_packets_.clear(); | 267 media_packets_.clear(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 } // namespace webrtc | 270 } // namespace webrtc |
| OLD | NEW |