| 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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 PacketOptions options; | 571 PacketOptions options; |
| 572 bool has_transport_seq_num = | 572 bool has_transport_seq_num = |
| 573 UpdateTransportSequenceNumber(&padding_packet, &options.packet_id); | 573 UpdateTransportSequenceNumber(&padding_packet, &options.packet_id); |
| 574 padding_packet.SetPadding(padding_bytes_in_packet, &random_); | 574 padding_packet.SetPadding(padding_bytes_in_packet, &random_); |
| 575 | 575 |
| 576 if (has_transport_seq_num) { | 576 if (has_transport_seq_num) { |
| 577 AddPacketToTransportFeedback(options.packet_id, padding_packet, | 577 AddPacketToTransportFeedback(options.packet_id, padding_packet, |
| 578 pacing_info); | 578 pacing_info); |
| 579 } | 579 } |
| 580 | 580 |
| 581 if (!SendPacketToNetwork(padding_packet, options)) | 581 if (!SendPacketToNetwork(padding_packet, options, pacing_info)) |
| 582 break; | 582 break; |
| 583 | 583 |
| 584 bytes_sent += padding_bytes_in_packet; | 584 bytes_sent += padding_bytes_in_packet; |
| 585 UpdateRtpStats(padding_packet, over_rtx, false); | 585 UpdateRtpStats(padding_packet, over_rtx, false); |
| 586 } | 586 } |
| 587 | 587 |
| 588 return bytes_sent; | 588 return bytes_sent; |
| 589 } | 589 } |
| 590 | 590 |
| 591 void RTPSender::SetStorePacketsStatus(bool enable, uint16_t number_to_store) { | 591 void RTPSender::SetStorePacketsStatus(bool enable, uint16_t number_to_store) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 return packet->size(); | 623 return packet->size(); |
| 624 } | 624 } |
| 625 bool rtx = (RtxStatus() & kRtxRetransmitted) > 0; | 625 bool rtx = (RtxStatus() & kRtxRetransmitted) > 0; |
| 626 int32_t packet_size = static_cast<int32_t>(packet->size()); | 626 int32_t packet_size = static_cast<int32_t>(packet->size()); |
| 627 if (!PrepareAndSendPacket(std::move(packet), rtx, true, PacedPacketInfo())) | 627 if (!PrepareAndSendPacket(std::move(packet), rtx, true, PacedPacketInfo())) |
| 628 return -1; | 628 return -1; |
| 629 return packet_size; | 629 return packet_size; |
| 630 } | 630 } |
| 631 | 631 |
| 632 bool RTPSender::SendPacketToNetwork(const RtpPacketToSend& packet, | 632 bool RTPSender::SendPacketToNetwork(const RtpPacketToSend& packet, |
| 633 const PacketOptions& options) { | 633 const PacketOptions& options, |
| 634 const PacedPacketInfo& pacing_info) { |
| 634 int bytes_sent = -1; | 635 int bytes_sent = -1; |
| 635 if (transport_) { | 636 if (transport_) { |
| 636 UpdateRtpOverhead(packet); | 637 UpdateRtpOverhead(packet); |
| 637 bytes_sent = transport_->SendRtp(packet.data(), packet.size(), options) | 638 bytes_sent = transport_->SendRtp(packet.data(), packet.size(), options) |
| 638 ? static_cast<int>(packet.size()) | 639 ? static_cast<int>(packet.size()) |
| 639 : -1; | 640 : -1; |
| 640 if (event_log_ && bytes_sent > 0) { | 641 if (event_log_ && bytes_sent > 0) { |
| 641 event_log_->LogRtpHeader(kOutgoingPacket, MediaType::ANY, packet.data(), | 642 event_log_->LogRtpHeader(kOutgoingPacket, MediaType::ANY, packet.data(), |
| 642 packet.size()); | 643 packet.size(), pacing_info.probe_cluster_id); |
| 643 } | 644 } |
| 644 } | 645 } |
| 645 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 646 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
| 646 "RTPSender::SendPacketToNetwork", "size", packet.size(), | 647 "RTPSender::SendPacketToNetwork", "size", packet.size(), |
| 647 "sent", bytes_sent); | 648 "sent", bytes_sent); |
| 648 // TODO(pwestin): Add a separate bitrate for sent bitrate after pacer. | 649 // TODO(pwestin): Add a separate bitrate for sent bitrate after pacer. |
| 649 if (bytes_sent <= 0) { | 650 if (bytes_sent <= 0) { |
| 650 LOG(LS_WARNING) << "Transport failed to send packet."; | 651 LOG(LS_WARNING) << "Transport failed to send packet."; |
| 651 return false; | 652 return false; |
| 652 } | 653 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 AddPacketToTransportFeedback(options.packet_id, *packet_to_send, | 754 AddPacketToTransportFeedback(options.packet_id, *packet_to_send, |
| 754 pacing_info); | 755 pacing_info); |
| 755 } | 756 } |
| 756 | 757 |
| 757 if (!is_retransmit && !send_over_rtx) { | 758 if (!is_retransmit && !send_over_rtx) { |
| 758 UpdateDelayStatistics(packet->capture_time_ms(), now_ms); | 759 UpdateDelayStatistics(packet->capture_time_ms(), now_ms); |
| 759 UpdateOnSendPacket(options.packet_id, packet->capture_time_ms(), | 760 UpdateOnSendPacket(options.packet_id, packet->capture_time_ms(), |
| 760 packet->Ssrc()); | 761 packet->Ssrc()); |
| 761 } | 762 } |
| 762 | 763 |
| 763 if (!SendPacketToNetwork(*packet_to_send, options)) | 764 if (!SendPacketToNetwork(*packet_to_send, options, pacing_info)) |
| 764 return false; | 765 return false; |
| 765 | 766 |
| 766 { | 767 { |
| 767 rtc::CritScope lock(&send_critsect_); | 768 rtc::CritScope lock(&send_critsect_); |
| 768 media_has_been_sent_ = true; | 769 media_has_been_sent_ = true; |
| 769 } | 770 } |
| 770 UpdateRtpStats(*packet_to_send, send_over_rtx, is_retransmit); | 771 UpdateRtpStats(*packet_to_send, send_over_rtx, is_retransmit); |
| 771 return true; | 772 return true; |
| 772 } | 773 } |
| 773 | 774 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 PacketOptions options; | 884 PacketOptions options; |
| 884 if (UpdateTransportSequenceNumber(packet.get(), &options.packet_id)) { | 885 if (UpdateTransportSequenceNumber(packet.get(), &options.packet_id)) { |
| 885 AddPacketToTransportFeedback(options.packet_id, *packet.get(), | 886 AddPacketToTransportFeedback(options.packet_id, *packet.get(), |
| 886 PacedPacketInfo()); | 887 PacedPacketInfo()); |
| 887 } | 888 } |
| 888 | 889 |
| 889 UpdateDelayStatistics(packet->capture_time_ms(), now_ms); | 890 UpdateDelayStatistics(packet->capture_time_ms(), now_ms); |
| 890 UpdateOnSendPacket(options.packet_id, packet->capture_time_ms(), | 891 UpdateOnSendPacket(options.packet_id, packet->capture_time_ms(), |
| 891 packet->Ssrc()); | 892 packet->Ssrc()); |
| 892 | 893 |
| 893 bool sent = SendPacketToNetwork(*packet, options); | 894 bool sent = SendPacketToNetwork(*packet, options, PacedPacketInfo()); |
| 894 | 895 |
| 895 if (sent) { | 896 if (sent) { |
| 896 { | 897 { |
| 897 rtc::CritScope lock(&send_critsect_); | 898 rtc::CritScope lock(&send_critsect_); |
| 898 media_has_been_sent_ = true; | 899 media_has_been_sent_ = true; |
| 899 } | 900 } |
| 900 UpdateRtpStats(*packet, false, false); | 901 UpdateRtpStats(*packet, false, false); |
| 901 } | 902 } |
| 902 | 903 |
| 903 // To support retransmissions, we store the media packet as sent in the | 904 // To support retransmissions, we store the media packet as sent in the |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1274 if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) { | 1275 if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) { |
| 1275 return; | 1276 return; |
| 1276 } | 1277 } |
| 1277 rtp_overhead_bytes_per_packet_ = packet.headers_size(); | 1278 rtp_overhead_bytes_per_packet_ = packet.headers_size(); |
| 1278 overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_; | 1279 overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_; |
| 1279 } | 1280 } |
| 1280 overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet); | 1281 overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet); |
| 1281 } | 1282 } |
| 1282 | 1283 |
| 1283 } // namespace webrtc | 1284 } // namespace webrtc |
| OLD | NEW |