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