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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 return false; | 297 return false; |
298 | 298 |
299 // Create header that will be reused in all packets. | 299 // Create header that will be reused in all packets. |
300 std::unique_ptr<RtpPacketToSend> rtp_header = rtp_sender_->AllocatePacket(); | 300 std::unique_ptr<RtpPacketToSend> rtp_header = rtp_sender_->AllocatePacket(); |
301 rtp_header->SetPayloadType(payload_type); | 301 rtp_header->SetPayloadType(payload_type); |
302 rtp_header->SetTimestamp(rtp_timestamp); | 302 rtp_header->SetTimestamp(rtp_timestamp); |
303 rtp_header->set_capture_time_ms(capture_time_ms); | 303 rtp_header->set_capture_time_ms(capture_time_ms); |
304 auto last_packet = rtc::MakeUnique<RtpPacketToSend>(*rtp_header); | 304 auto last_packet = rtc::MakeUnique<RtpPacketToSend>(*rtp_header); |
305 | 305 |
306 size_t fec_packet_overhead; | 306 size_t fec_packet_overhead; |
307 bool is_timing_frame = false; | |
308 bool red_enabled; | 307 bool red_enabled; |
309 int32_t retransmission_settings; | 308 int32_t retransmission_settings; |
310 { | 309 { |
311 rtc::CritScope cs(&crit_); | 310 rtc::CritScope cs(&crit_); |
312 // According to | 311 // According to |
313 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ | 312 // http://www.etsi.org/deliver/etsi_ts/126100_126199/126114/12.07.00_60/ |
314 // ts_126114v120700p.pdf Section 7.4.5: | 313 // ts_126114v120700p.pdf Section 7.4.5: |
315 // The MTSI client shall add the payload bytes as defined in this clause | 314 // The MTSI client shall add the payload bytes as defined in this clause |
316 // onto the last RTP packet in each group of packets which make up a key | 315 // onto the last RTP packet in each group of packets which make up a key |
317 // frame (I-frame or IDR frame in H.264 (AVC), or an IRAP picture in H.265 | 316 // frame (I-frame or IDR frame in H.264 (AVC), or an IRAP picture in H.265 |
(...skipping 11 matching lines...) Expand all Loading... |
329 last_rotation_ = current_rotation; | 328 last_rotation_ = current_rotation; |
330 // Report content type only for key frames. | 329 // Report content type only for key frames. |
331 if (frame_type == kVideoFrameKey && | 330 if (frame_type == kVideoFrameKey && |
332 video_header->content_type != VideoContentType::UNSPECIFIED) { | 331 video_header->content_type != VideoContentType::UNSPECIFIED) { |
333 last_packet->SetExtension<VideoContentTypeExtension>( | 332 last_packet->SetExtension<VideoContentTypeExtension>( |
334 video_header->content_type); | 333 video_header->content_type); |
335 } | 334 } |
336 if (video_header->video_timing.is_timing_frame) { | 335 if (video_header->video_timing.is_timing_frame) { |
337 last_packet->SetExtension<VideoTimingExtension>( | 336 last_packet->SetExtension<VideoTimingExtension>( |
338 video_header->video_timing); | 337 video_header->video_timing); |
339 is_timing_frame = true; | |
340 } | 338 } |
341 } | 339 } |
342 | 340 |
343 // FEC settings. | 341 // FEC settings. |
344 const FecProtectionParams& fec_params = | 342 const FecProtectionParams& fec_params = |
345 frame_type == kVideoFrameKey ? key_fec_params_ : delta_fec_params_; | 343 frame_type == kVideoFrameKey ? key_fec_params_ : delta_fec_params_; |
346 if (flexfec_enabled()) | 344 if (flexfec_enabled()) |
347 flexfec_sender_->SetFecParameters(fec_params); | 345 flexfec_sender_->SetFecParameters(fec_params); |
348 if (ulpfec_enabled()) | 346 if (ulpfec_enabled()) |
349 ulpfec_generator_.SetFecParameters(fec_params); | 347 ulpfec_generator_.SetFecParameters(fec_params); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 if (!packetizer->NextPacket(packet.get())) | 387 if (!packetizer->NextPacket(packet.get())) |
390 return false; | 388 return false; |
391 RTC_DCHECK_LE(packet->payload_size(), | 389 RTC_DCHECK_LE(packet->payload_size(), |
392 last ? max_data_payload_length - last_packet_reduction_len | 390 last ? max_data_payload_length - last_packet_reduction_len |
393 : max_data_payload_length); | 391 : max_data_payload_length); |
394 if (!rtp_sender_->AssignSequenceNumber(packet.get())) | 392 if (!rtp_sender_->AssignSequenceNumber(packet.get())) |
395 return false; | 393 return false; |
396 | 394 |
397 bool protect_packet = (packetizer->GetProtectionType() == kProtectedPacket); | 395 bool protect_packet = (packetizer->GetProtectionType() == kProtectedPacket); |
398 // Put packetization finish timestamp into extension. | 396 // Put packetization finish timestamp into extension. |
399 if (last && is_timing_frame) { | 397 if (packet->HasExtension<VideoTimingExtension>()) { |
400 packet->set_packetization_finish_time_ms(clock_->TimeInMilliseconds()); | 398 packet->set_packetization_finish_time_ms(clock_->TimeInMilliseconds()); |
401 // TODO(ilnik): Due to webrtc:7859, packets with timing extensions are not | 399 // TODO(ilnik): Due to webrtc:7859, packets with timing extensions are not |
402 // protected by FEC. It reduces FEC efficiency a bit. When FEC is moved | 400 // protected by FEC. It reduces FEC efficiency a bit. When FEC is moved |
403 // below the pacer, it can be re-enabled for these packets. | 401 // below the pacer, it can be re-enabled for these packets. |
404 // NOTE: Any RTP stream processor in the network, modifying 'network' | 402 // NOTE: Any RTP stream processor in the network, modifying 'network' |
405 // timestamps in the timing frames extension have to be an end-point for | 403 // timestamps in the timing frames extension have to be an end-point for |
406 // FEC, otherwise recovered by FEC packets will be corrupted. | 404 // FEC, otherwise recovered by FEC packets will be corrupted. |
407 protect_packet = false; | 405 protect_packet = false; |
408 } | 406 } |
409 | 407 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 rtc::CritScope cs(&crit_); | 447 rtc::CritScope cs(&crit_); |
450 return retransmission_settings_; | 448 return retransmission_settings_; |
451 } | 449 } |
452 | 450 |
453 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { | 451 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { |
454 rtc::CritScope cs(&crit_); | 452 rtc::CritScope cs(&crit_); |
455 retransmission_settings_ = settings; | 453 retransmission_settings_ = settings; |
456 } | 454 } |
457 | 455 |
458 } // namespace webrtc | 456 } // namespace webrtc |
OLD | NEW |