Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_sender.cc

Issue 2666533002: Add probe logging to RtcEventLog. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 PacketOptions options; 552 PacketOptions options;
553 bool has_transport_seq_num = 553 bool has_transport_seq_num =
554 UpdateTransportSequenceNumber(&padding_packet, &options.packet_id); 554 UpdateTransportSequenceNumber(&padding_packet, &options.packet_id);
555 padding_packet.SetPadding(padding_bytes_in_packet, &random_); 555 padding_packet.SetPadding(padding_bytes_in_packet, &random_);
556 556
557 if (has_transport_seq_num) { 557 if (has_transport_seq_num) {
558 AddPacketToTransportFeedback(options.packet_id, padding_packet, 558 AddPacketToTransportFeedback(options.packet_id, padding_packet,
559 probe_cluster_id); 559 probe_cluster_id);
560 } 560 }
561 561
562 if (!SendPacketToNetwork(padding_packet, options)) 562 if (!SendPacketToNetwork(padding_packet, options, probe_cluster_id))
563 break; 563 break;
564 564
565 bytes_sent += padding_bytes_in_packet; 565 bytes_sent += padding_bytes_in_packet;
566 UpdateRtpStats(padding_packet, over_rtx, false); 566 UpdateRtpStats(padding_packet, over_rtx, false);
567 } 567 }
568 568
569 return bytes_sent; 569 return bytes_sent;
570 } 570 }
571 571
572 void RTPSender::SetStorePacketsStatus(bool enable, uint16_t number_to_store) { 572 void RTPSender::SetStorePacketsStatus(bool enable, uint16_t number_to_store) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 } 605 }
606 bool rtx = (RtxStatus() & kRtxRetransmitted) > 0; 606 bool rtx = (RtxStatus() & kRtxRetransmitted) > 0;
607 int32_t packet_size = static_cast<int32_t>(packet->size()); 607 int32_t packet_size = static_cast<int32_t>(packet->size());
608 if (!PrepareAndSendPacket(std::move(packet), rtx, true, 608 if (!PrepareAndSendPacket(std::move(packet), rtx, true,
609 PacketInfo::kNotAProbe)) 609 PacketInfo::kNotAProbe))
610 return -1; 610 return -1;
611 return packet_size; 611 return packet_size;
612 } 612 }
613 613
614 bool RTPSender::SendPacketToNetwork(const RtpPacketToSend& packet, 614 bool RTPSender::SendPacketToNetwork(const RtpPacketToSend& packet,
615 const PacketOptions& options) { 615 const PacketOptions& options,
616 int probe_cluster_id) {
616 int bytes_sent = -1; 617 int bytes_sent = -1;
617 if (transport_) { 618 if (transport_) {
618 UpdateRtpOverhead(packet); 619 UpdateRtpOverhead(packet);
619 bytes_sent = transport_->SendRtp(packet.data(), packet.size(), options) 620 bytes_sent = transport_->SendRtp(packet.data(), packet.size(), options)
620 ? static_cast<int>(packet.size()) 621 ? static_cast<int>(packet.size())
621 : -1; 622 : -1;
622 if (event_log_ && bytes_sent > 0) { 623 if (event_log_ && bytes_sent > 0) {
623 event_log_->LogRtpHeader(kOutgoingPacket, MediaType::ANY, packet.data(), 624 event_log_->LogRtpHeader(kOutgoingPacket, MediaType::ANY, packet.data(),
624 packet.size()); 625 packet.size(), probe_cluster_id);
625 } 626 }
626 } 627 }
627 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), 628 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
628 "RTPSender::SendPacketToNetwork", "size", packet.size(), 629 "RTPSender::SendPacketToNetwork", "size", packet.size(),
629 "sent", bytes_sent); 630 "sent", bytes_sent);
630 // TODO(pwestin): Add a separate bitrate for sent bitrate after pacer. 631 // TODO(pwestin): Add a separate bitrate for sent bitrate after pacer.
631 if (bytes_sent <= 0) { 632 if (bytes_sent <= 0) {
632 LOG(LS_WARNING) << "Transport failed to send packet"; 633 LOG(LS_WARNING) << "Transport failed to send packet";
633 return false; 634 return false;
634 } 635 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 AddPacketToTransportFeedback(options.packet_id, *packet_to_send, 736 AddPacketToTransportFeedback(options.packet_id, *packet_to_send,
736 probe_cluster_id); 737 probe_cluster_id);
737 } 738 }
738 739
739 if (!is_retransmit && !send_over_rtx) { 740 if (!is_retransmit && !send_over_rtx) {
740 UpdateDelayStatistics(packet->capture_time_ms(), now_ms); 741 UpdateDelayStatistics(packet->capture_time_ms(), now_ms);
741 UpdateOnSendPacket(options.packet_id, packet->capture_time_ms(), 742 UpdateOnSendPacket(options.packet_id, packet->capture_time_ms(),
742 packet->Ssrc()); 743 packet->Ssrc());
743 } 744 }
744 745
745 if (!SendPacketToNetwork(*packet_to_send, options)) 746 if (!SendPacketToNetwork(*packet_to_send, options, probe_cluster_id))
746 return false; 747 return false;
747 748
748 { 749 {
749 rtc::CritScope lock(&send_critsect_); 750 rtc::CritScope lock(&send_critsect_);
750 media_has_been_sent_ = true; 751 media_has_been_sent_ = true;
751 } 752 }
752 UpdateRtpStats(*packet_to_send, send_over_rtx, is_retransmit); 753 UpdateRtpStats(*packet_to_send, send_over_rtx, is_retransmit);
753 return true; 754 return true;
754 } 755 }
755 756
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 PacketOptions options; 865 PacketOptions options;
865 if (UpdateTransportSequenceNumber(packet.get(), &options.packet_id)) { 866 if (UpdateTransportSequenceNumber(packet.get(), &options.packet_id)) {
866 AddPacketToTransportFeedback(options.packet_id, *packet.get(), 867 AddPacketToTransportFeedback(options.packet_id, *packet.get(),
867 PacketInfo::kNotAProbe); 868 PacketInfo::kNotAProbe);
868 } 869 }
869 870
870 UpdateDelayStatistics(packet->capture_time_ms(), now_ms); 871 UpdateDelayStatistics(packet->capture_time_ms(), now_ms);
871 UpdateOnSendPacket(options.packet_id, packet->capture_time_ms(), 872 UpdateOnSendPacket(options.packet_id, packet->capture_time_ms(),
872 packet->Ssrc()); 873 packet->Ssrc());
873 874
874 bool sent = SendPacketToNetwork(*packet, options); 875 bool sent = SendPacketToNetwork(*packet, options, PacketInfo::kNotAProbe);
875 876
876 if (sent) { 877 if (sent) {
877 { 878 {
878 rtc::CritScope lock(&send_critsect_); 879 rtc::CritScope lock(&send_critsect_);
879 media_has_been_sent_ = true; 880 media_has_been_sent_ = true;
880 } 881 }
881 UpdateRtpStats(*packet, false, false); 882 UpdateRtpStats(*packet, false, false);
882 } 883 }
883 884
884 // To support retransmissions, we store the media packet as sent in the 885 // To support retransmissions, we store the media packet as sent in the
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) { 1279 if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) {
1279 return; 1280 return;
1280 } 1281 }
1281 rtp_overhead_bytes_per_packet_ = packet.headers_size(); 1282 rtp_overhead_bytes_per_packet_ = packet.headers_size();
1282 overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_; 1283 overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_;
1283 } 1284 }
1284 overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet); 1285 overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet);
1285 } 1286 }
1286 1287
1287 } // namespace webrtc 1288 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698