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 11 matching lines...) Expand all Loading... |
22 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 22 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
23 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" | 23 #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h" |
24 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h" | 24 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h" |
25 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 25 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
26 #include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h" | 26 #include "webrtc/modules/rtp_rtcp/source/playout_delay_oracle.h" |
27 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" | 27 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" |
28 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h" | 28 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h" |
29 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h" | 29 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h" |
30 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_video.h" | 30 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_video.h" |
31 #include "webrtc/modules/rtp_rtcp/source/time_util.h" | 31 #include "webrtc/modules/rtp_rtcp/source/time_util.h" |
32 #include "webrtc/system_wrappers/include/field_trial.h" | |
33 | 32 |
34 namespace webrtc { | 33 namespace webrtc { |
35 | 34 |
36 namespace { | 35 namespace { |
37 // Max in the RFC 3550 is 255 bytes, we limit it to be modulus 32 for SRTP. | 36 // Max in the RFC 3550 is 255 bytes, we limit it to be modulus 32 for SRTP. |
38 constexpr size_t kMaxPaddingLength = 224; | 37 constexpr size_t kMaxPaddingLength = 224; |
39 constexpr size_t kMinAudioPaddingLength = 50; | 38 constexpr size_t kMinAudioPaddingLength = 50; |
40 constexpr int kSendSideDelayWindowMs = 1000; | 39 constexpr int kSendSideDelayWindowMs = 1000; |
41 constexpr size_t kRtpHeaderLength = 12; | 40 constexpr size_t kRtpHeaderLength = 12; |
42 constexpr uint16_t kMaxInitRtpSeqNumber = 32767; // 2^15 -1. | 41 constexpr uint16_t kMaxInitRtpSeqNumber = 32767; // 2^15 -1. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 sequence_number_forced_(false), | 114 sequence_number_forced_(false), |
116 last_rtp_timestamp_(0), | 115 last_rtp_timestamp_(0), |
117 capture_time_ms_(0), | 116 capture_time_ms_(0), |
118 last_timestamp_time_ms_(0), | 117 last_timestamp_time_ms_(0), |
119 media_has_been_sent_(false), | 118 media_has_been_sent_(false), |
120 last_packet_marker_bit_(false), | 119 last_packet_marker_bit_(false), |
121 csrcs_(), | 120 csrcs_(), |
122 rtx_(kRtxOff), | 121 rtx_(kRtxOff), |
123 rtp_overhead_bytes_per_packet_(0), | 122 rtp_overhead_bytes_per_packet_(0), |
124 retransmission_rate_limiter_(retransmission_rate_limiter), | 123 retransmission_rate_limiter_(retransmission_rate_limiter), |
125 overhead_observer_(overhead_observer), | 124 overhead_observer_(overhead_observer) { |
126 send_side_bwe_with_overhead_( | |
127 webrtc::field_trial::IsEnabled("WebRTC-SendSideBwe-WithOverhead")) { | |
128 // This random initialization is not intended to be cryptographic strong. | 125 // This random initialization is not intended to be cryptographic strong. |
129 timestamp_offset_ = random_.Rand<uint32_t>(); | 126 timestamp_offset_ = random_.Rand<uint32_t>(); |
130 // Random start, 16 bits. Can't be 0. | 127 // Random start, 16 bits. Can't be 0. |
131 sequence_number_rtx_ = random_.Rand(1, kMaxInitRtpSeqNumber); | 128 sequence_number_rtx_ = random_.Rand(1, kMaxInitRtpSeqNumber); |
132 sequence_number_ = random_.Rand(1, kMaxInitRtpSeqNumber); | 129 sequence_number_ = random_.Rand(1, kMaxInitRtpSeqNumber); |
133 | 130 |
134 // Store FlexFEC packets in the packet history data structure, so they can | 131 // Store FlexFEC packets in the packet history data structure, so they can |
135 // be found when paced. | 132 // be found when paced. |
136 if (flexfec_sender) { | 133 if (flexfec_sender) { |
137 flexfec_packet_history_.SetStorePacketsStatus( | 134 flexfec_packet_history_.SetStorePacketsStatus( |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 state.sequence_number = sequence_number_rtx_; | 1227 state.sequence_number = sequence_number_rtx_; |
1231 state.start_timestamp = timestamp_offset_; | 1228 state.start_timestamp = timestamp_offset_; |
1232 | 1229 |
1233 return state; | 1230 return state; |
1234 } | 1231 } |
1235 | 1232 |
1236 void RTPSender::AddPacketToTransportFeedback( | 1233 void RTPSender::AddPacketToTransportFeedback( |
1237 uint16_t packet_id, | 1234 uint16_t packet_id, |
1238 const RtpPacketToSend& packet, | 1235 const RtpPacketToSend& packet, |
1239 const PacedPacketInfo& pacing_info) { | 1236 const PacedPacketInfo& pacing_info) { |
1240 size_t packet_size = packet.payload_size() + packet.padding_size(); | |
1241 if (send_side_bwe_with_overhead_) { | |
1242 packet_size = packet.size(); | |
1243 } | |
1244 | |
1245 if (transport_feedback_observer_) { | 1237 if (transport_feedback_observer_) { |
1246 transport_feedback_observer_->AddPacket(SSRC(), packet_id, packet_size, | 1238 transport_feedback_observer_->AddPacket( |
1247 pacing_info); | 1239 SSRC(), packet_id, packet.payload_size() + packet.padding_size(), |
| 1240 packet.headers_size(), pacing_info); |
1248 } | 1241 } |
1249 } | 1242 } |
1250 | 1243 |
1251 void RTPSender::UpdateRtpOverhead(const RtpPacketToSend& packet) { | 1244 void RTPSender::UpdateRtpOverhead(const RtpPacketToSend& packet) { |
1252 if (!overhead_observer_) | 1245 if (!overhead_observer_) |
1253 return; | 1246 return; |
1254 size_t overhead_bytes_per_packet; | 1247 size_t overhead_bytes_per_packet; |
1255 { | 1248 { |
1256 rtc::CritScope lock(&send_critsect_); | 1249 rtc::CritScope lock(&send_critsect_); |
1257 if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) { | 1250 if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) { |
1258 return; | 1251 return; |
1259 } | 1252 } |
1260 rtp_overhead_bytes_per_packet_ = packet.headers_size(); | 1253 rtp_overhead_bytes_per_packet_ = packet.headers_size(); |
1261 overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_; | 1254 overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_; |
1262 } | 1255 } |
1263 overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet); | 1256 overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet); |
1264 } | 1257 } |
1265 | 1258 |
1266 } // namespace webrtc | 1259 } // namespace webrtc |
OLD | NEW |