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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 if (!packet) | 526 if (!packet) |
527 break; | 527 break; |
528 size_t payload_size = packet->payload_size(); | 528 size_t payload_size = packet->payload_size(); |
529 if (!PrepareAndSendPacket(std::move(packet), true, false, probe_cluster_id)) | 529 if (!PrepareAndSendPacket(std::move(packet), true, false, probe_cluster_id)) |
530 break; | 530 break; |
531 bytes_left -= payload_size; | 531 bytes_left -= payload_size; |
532 } | 532 } |
533 return bytes_to_send - bytes_left; | 533 return bytes_to_send - bytes_left; |
534 } | 534 } |
535 | 535 |
| 536 size_t RTPSender::SendPadData(size_t bytes, int probe_cluster_id) { |
| 537 return DeprecatedSendPadData(bytes, false, 0, 0, probe_cluster_id); |
| 538 } |
| 539 |
536 size_t RTPSender::SendPadData(size_t bytes, | 540 size_t RTPSender::SendPadData(size_t bytes, |
537 bool timestamp_provided, | 541 bool timestamp_provided, |
538 uint32_t timestamp, | 542 uint32_t timestamp, |
539 int64_t capture_time_ms) { | 543 int64_t capture_time_ms) { |
540 return SendPadData(bytes, timestamp_provided, timestamp, capture_time_ms, | 544 return DeprecatedSendPadData(bytes, timestamp_provided, timestamp, |
541 PacketInfo::kNotAProbe); | 545 capture_time_ms, PacketInfo::kNotAProbe); |
542 } | 546 } |
543 | 547 |
544 size_t RTPSender::SendPadData(size_t bytes, | 548 size_t RTPSender::DeprecatedSendPadData(size_t bytes, |
545 bool timestamp_provided, | 549 bool timestamp_provided, |
546 uint32_t timestamp, | 550 uint32_t timestamp, |
547 int64_t capture_time_ms, | 551 int64_t capture_time_ms, |
548 int probe_cluster_id) { | 552 int probe_cluster_id) { |
549 // Always send full padding packets. This is accounted for by the | 553 // Always send full padding packets. This is accounted for by the |
550 // RtpPacketSender, | 554 // RtpPacketSender, |
551 // which will make sure we don't send too much padding even if a single packet | 555 // which will make sure we don't send too much padding even if a single packet |
552 // is larger than requested. | 556 // is larger than requested. |
553 size_t padding_bytes_in_packet = | 557 size_t padding_bytes_in_packet = |
554 std::min(MaxDataPayloadLength(), kMaxPaddingLength); | 558 std::min(MaxDataPayloadLength(), kMaxPaddingLength); |
555 size_t bytes_sent = 0; | 559 size_t bytes_sent = 0; |
556 bool using_transport_seq = | 560 bool using_transport_seq = |
557 IsRtpHeaderExtensionRegistered(kRtpExtensionTransportSequenceNumber) && | 561 IsRtpHeaderExtensionRegistered(kRtpExtensionTransportSequenceNumber) && |
558 transport_sequence_number_allocator_; | 562 transport_sequence_number_allocator_; |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 video_->GenericFECStatus(&fec_enabled, &pt_red, &pt_fec); | 869 video_->GenericFECStatus(&fec_enabled, &pt_red, &pt_fec); |
866 return fec_enabled && packet.PayloadType() == pt_red && | 870 return fec_enabled && packet.PayloadType() == pt_red && |
867 packet.payload()[0] == pt_fec; | 871 packet.payload()[0] == pt_fec; |
868 } | 872 } |
869 | 873 |
870 size_t RTPSender::TimeToSendPadding(size_t bytes, int probe_cluster_id) { | 874 size_t RTPSender::TimeToSendPadding(size_t bytes, int probe_cluster_id) { |
871 if (audio_configured_ || bytes == 0) | 875 if (audio_configured_ || bytes == 0) |
872 return 0; | 876 return 0; |
873 size_t bytes_sent = TrySendRedundantPayloads(bytes, probe_cluster_id); | 877 size_t bytes_sent = TrySendRedundantPayloads(bytes, probe_cluster_id); |
874 if (bytes_sent < bytes) | 878 if (bytes_sent < bytes) |
875 bytes_sent += | 879 bytes_sent += SendPadData(bytes - bytes_sent, probe_cluster_id); |
876 SendPadData(bytes - bytes_sent, false, 0, 0, probe_cluster_id); | |
877 return bytes_sent; | 880 return bytes_sent; |
878 } | 881 } |
879 | 882 |
880 bool RTPSender::SendToNetwork(uint8_t* buffer, | 883 bool RTPSender::SendToNetwork(uint8_t* buffer, |
881 size_t payload_length, | 884 size_t payload_length, |
882 size_t rtp_header_length, | 885 size_t rtp_header_length, |
883 int64_t capture_time_ms, | 886 int64_t capture_time_ms, |
884 StorageType storage, | 887 StorageType storage, |
885 RtpPacketSender::Priority priority) { | 888 RtpPacketSender::Priority priority) { |
886 size_t length = payload_length + rtp_header_length; | 889 size_t length = payload_length + rtp_header_length; |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1768 rtc::CritScope lock(&send_critsect_); | 1771 rtc::CritScope lock(&send_critsect_); |
1769 | 1772 |
1770 RtpState state; | 1773 RtpState state; |
1771 state.sequence_number = sequence_number_rtx_; | 1774 state.sequence_number = sequence_number_rtx_; |
1772 state.start_timestamp = timestamp_offset_; | 1775 state.start_timestamp = timestamp_offset_; |
1773 | 1776 |
1774 return state; | 1777 return state; |
1775 } | 1778 } |
1776 | 1779 |
1777 } // namespace webrtc | 1780 } // namespace webrtc |
OLD | NEW |