| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 producer_fec_.AddRtpPacketAndGenerateFec(data_buffer, payload_length, | 135 producer_fec_.AddRtpPacketAndGenerateFec(data_buffer, payload_length, |
| 136 rtp_header_length); | 136 rtp_header_length); |
| 137 } | 137 } |
| 138 uint16_t num_fec_packets = producer_fec_.NumAvailableFecPackets(); | 138 uint16_t num_fec_packets = producer_fec_.NumAvailableFecPackets(); |
| 139 if (num_fec_packets > 0) { | 139 if (num_fec_packets > 0) { |
| 140 next_fec_sequence_number = | 140 next_fec_sequence_number = |
| 141 _rtpSender.AllocateSequenceNumber(num_fec_packets); | 141 _rtpSender.AllocateSequenceNumber(num_fec_packets); |
| 142 fec_packets = producer_fec_.GetFecPackets( | 142 fec_packets = producer_fec_.GetFecPackets( |
| 143 _payloadTypeRED, _payloadTypeFEC, next_fec_sequence_number, | 143 _payloadTypeRED, _payloadTypeFEC, next_fec_sequence_number, |
| 144 rtp_header_length); | 144 rtp_header_length); |
| 145 DCHECK_EQ(num_fec_packets, fec_packets.size()); | 145 RTC_DCHECK_EQ(num_fec_packets, fec_packets.size()); |
| 146 if (_retransmissionSettings & kRetransmitFECPackets) | 146 if (_retransmissionSettings & kRetransmitFECPackets) |
| 147 fec_storage = kAllowRetransmission; | 147 fec_storage = kAllowRetransmission; |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 if (_rtpSender.SendToNetwork( | 150 if (_rtpSender.SendToNetwork( |
| 151 red_packet->data(), red_packet->length() - rtp_header_length, | 151 red_packet->data(), red_packet->length() - rtp_header_length, |
| 152 rtp_header_length, capture_time_ms, media_packet_storage, | 152 rtp_header_length, capture_time_ms, media_packet_storage, |
| 153 PacedSender::kNormalPriority) == 0) { | 153 PacedSender::kNormalPriority) == 0) { |
| 154 _videoBitrate.Update(red_packet->length()); | 154 _videoBitrate.Update(red_packet->length()); |
| 155 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 155 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // (The base RTP header is already protected by the FEC header.) | 229 // (The base RTP header is already protected by the FEC header.) |
| 230 return ForwardErrorCorrection::PacketOverhead() + REDForFECHeaderLength + | 230 return ForwardErrorCorrection::PacketOverhead() + REDForFECHeaderLength + |
| 231 (_rtpSender.RTPHeaderLength() - kRtpHeaderSize); | 231 (_rtpSender.RTPHeaderLength() - kRtpHeaderSize); |
| 232 } | 232 } |
| 233 return 0; | 233 return 0; |
| 234 } | 234 } |
| 235 | 235 |
| 236 void RTPSenderVideo::SetFecParameters(const FecProtectionParams* delta_params, | 236 void RTPSenderVideo::SetFecParameters(const FecProtectionParams* delta_params, |
| 237 const FecProtectionParams* key_params) { | 237 const FecProtectionParams* key_params) { |
| 238 CriticalSectionScoped cs(crit_.get()); | 238 CriticalSectionScoped cs(crit_.get()); |
| 239 DCHECK(delta_params); | 239 RTC_DCHECK(delta_params); |
| 240 DCHECK(key_params); | 240 RTC_DCHECK(key_params); |
| 241 delta_fec_params_ = *delta_params; | 241 delta_fec_params_ = *delta_params; |
| 242 key_fec_params_ = *key_params; | 242 key_fec_params_ = *key_params; |
| 243 } | 243 } |
| 244 | 244 |
| 245 int32_t RTPSenderVideo::SendVideo(const RtpVideoCodecTypes videoType, | 245 int32_t RTPSenderVideo::SendVideo(const RtpVideoCodecTypes videoType, |
| 246 const FrameType frameType, | 246 const FrameType frameType, |
| 247 const int8_t payloadType, | 247 const int8_t payloadType, |
| 248 const uint32_t captureTimeStamp, | 248 const uint32_t captureTimeStamp, |
| 249 int64_t capture_time_ms, | 249 int64_t capture_time_ms, |
| 250 const uint8_t* payloadData, | 250 const uint8_t* payloadData, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 // ts_126114v120700p.pdf Section 7.4.5: | 306 // ts_126114v120700p.pdf Section 7.4.5: |
| 307 // The MTSI client shall add the payload bytes as defined in this clause | 307 // The MTSI client shall add the payload bytes as defined in this clause |
| 308 // onto the last RTP packet in each group of packets which make up a key | 308 // onto the last RTP packet in each group of packets which make up a key |
| 309 // frame (I-frame or IDR frame in H.264 (AVC), or an IRAP picture in H.265 | 309 // frame (I-frame or IDR frame in H.264 (AVC), or an IRAP picture in H.265 |
| 310 // (HEVC)). The MTSI client may also add the payload bytes onto the last RTP | 310 // (HEVC)). The MTSI client may also add the payload bytes onto the last RTP |
| 311 // packet in each group of packets which make up another type of frame | 311 // packet in each group of packets which make up another type of frame |
| 312 // (e.g. a P-Frame) only if the current value is different from the previous | 312 // (e.g. a P-Frame) only if the current value is different from the previous |
| 313 // value sent. | 313 // value sent. |
| 314 // Here we are adding it to every packet of every frame at this point. | 314 // Here we are adding it to every packet of every frame at this point. |
| 315 if (!rtpHdr) { | 315 if (!rtpHdr) { |
| 316 DCHECK(!_rtpSender.IsRtpHeaderExtensionRegistered( | 316 RTC_DCHECK(!_rtpSender.IsRtpHeaderExtensionRegistered( |
| 317 kRtpExtensionVideoRotation)); | 317 kRtpExtensionVideoRotation)); |
| 318 } else if (cvo_mode == RTPSenderInterface::kCVOActivated) { | 318 } else if (cvo_mode == RTPSenderInterface::kCVOActivated) { |
| 319 // Checking whether CVO header extension is registered will require taking | 319 // Checking whether CVO header extension is registered will require taking |
| 320 // a lock. It'll be a no-op if it's not registered. | 320 // a lock. It'll be a no-op if it's not registered. |
| 321 // TODO(guoweis): For now, all packets sent will carry the CVO such that | 321 // TODO(guoweis): For now, all packets sent will carry the CVO such that |
| 322 // the RTP header length is consistent, although the receiver side will | 322 // the RTP header length is consistent, although the receiver side will |
| 323 // only exam the packets with market bit set. | 323 // only exam the packets with market bit set. |
| 324 size_t packetSize = payloadSize + rtp_header_length; | 324 size_t packetSize = payloadSize + rtp_header_length; |
| 325 RtpUtility::RtpHeaderParser rtp_parser(dataBuffer, packetSize); | 325 RtpUtility::RtpHeaderParser rtp_parser(dataBuffer, packetSize); |
| 326 RTPHeader rtp_header; | 326 RTPHeader rtp_header; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 CriticalSectionScoped cs(crit_.get()); | 370 CriticalSectionScoped cs(crit_.get()); |
| 371 return _retransmissionSettings; | 371 return _retransmissionSettings; |
| 372 } | 372 } |
| 373 | 373 |
| 374 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { | 374 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { |
| 375 CriticalSectionScoped cs(crit_.get()); | 375 CriticalSectionScoped cs(crit_.get()); |
| 376 _retransmissionSettings = settings; | 376 _retransmissionSettings = settings; |
| 377 } | 377 } |
| 378 | 378 |
| 379 } // namespace webrtc | 379 } // namespace webrtc |
| OLD | NEW |