| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 223 } |
| 224 | 224 |
| 225 int32_t RTPSenderVideo::SendVideo(const RtpVideoCodecTypes videoType, | 225 int32_t RTPSenderVideo::SendVideo(const RtpVideoCodecTypes videoType, |
| 226 const FrameType frameType, | 226 const FrameType frameType, |
| 227 const int8_t payloadType, | 227 const int8_t payloadType, |
| 228 const uint32_t captureTimeStamp, | 228 const uint32_t captureTimeStamp, |
| 229 int64_t capture_time_ms, | 229 int64_t capture_time_ms, |
| 230 const uint8_t* payloadData, | 230 const uint8_t* payloadData, |
| 231 const size_t payloadSize, | 231 const size_t payloadSize, |
| 232 const RTPFragmentationHeader* fragmentation, | 232 const RTPFragmentationHeader* fragmentation, |
| 233 const RTPVideoHeader* rtpHdr) { | 233 const RTPVideoHeader* video_header) { |
| 234 if (payloadSize == 0) { | 234 if (payloadSize == 0) { |
| 235 return -1; | 235 return -1; |
| 236 } | 236 } |
| 237 | 237 |
| 238 rtc::scoped_ptr<RtpPacketizer> packetizer( | 238 rtc::scoped_ptr<RtpPacketizer> packetizer(RtpPacketizer::Create( |
| 239 RtpPacketizer::Create(videoType, _rtpSender.MaxDataPayloadLength(), | 239 videoType, _rtpSender.MaxDataPayloadLength(), |
| 240 &(rtpHdr->codecHeader), frameType)); | 240 video_header ? &(video_header->codecHeader) : nullptr, frameType)); |
| 241 | 241 |
| 242 StorageType storage; | 242 StorageType storage; |
| 243 bool fec_enabled; | 243 bool fec_enabled; |
| 244 { | 244 { |
| 245 CriticalSectionScoped cs(crit_.get()); | 245 CriticalSectionScoped cs(crit_.get()); |
| 246 FecProtectionParams* fec_params = | 246 FecProtectionParams* fec_params = |
| 247 frameType == kVideoFrameKey ? &key_fec_params_ : &delta_fec_params_; | 247 frameType == kVideoFrameKey ? &key_fec_params_ : &delta_fec_params_; |
| 248 producer_fec_.SetFecParameters(fec_params, 0); | 248 producer_fec_.SetFecParameters(fec_params, 0); |
| 249 storage = packetizer->GetStorageType(_retransmissionSettings); | 249 storage = packetizer->GetStorageType(_retransmissionSettings); |
| 250 fec_enabled = fec_enabled_; | 250 fec_enabled = fec_enabled_; |
| 251 } | 251 } |
| 252 | 252 |
| 253 // Register CVO rtp header extension at the first time when we receive a frame | 253 // Register CVO rtp header extension at the first time when we receive a frame |
| 254 // with pending rotation. | 254 // with pending rotation. |
| 255 RTPSenderInterface::CVOMode cvo_mode = RTPSenderInterface::kCVONone; | 255 RTPSenderInterface::CVOMode cvo_mode = RTPSenderInterface::kCVONone; |
| 256 if (rtpHdr && rtpHdr->rotation != kVideoRotation_0) { | 256 if (video_header && video_header->rotation != kVideoRotation_0) { |
| 257 cvo_mode = _rtpSender.ActivateCVORtpHeaderExtension(); | 257 cvo_mode = _rtpSender.ActivateCVORtpHeaderExtension(); |
| 258 } | 258 } |
| 259 | 259 |
| 260 uint16_t rtp_header_length = _rtpSender.RTPHeaderLength(); | 260 uint16_t rtp_header_length = _rtpSender.RTPHeaderLength(); |
| 261 size_t payload_bytes_to_send = payloadSize; | 261 size_t payload_bytes_to_send = payloadSize; |
| 262 const uint8_t* data = payloadData; | 262 const uint8_t* data = payloadData; |
| 263 | 263 |
| 264 // TODO(changbin): we currently don't support to configure the codec to | 264 // TODO(changbin): we currently don't support to configure the codec to |
| 265 // output multiple partitions for VP8. Should remove below check after the | 265 // output multiple partitions for VP8. Should remove below check after the |
| 266 // issue is fixed. | 266 // issue is fixed. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 285 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ | 285 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ |
| 286 // ts_126114v120700p.pdf Section 7.4.5: | 286 // ts_126114v120700p.pdf Section 7.4.5: |
| 287 // The MTSI client shall add the payload bytes as defined in this clause | 287 // The MTSI client shall add the payload bytes as defined in this clause |
| 288 // onto the last RTP packet in each group of packets which make up a key | 288 // onto the last RTP packet in each group of packets which make up a key |
| 289 // frame (I-frame or IDR frame in H.264 (AVC), or an IRAP picture in H.265 | 289 // frame (I-frame or IDR frame in H.264 (AVC), or an IRAP picture in H.265 |
| 290 // (HEVC)). The MTSI client may also add the payload bytes onto the last RTP | 290 // (HEVC)). The MTSI client may also add the payload bytes onto the last RTP |
| 291 // packet in each group of packets which make up another type of frame | 291 // packet in each group of packets which make up another type of frame |
| 292 // (e.g. a P-Frame) only if the current value is different from the previous | 292 // (e.g. a P-Frame) only if the current value is different from the previous |
| 293 // value sent. | 293 // value sent. |
| 294 // Here we are adding it to every packet of every frame at this point. | 294 // Here we are adding it to every packet of every frame at this point. |
| 295 if (!rtpHdr) { | 295 if (!video_header) { |
| 296 RTC_DCHECK(!_rtpSender.IsRtpHeaderExtensionRegistered( | 296 RTC_DCHECK(!_rtpSender.IsRtpHeaderExtensionRegistered( |
| 297 kRtpExtensionVideoRotation)); | 297 kRtpExtensionVideoRotation)); |
| 298 } else if (cvo_mode == RTPSenderInterface::kCVOActivated) { | 298 } else if (cvo_mode == RTPSenderInterface::kCVOActivated) { |
| 299 // Checking whether CVO header extension is registered will require taking | 299 // Checking whether CVO header extension is registered will require taking |
| 300 // a lock. It'll be a no-op if it's not registered. | 300 // a lock. It'll be a no-op if it's not registered. |
| 301 // TODO(guoweis): For now, all packets sent will carry the CVO such that | 301 // TODO(guoweis): For now, all packets sent will carry the CVO such that |
| 302 // the RTP header length is consistent, although the receiver side will | 302 // the RTP header length is consistent, although the receiver side will |
| 303 // only exam the packets with marker bit set. | 303 // only exam the packets with marker bit set. |
| 304 size_t packetSize = payloadSize + rtp_header_length; | 304 size_t packetSize = payloadSize + rtp_header_length; |
| 305 RtpUtility::RtpHeaderParser rtp_parser(dataBuffer, packetSize); | 305 RtpUtility::RtpHeaderParser rtp_parser(dataBuffer, packetSize); |
| 306 RTPHeader rtp_header; | 306 RTPHeader rtp_header; |
| 307 rtp_parser.Parse(&rtp_header); | 307 rtp_parser.Parse(&rtp_header); |
| 308 _rtpSender.UpdateVideoRotation(dataBuffer, packetSize, rtp_header, | 308 _rtpSender.UpdateVideoRotation(dataBuffer, packetSize, rtp_header, |
| 309 rtpHdr->rotation); | 309 video_header->rotation); |
| 310 } | 310 } |
| 311 if (fec_enabled) { | 311 if (fec_enabled) { |
| 312 SendVideoPacketAsRed(dataBuffer, payload_bytes_in_packet, | 312 SendVideoPacketAsRed(dataBuffer, payload_bytes_in_packet, |
| 313 rtp_header_length, _rtpSender.SequenceNumber(), | 313 rtp_header_length, _rtpSender.SequenceNumber(), |
| 314 captureTimeStamp, capture_time_ms, storage, | 314 captureTimeStamp, capture_time_ms, storage, |
| 315 packetizer->GetProtectionType() == kProtectedPacket); | 315 packetizer->GetProtectionType() == kProtectedPacket); |
| 316 } else { | 316 } else { |
| 317 SendVideoPacket(dataBuffer, payload_bytes_in_packet, rtp_header_length, | 317 SendVideoPacket(dataBuffer, payload_bytes_in_packet, rtp_header_length, |
| 318 _rtpSender.SequenceNumber(), captureTimeStamp, | 318 _rtpSender.SequenceNumber(), captureTimeStamp, |
| 319 capture_time_ms, storage); | 319 capture_time_ms, storage); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 350 CriticalSectionScoped cs(crit_.get()); | 350 CriticalSectionScoped cs(crit_.get()); |
| 351 return _retransmissionSettings; | 351 return _retransmissionSettings; |
| 352 } | 352 } |
| 353 | 353 |
| 354 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { | 354 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { |
| 355 CriticalSectionScoped cs(crit_.get()); | 355 CriticalSectionScoped cs(crit_.get()); |
| 356 _retransmissionSettings = settings; | 356 _retransmissionSettings = settings; |
| 357 } | 357 } |
| 358 | 358 |
| 359 } // namespace webrtc | 359 } // namespace webrtc |
| OLD | NEW |