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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 size_t num_packets = | 378 size_t num_packets = |
379 packetizer->SetPayloadData(payload_data, payload_size, frag); | 379 packetizer->SetPayloadData(payload_data, payload_size, frag); |
380 | 380 |
381 if (num_packets == 0) | 381 if (num_packets == 0) |
382 return false; | 382 return false; |
383 | 383 |
384 bool first_frame = first_frame_sent_(); | 384 bool first_frame = first_frame_sent_(); |
385 for (size_t i = 0; i < num_packets; ++i) { | 385 for (size_t i = 0; i < num_packets; ++i) { |
386 bool last = (i + 1) == num_packets; | 386 bool last = (i + 1) == num_packets; |
387 auto packet = last ? std::move(last_packet) | 387 auto packet = last ? std::move(last_packet) |
388 : rtc::MakeUnique<RtpPacketToSend>(*rtp_header); | 388 : rtc::MakeUnique<RtpPacketToSend>(*rtp_header); |
åsapersson
2017/06/21 11:14:00
Maybe also check in VideoSendStreamTest.SupportsVi
ilnik
2017/06/21 11:22:04
Done.
| |
389 if (!packetizer->NextPacket(packet.get())) | 389 if (!packetizer->NextPacket(packet.get())) |
390 return false; | 390 return false; |
391 RTC_DCHECK_LE(packet->payload_size(), | 391 RTC_DCHECK_LE(packet->payload_size(), |
392 last ? max_data_payload_length - last_packet_reduction_len | 392 last ? max_data_payload_length - last_packet_reduction_len |
393 : max_data_payload_length); | 393 : max_data_payload_length); |
394 if (!rtp_sender_->AssignSequenceNumber(packet.get())) | 394 if (!rtp_sender_->AssignSequenceNumber(packet.get())) |
395 return false; | 395 return false; |
396 | 396 |
397 bool protect_packet = | |
398 (packetizer->GetProtectionType() == kProtectedPacket); | |
397 // Put packetization finish timestamp into extension. | 399 // Put packetization finish timestamp into extension. |
398 if (last && is_timing_frame) { | 400 if (last && is_timing_frame) { |
399 packet->set_packetization_finish_time_ms(clock_->TimeInMilliseconds()); | 401 packet->set_packetization_finish_time_ms(clock_->TimeInMilliseconds()); |
402 // TODO(ilnik): Due to webrtc:7859, packets with timing extensions are not | |
403 // protected by FEC. It reduces FEC efficiency a bit. When FEC is moved | |
404 // below the pacer, it can be re-enabled for these packets. | |
405 // NOTE: Any RTP stream processor in the network, modifying 'network' | |
406 // timestamps in the timing frames extension have to be an end-point for | |
407 // FEC, otherwise recovered by FEC packets will be corrupted. | |
408 protect_packet = false; | |
brandtr
2017/06/21 11:05:39
Can you add a unit test for this?
ilnik
2017/06/21 11:17:18
What exactly do you want me to test? What packets
brandtr
2017/06/21 11:28:15
The former. Either through a unit test here, or us
ilnik
2017/06/21 12:49:42
Done.
| |
400 } | 409 } |
401 | 410 |
402 const bool protect_packet = | |
403 (packetizer->GetProtectionType() == kProtectedPacket); | |
404 if (flexfec_enabled()) { | 411 if (flexfec_enabled()) { |
405 // TODO(brandtr): Remove the FlexFEC code path when FlexfecSender | 412 // TODO(brandtr): Remove the FlexFEC code path when FlexfecSender |
406 // is wired up to PacedSender instead. | 413 // is wired up to PacedSender instead. |
407 SendVideoPacketWithFlexfec(std::move(packet), storage, protect_packet); | 414 SendVideoPacketWithFlexfec(std::move(packet), storage, protect_packet); |
408 } else if (red_enabled) { | 415 } else if (red_enabled) { |
409 SendVideoPacketAsRedMaybeWithUlpfec(std::move(packet), storage, | 416 SendVideoPacketAsRedMaybeWithUlpfec(std::move(packet), storage, |
410 protect_packet); | 417 protect_packet); |
411 } else { | 418 } else { |
412 SendVideoPacket(std::move(packet), storage); | 419 SendVideoPacket(std::move(packet), storage); |
413 } | 420 } |
(...skipping 29 matching lines...) Expand all Loading... | |
443 rtc::CritScope cs(&crit_); | 450 rtc::CritScope cs(&crit_); |
444 return retransmission_settings_; | 451 return retransmission_settings_; |
445 } | 452 } |
446 | 453 |
447 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { | 454 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { |
448 rtc::CritScope cs(&crit_); | 455 rtc::CritScope cs(&crit_); |
449 retransmission_settings_ = settings; | 456 retransmission_settings_ = settings; |
450 } | 457 } |
451 | 458 |
452 } // namespace webrtc | 459 } // namespace webrtc |
OLD | NEW |