| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 fec_enabled = fec_enabled_; | 241 fec_enabled = fec_enabled_; |
| 242 } | 242 } |
| 243 | 243 |
| 244 // Register CVO rtp header extension at the first time when we receive a frame | 244 // Register CVO rtp header extension at the first time when we receive a frame |
| 245 // with pending rotation. | 245 // with pending rotation. |
| 246 RTPSenderInterface::CVOMode cvo_mode = RTPSenderInterface::kCVONone; | 246 RTPSenderInterface::CVOMode cvo_mode = RTPSenderInterface::kCVONone; |
| 247 if (video_header && video_header->rotation != kVideoRotation_0) { | 247 if (video_header && video_header->rotation != kVideoRotation_0) { |
| 248 cvo_mode = _rtpSender.ActivateCVORtpHeaderExtension(); | 248 cvo_mode = _rtpSender.ActivateCVORtpHeaderExtension(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 uint16_t rtp_header_length = _rtpSender.RTPHeaderLength(); | |
| 252 size_t payload_bytes_to_send = payloadSize; | 251 size_t payload_bytes_to_send = payloadSize; |
| 253 const uint8_t* data = payloadData; | 252 const uint8_t* data = payloadData; |
| 254 | 253 |
| 255 // TODO(changbin): we currently don't support to configure the codec to | 254 // TODO(changbin): we currently don't support to configure the codec to |
| 256 // output multiple partitions for VP8. Should remove below check after the | 255 // output multiple partitions for VP8. Should remove below check after the |
| 257 // issue is fixed. | 256 // issue is fixed. |
| 258 const RTPFragmentationHeader* frag = | 257 const RTPFragmentationHeader* frag = |
| 259 (videoType == kRtpVideoVp8) ? NULL : fragmentation; | 258 (videoType == kRtpVideoVp8) ? NULL : fragmentation; |
| 260 | 259 |
| 261 packetizer->SetPayloadData(data, payload_bytes_to_send, frag); | 260 packetizer->SetPayloadData(data, payload_bytes_to_send, frag); |
| 262 | 261 |
| 263 bool first = true; | 262 bool first = true; |
| 264 bool last = false; | 263 bool last = false; |
| 265 while (!last) { | 264 while (!last) { |
| 266 uint8_t dataBuffer[IP_PACKET_SIZE] = {0}; | 265 uint8_t dataBuffer[IP_PACKET_SIZE] = {0}; |
| 267 size_t payload_bytes_in_packet = 0; | 266 size_t payload_bytes_in_packet = 0; |
| 267 |
| 268 // Write RTP header. |
| 269 // Note that RTP header size is dynamically computed since there may be |
| 270 // an optional RTP header extension. |
| 271 uint16_t rtp_header_length = _rtpSender.BuildRTPheader( |
| 272 dataBuffer, payloadType, false, captureTimeStamp, capture_time_ms); |
| 273 |
| 268 if (!packetizer->NextPacket(&dataBuffer[rtp_header_length], | 274 if (!packetizer->NextPacket(&dataBuffer[rtp_header_length], |
| 269 &payload_bytes_in_packet, &last)) { | 275 &payload_bytes_in_packet, &last)) { |
| 270 return -1; | 276 return -1; |
| 271 } | 277 } |
| 272 | 278 |
| 273 // Write RTP header. | |
| 274 // Set marker bit true if this is the last packet in frame. | 279 // Set marker bit true if this is the last packet in frame. |
| 275 _rtpSender.BuildRTPheader( | 280 if (last) |
| 276 dataBuffer, payloadType, last, captureTimeStamp, capture_time_ms); | 281 dataBuffer[1] |= kRtpMarkerBitMask; |
| 282 |
| 277 // According to | 283 // According to |
| 278 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ | 284 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ |
| 279 // ts_126114v120700p.pdf Section 7.4.5: | 285 // ts_126114v120700p.pdf Section 7.4.5: |
| 280 // The MTSI client shall add the payload bytes as defined in this clause | 286 // The MTSI client shall add the payload bytes as defined in this clause |
| 281 // onto the last RTP packet in each group of packets which make up a key | 287 // onto the last RTP packet in each group of packets which make up a key |
| 282 // frame (I-frame or IDR frame in H.264 (AVC), or an IRAP picture in H.265 | 288 // frame (I-frame or IDR frame in H.264 (AVC), or an IRAP picture in H.265 |
| 283 // (HEVC)). The MTSI client may also add the payload bytes onto the last RTP | 289 // (HEVC)). The MTSI client may also add the payload bytes onto the last RTP |
| 284 // packet in each group of packets which make up another type of frame | 290 // packet in each group of packets which make up another type of frame |
| 285 // (e.g. a P-Frame) only if the current value is different from the previous | 291 // (e.g. a P-Frame) only if the current value is different from the previous |
| 286 // value sent. | 292 // value sent. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 rtc::CritScope cs(&crit_); | 353 rtc::CritScope cs(&crit_); |
| 348 return _retransmissionSettings; | 354 return _retransmissionSettings; |
| 349 } | 355 } |
| 350 | 356 |
| 351 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { | 357 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { |
| 352 rtc::CritScope cs(&crit_); | 358 rtc::CritScope cs(&crit_); |
| 353 _retransmissionSettings = settings; | 359 _retransmissionSettings = settings; |
| 354 } | 360 } |
| 355 | 361 |
| 356 } // namespace webrtc | 362 } // namespace webrtc |
| OLD | NEW |