| 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 |
| 11 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" | 11 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 #include <utility> | 14 #include <utility> |
| 15 | 15 |
| 16 #include "webrtc/logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h" |
| 16 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 17 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
| 17 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" | 18 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" |
| 18 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h" | 19 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h" |
| 19 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 20 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 20 #include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h" | 21 #include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h" |
| 21 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" | 22 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" |
| 22 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h" | 23 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h" |
| 23 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h" | 24 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h" |
| 24 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_video.h" | 25 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_video.h" |
| 25 #include "webrtc/modules/rtp_rtcp/source/time_util.h" | 26 #include "webrtc/modules/rtp_rtcp/source/time_util.h" |
| 26 #include "webrtc/rtc_base/arraysize.h" | 27 #include "webrtc/rtc_base/arraysize.h" |
| 27 #include "webrtc/rtc_base/checks.h" | 28 #include "webrtc/rtc_base/checks.h" |
| 28 #include "webrtc/rtc_base/logging.h" | 29 #include "webrtc/rtc_base/logging.h" |
| 30 #include "webrtc/rtc_base/ptr_util.h" |
| 29 #include "webrtc/rtc_base/rate_limiter.h" | 31 #include "webrtc/rtc_base/rate_limiter.h" |
| 30 #include "webrtc/rtc_base/safe_minmax.h" | 32 #include "webrtc/rtc_base/safe_minmax.h" |
| 31 #include "webrtc/rtc_base/timeutils.h" | 33 #include "webrtc/rtc_base/timeutils.h" |
| 32 #include "webrtc/rtc_base/trace_event.h" | 34 #include "webrtc/rtc_base/trace_event.h" |
| 33 #include "webrtc/system_wrappers/include/field_trial.h" | 35 #include "webrtc/system_wrappers/include/field_trial.h" |
| 34 | 36 |
| 35 namespace webrtc { | 37 namespace webrtc { |
| 36 | 38 |
| 37 namespace { | 39 namespace { |
| 38 // Max in the RFC 3550 is 255 bytes, we limit it to be modulus 32 for SRTP. | 40 // Max in the RFC 3550 is 255 bytes, we limit it to be modulus 32 for SRTP. |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 bool RTPSender::SendPacketToNetwork(const RtpPacketToSend& packet, | 637 bool RTPSender::SendPacketToNetwork(const RtpPacketToSend& packet, |
| 636 const PacketOptions& options, | 638 const PacketOptions& options, |
| 637 const PacedPacketInfo& pacing_info) { | 639 const PacedPacketInfo& pacing_info) { |
| 638 int bytes_sent = -1; | 640 int bytes_sent = -1; |
| 639 if (transport_) { | 641 if (transport_) { |
| 640 UpdateRtpOverhead(packet); | 642 UpdateRtpOverhead(packet); |
| 641 bytes_sent = transport_->SendRtp(packet.data(), packet.size(), options) | 643 bytes_sent = transport_->SendRtp(packet.data(), packet.size(), options) |
| 642 ? static_cast<int>(packet.size()) | 644 ? static_cast<int>(packet.size()) |
| 643 : -1; | 645 : -1; |
| 644 if (event_log_ && bytes_sent > 0) { | 646 if (event_log_ && bytes_sent > 0) { |
| 645 event_log_->LogOutgoingRtpHeader(packet, pacing_info.probe_cluster_id); | 647 event_log_->Log(rtc::MakeUnique<RtcEventRtpPacketOutgoing>( |
| 648 packet, pacing_info.probe_cluster_id)); |
| 646 } | 649 } |
| 647 } | 650 } |
| 648 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 651 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
| 649 "RTPSender::SendPacketToNetwork", "size", packet.size(), | 652 "RTPSender::SendPacketToNetwork", "size", packet.size(), |
| 650 "sent", bytes_sent); | 653 "sent", bytes_sent); |
| 651 // TODO(pwestin): Add a separate bitrate for sent bitrate after pacer. | 654 // TODO(pwestin): Add a separate bitrate for sent bitrate after pacer. |
| 652 if (bytes_sent <= 0) { | 655 if (bytes_sent <= 0) { |
| 653 LOG(LS_WARNING) << "Transport failed to send packet."; | 656 LOG(LS_WARNING) << "Transport failed to send packet."; |
| 654 return false; | 657 return false; |
| 655 } | 658 } |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 rtc::CritScope lock(&send_critsect_); | 1308 rtc::CritScope lock(&send_critsect_); |
| 1306 packet->SetTimestamp(last_rtp_timestamp_); | 1309 packet->SetTimestamp(last_rtp_timestamp_); |
| 1307 packet->set_capture_time_ms(capture_time_ms_); | 1310 packet->set_capture_time_ms(capture_time_ms_); |
| 1308 } | 1311 } |
| 1309 AssignSequenceNumber(packet.get()); | 1312 AssignSequenceNumber(packet.get()); |
| 1310 SendToNetwork(std::move(packet), StorageType::kDontRetransmit, | 1313 SendToNetwork(std::move(packet), StorageType::kDontRetransmit, |
| 1311 RtpPacketSender::Priority::kLowPriority); | 1314 RtpPacketSender::Priority::kLowPriority); |
| 1312 } | 1315 } |
| 1313 | 1316 |
| 1314 } // namespace webrtc | 1317 } // namespace webrtc |
| OLD | NEW |