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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 | 63 |
64 // Deprecated. | 64 // Deprecated. |
65 int32_t RtpRtcp::SetFecParameters(const FecProtectionParams* delta_params, | 65 int32_t RtpRtcp::SetFecParameters(const FecProtectionParams* delta_params, |
66 const FecProtectionParams* key_params) { | 66 const FecProtectionParams* key_params) { |
67 RTC_DCHECK(delta_params); | 67 RTC_DCHECK(delta_params); |
68 RTC_DCHECK(key_params); | 68 RTC_DCHECK(key_params); |
69 return SetFecParameters(*delta_params, *key_params) ? 0 : -1; | 69 return SetFecParameters(*delta_params, *key_params) ? 0 : -1; |
70 } | 70 } |
71 | 71 |
72 ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration) | 72 ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration) |
73 : rtp_sender_(configuration.audio, | 73 : rtcp_sender_(configuration.audio, |
74 configuration.clock, | |
75 configuration.outgoing_transport, | |
76 configuration.paced_sender, | |
77 configuration.flexfec_sender, | |
78 configuration.transport_sequence_number_allocator, | |
79 configuration.transport_feedback_callback, | |
80 configuration.send_bitrate_observer, | |
81 configuration.send_frame_count_observer, | |
82 configuration.send_side_delay_observer, | |
83 configuration.event_log, | |
84 configuration.send_packet_observer, | |
85 configuration.retransmission_rate_limiter, | |
86 configuration.overhead_observer), | |
87 rtcp_sender_(configuration.audio, | |
88 configuration.clock, | 74 configuration.clock, |
89 configuration.receive_statistics, | 75 configuration.receive_statistics, |
90 configuration.rtcp_packet_type_counter_observer, | 76 configuration.rtcp_packet_type_counter_observer, |
91 configuration.event_log, | 77 configuration.event_log, |
92 configuration.outgoing_transport), | 78 configuration.outgoing_transport), |
93 rtcp_receiver_(configuration.clock, | 79 rtcp_receiver_(configuration.clock, |
94 configuration.receiver_only, | 80 configuration.receiver_only, |
95 configuration.rtcp_packet_type_counter_observer, | 81 configuration.rtcp_packet_type_counter_observer, |
96 configuration.bandwidth_callback, | 82 configuration.bandwidth_callback, |
97 configuration.intra_frame_callback, | 83 configuration.intra_frame_callback, |
98 configuration.transport_feedback_callback, | 84 configuration.transport_feedback_callback, |
99 configuration.bitrate_allocation_observer, | 85 configuration.bitrate_allocation_observer, |
100 this), | 86 this), |
101 clock_(configuration.clock), | 87 clock_(configuration.clock), |
102 audio_(configuration.audio), | 88 audio_(configuration.audio), |
103 last_process_time_(configuration.clock->TimeInMilliseconds()), | 89 last_process_time_(configuration.clock->TimeInMilliseconds()), |
104 last_bitrate_process_time_(configuration.clock->TimeInMilliseconds()), | 90 last_bitrate_process_time_(configuration.clock->TimeInMilliseconds()), |
105 last_rtt_process_time_(configuration.clock->TimeInMilliseconds()), | 91 last_rtt_process_time_(configuration.clock->TimeInMilliseconds()), |
106 packet_overhead_(28), // IPV4 UDP. | 92 packet_overhead_(28), // IPV4 UDP. |
107 nack_last_time_sent_full_(0), | 93 nack_last_time_sent_full_(0), |
108 nack_last_time_sent_full_prev_(0), | 94 nack_last_time_sent_full_prev_(0), |
109 nack_last_seq_number_sent_(0), | 95 nack_last_seq_number_sent_(0), |
110 key_frame_req_method_(kKeyFrameReqPliRtcp), | 96 key_frame_req_method_(kKeyFrameReqPliRtcp), |
111 remote_bitrate_(configuration.remote_bitrate_estimator), | 97 remote_bitrate_(configuration.remote_bitrate_estimator), |
112 rtt_stats_(configuration.rtt_stats), | 98 rtt_stats_(configuration.rtt_stats), |
113 rtt_ms_(0) { | 99 rtt_ms_(0) { |
114 // Make sure rtcp sender use same timestamp offset as rtp sender. | 100 if (!configuration.receiver_only) { |
115 rtcp_sender_.SetTimestampOffset(rtp_sender_.TimestampOffset()); | 101 rtp_sender_.reset(new RTPSender( |
102 configuration.audio, | |
103 configuration.clock, | |
104 configuration.outgoing_transport, | |
105 configuration.paced_sender, | |
106 configuration.flexfec_sender, | |
107 configuration.transport_sequence_number_allocator, | |
108 configuration.transport_feedback_callback, | |
109 configuration.send_bitrate_observer, | |
110 configuration.send_frame_count_observer, | |
111 configuration.send_side_delay_observer, | |
112 configuration.event_log, | |
113 configuration.send_packet_observer, | |
114 configuration.retransmission_rate_limiter, | |
115 configuration.overhead_observer)); | |
116 // Make sure rtcp sender use same timestamp offset as rtp sender. | |
117 rtcp_sender_.SetTimestampOffset(rtp_sender_->TimestampOffset()); | |
118 } | |
116 | 119 |
117 // Set default packet size limit. | 120 // Set default packet size limit. |
118 // TODO(nisse): Kind-of duplicates | 121 // TODO(nisse): Kind-of duplicates |
119 // webrtc::VideoSendStream::Config::Rtp::kDefaultMaxPacketSize. | 122 // webrtc::VideoSendStream::Config::Rtp::kDefaultMaxPacketSize. |
120 const size_t kTcpOverIpv4HeaderSize = 40; | 123 const size_t kTcpOverIpv4HeaderSize = 40; |
121 SetMaxRtpPacketSize(IP_PACKET_SIZE - kTcpOverIpv4HeaderSize); | 124 SetMaxRtpPacketSize(IP_PACKET_SIZE - kTcpOverIpv4HeaderSize); |
122 } | 125 } |
123 | 126 |
124 // Returns the number of milliseconds until the module want a worker thread | 127 // Returns the number of milliseconds until the module want a worker thread |
125 // to call Process. | 128 // to call Process. |
126 int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() { | 129 int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() { |
127 const int64_t now = clock_->TimeInMilliseconds(); | 130 const int64_t now = clock_->TimeInMilliseconds(); |
128 const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5; | 131 const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5; |
129 return kRtpRtcpMaxIdleTimeProcessMs - (now - last_process_time_); | 132 return kRtpRtcpMaxIdleTimeProcessMs - (now - last_process_time_); |
130 } | 133 } |
131 | 134 |
132 // Process any pending tasks such as timeouts (non time critical events). | 135 // Process any pending tasks such as timeouts (non time critical events). |
133 void ModuleRtpRtcpImpl::Process() { | 136 void ModuleRtpRtcpImpl::Process() { |
134 const int64_t now = clock_->TimeInMilliseconds(); | 137 const int64_t now = clock_->TimeInMilliseconds(); |
135 last_process_time_ = now; | 138 last_process_time_ = now; |
136 | 139 |
137 const int64_t kRtpRtcpBitrateProcessTimeMs = 10; | 140 if (rtp_sender_) { |
138 if (now >= last_bitrate_process_time_ + kRtpRtcpBitrateProcessTimeMs) { | 141 const int64_t kRtpRtcpBitrateProcessTimeMs = 10; |
139 rtp_sender_.ProcessBitrate(); | 142 if (now >= last_bitrate_process_time_ + kRtpRtcpBitrateProcessTimeMs) { |
140 last_bitrate_process_time_ = now; | 143 rtp_sender_->ProcessBitrate(); |
144 last_bitrate_process_time_ = now; | |
145 } | |
141 } | 146 } |
142 | |
143 const int64_t kRtpRtcpRttProcessTimeMs = 1000; | 147 const int64_t kRtpRtcpRttProcessTimeMs = 1000; |
144 bool process_rtt = now >= last_rtt_process_time_ + kRtpRtcpRttProcessTimeMs; | 148 bool process_rtt = now >= last_rtt_process_time_ + kRtpRtcpRttProcessTimeMs; |
145 if (rtcp_sender_.Sending()) { | 149 if (rtcp_sender_.Sending()) { |
146 // Process RTT if we have received a receiver report and we haven't | 150 // Process RTT if we have received a receiver report and we haven't |
147 // processed RTT for at least |kRtpRtcpRttProcessTimeMs| milliseconds. | 151 // processed RTT for at least |kRtpRtcpRttProcessTimeMs| milliseconds. |
148 if (rtcp_receiver_.LastReceivedReceiverReport() > | 152 if (rtcp_receiver_.LastReceivedReceiverReport() > |
149 last_rtt_process_time_ && process_rtt) { | 153 last_rtt_process_time_ && process_rtt) { |
150 std::vector<RTCPReportBlock> receive_blocks; | 154 std::vector<RTCPReportBlock> receive_blocks; |
151 rtcp_receiver_.StatisticsReceived(&receive_blocks); | 155 rtcp_receiver_.StatisticsReceived(&receive_blocks); |
152 int64_t max_rtt = 0; | 156 int64_t max_rtt = 0; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 | 208 |
205 if (rtcp_sender_.TimeToSendRTCPReport()) | 209 if (rtcp_sender_.TimeToSendRTCPReport()) |
206 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); | 210 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); |
207 | 211 |
208 if (TMMBR() && rtcp_receiver_.UpdateTmmbrTimers()) { | 212 if (TMMBR() && rtcp_receiver_.UpdateTmmbrTimers()) { |
209 rtcp_receiver_.NotifyTmmbrUpdated(); | 213 rtcp_receiver_.NotifyTmmbrUpdated(); |
210 } | 214 } |
211 } | 215 } |
212 | 216 |
213 void ModuleRtpRtcpImpl::SetRtxSendStatus(int mode) { | 217 void ModuleRtpRtcpImpl::SetRtxSendStatus(int mode) { |
214 rtp_sender_.SetRtxStatus(mode); | 218 rtp_sender_->SetRtxStatus(mode); |
215 } | 219 } |
216 | 220 |
217 int ModuleRtpRtcpImpl::RtxSendStatus() const { | 221 int ModuleRtpRtcpImpl::RtxSendStatus() const { |
218 return rtp_sender_.RtxStatus(); | 222 return rtp_sender_ ? rtp_sender_->RtxStatus() : kRtxOff; |
219 } | 223 } |
220 | 224 |
221 void ModuleRtpRtcpImpl::SetRtxSsrc(uint32_t ssrc) { | 225 void ModuleRtpRtcpImpl::SetRtxSsrc(uint32_t ssrc) { |
222 rtp_sender_.SetRtxSsrc(ssrc); | 226 rtp_sender_->SetRtxSsrc(ssrc); |
223 } | 227 } |
224 | 228 |
225 void ModuleRtpRtcpImpl::SetRtxSendPayloadType(int payload_type, | 229 void ModuleRtpRtcpImpl::SetRtxSendPayloadType(int payload_type, |
226 int associated_payload_type) { | 230 int associated_payload_type) { |
227 rtp_sender_.SetRtxPayloadType(payload_type, associated_payload_type); | 231 rtp_sender_->SetRtxPayloadType(payload_type, associated_payload_type); |
228 } | 232 } |
229 | 233 |
230 rtc::Optional<uint32_t> ModuleRtpRtcpImpl::FlexfecSsrc() const { | 234 rtc::Optional<uint32_t> ModuleRtpRtcpImpl::FlexfecSsrc() const { |
231 return rtp_sender_.FlexfecSsrc(); | 235 return rtp_sender_->FlexfecSsrc(); |
232 } | 236 } |
233 | 237 |
234 int32_t ModuleRtpRtcpImpl::IncomingRtcpPacket( | 238 int32_t ModuleRtpRtcpImpl::IncomingRtcpPacket( |
235 const uint8_t* rtcp_packet, | 239 const uint8_t* rtcp_packet, |
236 const size_t length) { | 240 const size_t length) { |
237 return rtcp_receiver_.IncomingPacket(rtcp_packet, length) ? 0 : -1; | 241 return rtcp_receiver_.IncomingPacket(rtcp_packet, length) ? 0 : -1; |
238 } | 242 } |
239 | 243 |
240 int32_t ModuleRtpRtcpImpl::RegisterSendPayload( | 244 int32_t ModuleRtpRtcpImpl::RegisterSendPayload( |
241 const CodecInst& voice_codec) { | 245 const CodecInst& voice_codec) { |
242 return rtp_sender_.RegisterPayload( | 246 return rtp_sender_->RegisterPayload( |
243 voice_codec.plname, voice_codec.pltype, voice_codec.plfreq, | 247 voice_codec.plname, voice_codec.pltype, voice_codec.plfreq, |
244 voice_codec.channels, (voice_codec.rate < 0) ? 0 : voice_codec.rate); | 248 voice_codec.channels, (voice_codec.rate < 0) ? 0 : voice_codec.rate); |
245 } | 249 } |
246 | 250 |
247 int32_t ModuleRtpRtcpImpl::RegisterSendPayload(const VideoCodec& video_codec) { | 251 int32_t ModuleRtpRtcpImpl::RegisterSendPayload(const VideoCodec& video_codec) { |
248 return rtp_sender_.RegisterPayload(video_codec.plName, video_codec.plType, | 252 return rtp_sender_->RegisterPayload(video_codec.plName, video_codec.plType, |
249 90000, 0, 0); | 253 90000, 0, 0); |
250 } | 254 } |
251 | 255 |
252 void ModuleRtpRtcpImpl::RegisterVideoSendPayload(int payload_type, | 256 void ModuleRtpRtcpImpl::RegisterVideoSendPayload(int payload_type, |
253 const char* payload_name) { | 257 const char* payload_name) { |
254 RTC_CHECK_EQ( | 258 RTC_CHECK_EQ( |
255 0, rtp_sender_.RegisterPayload(payload_name, payload_type, 90000, 0, 0)); | 259 0, rtp_sender_->RegisterPayload(payload_name, payload_type, 90000, 0, 0)); |
256 } | 260 } |
257 | 261 |
258 int32_t ModuleRtpRtcpImpl::DeRegisterSendPayload(const int8_t payload_type) { | 262 int32_t ModuleRtpRtcpImpl::DeRegisterSendPayload(const int8_t payload_type) { |
259 return rtp_sender_.DeRegisterSendPayload(payload_type); | 263 return rtp_sender_->DeRegisterSendPayload(payload_type); |
260 } | 264 } |
261 | 265 |
262 uint32_t ModuleRtpRtcpImpl::StartTimestamp() const { | 266 uint32_t ModuleRtpRtcpImpl::StartTimestamp() const { |
263 return rtp_sender_.TimestampOffset(); | 267 return rtp_sender_->TimestampOffset(); |
264 } | 268 } |
265 | 269 |
266 // Configure start timestamp, default is a random number. | 270 // Configure start timestamp, default is a random number. |
267 void ModuleRtpRtcpImpl::SetStartTimestamp(const uint32_t timestamp) { | 271 void ModuleRtpRtcpImpl::SetStartTimestamp(const uint32_t timestamp) { |
268 rtcp_sender_.SetTimestampOffset(timestamp); | 272 rtcp_sender_.SetTimestampOffset(timestamp); |
269 rtp_sender_.SetTimestampOffset(timestamp); | 273 rtp_sender_->SetTimestampOffset(timestamp); |
270 } | 274 } |
271 | 275 |
272 uint16_t ModuleRtpRtcpImpl::SequenceNumber() const { | 276 uint16_t ModuleRtpRtcpImpl::SequenceNumber() const { |
273 return rtp_sender_.SequenceNumber(); | 277 return rtp_sender_->SequenceNumber(); |
274 } | 278 } |
275 | 279 |
276 // Set SequenceNumber, default is a random number. | 280 // Set SequenceNumber, default is a random number. |
277 void ModuleRtpRtcpImpl::SetSequenceNumber(const uint16_t seq_num) { | 281 void ModuleRtpRtcpImpl::SetSequenceNumber(const uint16_t seq_num) { |
278 rtp_sender_.SetSequenceNumber(seq_num); | 282 rtp_sender_->SetSequenceNumber(seq_num); |
279 } | 283 } |
280 | 284 |
281 void ModuleRtpRtcpImpl::SetRtpState(const RtpState& rtp_state) { | 285 void ModuleRtpRtcpImpl::SetRtpState(const RtpState& rtp_state) { |
282 rtp_sender_.SetRtpState(rtp_state); | 286 rtp_sender_->SetRtpState(rtp_state); |
283 rtcp_sender_.SetTimestampOffset(rtp_state.start_timestamp); | 287 rtcp_sender_.SetTimestampOffset(rtp_state.start_timestamp); |
284 } | 288 } |
285 | 289 |
286 void ModuleRtpRtcpImpl::SetRtxState(const RtpState& rtp_state) { | 290 void ModuleRtpRtcpImpl::SetRtxState(const RtpState& rtp_state) { |
287 rtp_sender_.SetRtxRtpState(rtp_state); | 291 rtp_sender_->SetRtxRtpState(rtp_state); |
288 } | 292 } |
289 | 293 |
290 RtpState ModuleRtpRtcpImpl::GetRtpState() const { | 294 RtpState ModuleRtpRtcpImpl::GetRtpState() const { |
291 return rtp_sender_.GetRtpState(); | 295 return rtp_sender_->GetRtpState(); |
292 } | 296 } |
293 | 297 |
294 RtpState ModuleRtpRtcpImpl::GetRtxState() const { | 298 RtpState ModuleRtpRtcpImpl::GetRtxState() const { |
295 return rtp_sender_.GetRtxRtpState(); | 299 return rtp_sender_->GetRtxRtpState(); |
296 } | 300 } |
297 | 301 |
298 uint32_t ModuleRtpRtcpImpl::SSRC() const { | 302 uint32_t ModuleRtpRtcpImpl::SSRC() const { |
299 return rtp_sender_.SSRC(); | 303 return rtcp_sender_.SSRC(); |
300 } | 304 } |
301 | 305 |
302 void ModuleRtpRtcpImpl::SetSSRC(const uint32_t ssrc) { | 306 void ModuleRtpRtcpImpl::SetSSRC(const uint32_t ssrc) { |
303 rtp_sender_.SetSSRC(ssrc); | 307 if (rtp_sender_) { |
308 rtp_sender_->SetSSRC(ssrc); | |
309 } | |
304 rtcp_sender_.SetSSRC(ssrc); | 310 rtcp_sender_.SetSSRC(ssrc); |
305 SetRtcpReceiverSsrcs(ssrc); | 311 SetRtcpReceiverSsrcs(ssrc); |
306 } | 312 } |
307 | 313 |
308 void ModuleRtpRtcpImpl::SetCsrcs(const std::vector<uint32_t>& csrcs) { | 314 void ModuleRtpRtcpImpl::SetCsrcs(const std::vector<uint32_t>& csrcs) { |
309 rtcp_sender_.SetCsrcs(csrcs); | 315 rtcp_sender_.SetCsrcs(csrcs); |
310 rtp_sender_.SetCsrcs(csrcs); | 316 rtp_sender_->SetCsrcs(csrcs); |
311 } | 317 } |
312 | 318 |
313 // TODO(pbos): Handle media and RTX streams separately (separate RTCP | 319 // TODO(pbos): Handle media and RTX streams separately (separate RTCP |
314 // feedbacks). | 320 // feedbacks). |
315 RTCPSender::FeedbackState ModuleRtpRtcpImpl::GetFeedbackState() { | 321 RTCPSender::FeedbackState ModuleRtpRtcpImpl::GetFeedbackState() { |
316 StreamDataCounters rtp_stats; | |
317 StreamDataCounters rtx_stats; | |
318 rtp_sender_.GetDataCounters(&rtp_stats, &rtx_stats); | |
319 | |
320 RTCPSender::FeedbackState state; | 322 RTCPSender::FeedbackState state; |
321 state.send_payload_type = rtp_sender_.SendPayloadType(); | 323 // This is called also when receiver_only is true. Hence below |
322 state.packets_sent = rtp_stats.transmitted.packets + | 324 // checks that rtp_sender_ exists. |
323 rtx_stats.transmitted.packets; | 325 if (rtp_sender_) { |
324 state.media_bytes_sent = rtp_stats.transmitted.payload_bytes + | 326 StreamDataCounters rtp_stats; |
325 rtx_stats.transmitted.payload_bytes; | 327 StreamDataCounters rtx_stats; |
328 rtp_sender_->GetDataCounters(&rtp_stats, &rtx_stats); | |
329 state.packets_sent = rtp_stats.transmitted.packets + | |
330 rtx_stats.transmitted.packets; | |
331 state.media_bytes_sent = rtp_stats.transmitted.payload_bytes + | |
332 rtx_stats.transmitted.payload_bytes; | |
333 state.send_bitrate = rtp_sender_->BitrateSent(); | |
334 } | |
326 state.module = this; | 335 state.module = this; |
327 | 336 |
328 LastReceivedNTP(&state.last_rr_ntp_secs, | 337 LastReceivedNTP(&state.last_rr_ntp_secs, |
329 &state.last_rr_ntp_frac, | 338 &state.last_rr_ntp_frac, |
330 &state.remote_sr); | 339 &state.remote_sr); |
331 | 340 |
332 state.has_last_xr_rr = | 341 state.has_last_xr_rr = |
333 rtcp_receiver_.LastReceivedXrReferenceTimeInfo(&state.last_xr_rr); | 342 rtcp_receiver_.LastReceivedXrReferenceTimeInfo(&state.last_xr_rr); |
334 | 343 |
335 uint32_t tmp; | |
336 BitrateSent(&state.send_bitrate, &tmp, &tmp, &tmp); | |
337 return state; | 344 return state; |
338 } | 345 } |
339 | 346 |
347 // TODO(nisse): The | |
348 // TestWithNewVideoJitterBuffer/EndToEndTest.RembWithSendSideBwe/* tests call | |
349 // this method for a receive-only stream, which makes little sense. If that is | |
stefan-webrtc
2017/03/17 12:31:29
I think this was because a receiver had to be send
nisse-webrtc
2017/03/17 12:49:35
It looks like this is the only call to rtcp_sender
| |
350 // fixed, the rtp_sender_ check can be removed. | |
340 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) { | 351 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) { |
341 if (rtcp_sender_.Sending() != sending) { | 352 if (rtcp_sender_.Sending() != sending) { |
342 // Sends RTCP BYE when going from true to false | 353 // Sends RTCP BYE when going from true to false |
343 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) { | 354 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) { |
344 LOG(LS_WARNING) << "Failed to send RTCP BYE"; | 355 LOG(LS_WARNING) << "Failed to send RTCP BYE"; |
345 } | 356 } |
346 if (sending) { | 357 if (sending && rtp_sender_) { |
347 // Update Rtcp receiver config, to track Rtx config changes from | 358 // Update Rtcp receiver config, to track Rtx config changes from |
348 // the SetRtxStatus and SetRtxSsrc methods. | 359 // the SetRtxStatus and SetRtxSsrc methods. |
349 SetRtcpReceiverSsrcs(rtp_sender_.SSRC()); | 360 SetRtcpReceiverSsrcs(rtp_sender_->SSRC()); |
350 } | 361 } |
351 } | 362 } |
352 return 0; | 363 return 0; |
353 } | 364 } |
354 | 365 |
355 bool ModuleRtpRtcpImpl::Sending() const { | 366 bool ModuleRtpRtcpImpl::Sending() const { |
356 return rtcp_sender_.Sending(); | 367 return rtcp_sender_.Sending(); |
357 } | 368 } |
358 | 369 |
359 void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) { | 370 void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) { |
360 rtp_sender_.SetSendingMediaStatus(sending); | 371 if (rtp_sender_) { |
372 rtp_sender_->SetSendingMediaStatus(sending); | |
373 } else { | |
374 RTC_DCHECK(!sending); | |
375 } | |
361 } | 376 } |
362 | 377 |
363 bool ModuleRtpRtcpImpl::SendingMedia() const { | 378 bool ModuleRtpRtcpImpl::SendingMedia() const { |
364 return rtp_sender_.SendingMedia(); | 379 return rtp_sender_ ? rtp_sender_->SendingMedia() : false; |
365 } | 380 } |
366 | 381 |
367 bool ModuleRtpRtcpImpl::SendOutgoingData( | 382 bool ModuleRtpRtcpImpl::SendOutgoingData( |
368 FrameType frame_type, | 383 FrameType frame_type, |
369 int8_t payload_type, | 384 int8_t payload_type, |
370 uint32_t time_stamp, | 385 uint32_t time_stamp, |
371 int64_t capture_time_ms, | 386 int64_t capture_time_ms, |
372 const uint8_t* payload_data, | 387 const uint8_t* payload_data, |
373 size_t payload_size, | 388 size_t payload_size, |
374 const RTPFragmentationHeader* fragmentation, | 389 const RTPFragmentationHeader* fragmentation, |
375 const RTPVideoHeader* rtp_video_header, | 390 const RTPVideoHeader* rtp_video_header, |
376 uint32_t* transport_frame_id_out) { | 391 uint32_t* transport_frame_id_out) { |
377 rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms); | 392 rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms); |
378 // Make sure an RTCP report isn't queued behind a key frame. | 393 // Make sure an RTCP report isn't queued behind a key frame. |
379 if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) { | 394 if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) { |
380 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); | 395 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); |
381 } | 396 } |
382 return rtp_sender_.SendOutgoingData( | 397 return rtp_sender_->SendOutgoingData( |
383 frame_type, payload_type, time_stamp, capture_time_ms, payload_data, | 398 frame_type, payload_type, time_stamp, capture_time_ms, payload_data, |
384 payload_size, fragmentation, rtp_video_header, transport_frame_id_out); | 399 payload_size, fragmentation, rtp_video_header, transport_frame_id_out); |
385 } | 400 } |
386 | 401 |
387 bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc, | 402 bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc, |
388 uint16_t sequence_number, | 403 uint16_t sequence_number, |
389 int64_t capture_time_ms, | 404 int64_t capture_time_ms, |
390 bool retransmission, | 405 bool retransmission, |
391 const PacedPacketInfo& pacing_info) { | 406 const PacedPacketInfo& pacing_info) { |
392 return rtp_sender_.TimeToSendPacket(ssrc, sequence_number, capture_time_ms, | 407 return rtp_sender_->TimeToSendPacket(ssrc, sequence_number, capture_time_ms, |
393 retransmission, pacing_info); | 408 retransmission, pacing_info); |
394 } | 409 } |
395 | 410 |
396 size_t ModuleRtpRtcpImpl::TimeToSendPadding( | 411 size_t ModuleRtpRtcpImpl::TimeToSendPadding( |
397 size_t bytes, | 412 size_t bytes, |
398 const PacedPacketInfo& pacing_info) { | 413 const PacedPacketInfo& pacing_info) { |
399 return rtp_sender_.TimeToSendPadding(bytes, pacing_info); | 414 return rtp_sender_->TimeToSendPadding(bytes, pacing_info); |
400 } | 415 } |
401 | 416 |
402 size_t ModuleRtpRtcpImpl::MaxPayloadSize() const { | 417 size_t ModuleRtpRtcpImpl::MaxPayloadSize() const { |
403 return rtp_sender_.MaxPayloadSize(); | 418 return rtp_sender_->MaxPayloadSize(); |
404 } | 419 } |
405 | 420 |
406 size_t ModuleRtpRtcpImpl::MaxRtpPacketSize() const { | 421 size_t ModuleRtpRtcpImpl::MaxRtpPacketSize() const { |
407 return rtp_sender_.MaxRtpPacketSize(); | 422 return rtp_sender_->MaxRtpPacketSize(); |
408 } | 423 } |
409 | 424 |
410 void ModuleRtpRtcpImpl::SetMaxRtpPacketSize(size_t rtp_packet_size) { | 425 void ModuleRtpRtcpImpl::SetMaxRtpPacketSize(size_t rtp_packet_size) { |
411 RTC_DCHECK_LE(rtp_packet_size, IP_PACKET_SIZE) | 426 RTC_DCHECK_LE(rtp_packet_size, IP_PACKET_SIZE) |
412 << "rtp packet size too large: " << rtp_packet_size; | 427 << "rtp packet size too large: " << rtp_packet_size; |
413 RTC_DCHECK_GT(rtp_packet_size, packet_overhead_) | 428 RTC_DCHECK_GT(rtp_packet_size, packet_overhead_) |
414 << "rtp packet size too small: " << rtp_packet_size; | 429 << "rtp packet size too small: " << rtp_packet_size; |
415 | 430 |
416 rtcp_sender_.SetMaxRtpPacketSize(rtp_packet_size); | 431 rtcp_sender_.SetMaxRtpPacketSize(rtp_packet_size); |
417 rtp_sender_.SetMaxRtpPacketSize(rtp_packet_size); | 432 if (rtp_sender_) |
433 rtp_sender_->SetMaxRtpPacketSize(rtp_packet_size); | |
418 } | 434 } |
419 | 435 |
420 RtcpMode ModuleRtpRtcpImpl::RTCP() const { | 436 RtcpMode ModuleRtpRtcpImpl::RTCP() const { |
421 return rtcp_sender_.Status(); | 437 return rtcp_sender_.Status(); |
422 } | 438 } |
423 | 439 |
424 // Configure RTCP status i.e on/off. | 440 // Configure RTCP status i.e on/off. |
425 void ModuleRtpRtcpImpl::SetRTCPStatus(const RtcpMode method) { | 441 void ModuleRtpRtcpImpl::SetRTCPStatus(const RtcpMode method) { |
426 rtcp_sender_.SetRTCPStatus(method); | 442 rtcp_sender_.SetRTCPStatus(method); |
427 } | 443 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
508 bool ModuleRtpRtcpImpl::RtcpXrRrtrStatus() const { | 524 bool ModuleRtpRtcpImpl::RtcpXrRrtrStatus() const { |
509 return rtcp_sender_.RtcpXrReceiverReferenceTime(); | 525 return rtcp_sender_.RtcpXrReceiverReferenceTime(); |
510 } | 526 } |
511 | 527 |
512 // TODO(asapersson): Replace this method with the one below. | 528 // TODO(asapersson): Replace this method with the one below. |
513 int32_t ModuleRtpRtcpImpl::DataCountersRTP( | 529 int32_t ModuleRtpRtcpImpl::DataCountersRTP( |
514 size_t* bytes_sent, | 530 size_t* bytes_sent, |
515 uint32_t* packets_sent) const { | 531 uint32_t* packets_sent) const { |
516 StreamDataCounters rtp_stats; | 532 StreamDataCounters rtp_stats; |
517 StreamDataCounters rtx_stats; | 533 StreamDataCounters rtx_stats; |
518 rtp_sender_.GetDataCounters(&rtp_stats, &rtx_stats); | 534 rtp_sender_->GetDataCounters(&rtp_stats, &rtx_stats); |
519 | 535 |
520 if (bytes_sent) { | 536 if (bytes_sent) { |
521 *bytes_sent = rtp_stats.transmitted.payload_bytes + | 537 *bytes_sent = rtp_stats.transmitted.payload_bytes + |
522 rtp_stats.transmitted.padding_bytes + | 538 rtp_stats.transmitted.padding_bytes + |
523 rtp_stats.transmitted.header_bytes + | 539 rtp_stats.transmitted.header_bytes + |
524 rtx_stats.transmitted.payload_bytes + | 540 rtx_stats.transmitted.payload_bytes + |
525 rtx_stats.transmitted.padding_bytes + | 541 rtx_stats.transmitted.padding_bytes + |
526 rtx_stats.transmitted.header_bytes; | 542 rtx_stats.transmitted.header_bytes; |
527 } | 543 } |
528 if (packets_sent) { | 544 if (packets_sent) { |
529 *packets_sent = rtp_stats.transmitted.packets + | 545 *packets_sent = rtp_stats.transmitted.packets + |
530 rtx_stats.transmitted.packets; | 546 rtx_stats.transmitted.packets; |
531 } | 547 } |
532 return 0; | 548 return 0; |
533 } | 549 } |
534 | 550 |
535 void ModuleRtpRtcpImpl::GetSendStreamDataCounters( | 551 void ModuleRtpRtcpImpl::GetSendStreamDataCounters( |
536 StreamDataCounters* rtp_counters, | 552 StreamDataCounters* rtp_counters, |
537 StreamDataCounters* rtx_counters) const { | 553 StreamDataCounters* rtx_counters) const { |
538 rtp_sender_.GetDataCounters(rtp_counters, rtx_counters); | 554 rtp_sender_->GetDataCounters(rtp_counters, rtx_counters); |
539 } | 555 } |
540 | 556 |
541 void ModuleRtpRtcpImpl::GetRtpPacketLossStats( | 557 void ModuleRtpRtcpImpl::GetRtpPacketLossStats( |
542 bool outgoing, | 558 bool outgoing, |
543 uint32_t ssrc, | 559 uint32_t ssrc, |
544 struct RtpPacketLossStats* loss_stats) const { | 560 struct RtpPacketLossStats* loss_stats) const { |
545 if (!loss_stats) return; | 561 if (!loss_stats) return; |
546 const PacketLossStats* stats_source = NULL; | 562 const PacketLossStats* stats_source = NULL; |
547 if (outgoing) { | 563 if (outgoing) { |
548 if (SSRC() == ssrc) { | 564 if (SSRC() == ssrc) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
583 } | 599 } |
584 | 600 |
585 void ModuleRtpRtcpImpl::SetREMBData(const uint32_t bitrate, | 601 void ModuleRtpRtcpImpl::SetREMBData(const uint32_t bitrate, |
586 const std::vector<uint32_t>& ssrcs) { | 602 const std::vector<uint32_t>& ssrcs) { |
587 rtcp_sender_.SetREMBData(bitrate, ssrcs); | 603 rtcp_sender_.SetREMBData(bitrate, ssrcs); |
588 } | 604 } |
589 | 605 |
590 int32_t ModuleRtpRtcpImpl::RegisterSendRtpHeaderExtension( | 606 int32_t ModuleRtpRtcpImpl::RegisterSendRtpHeaderExtension( |
591 const RTPExtensionType type, | 607 const RTPExtensionType type, |
592 const uint8_t id) { | 608 const uint8_t id) { |
593 return rtp_sender_.RegisterRtpHeaderExtension(type, id); | 609 return rtp_sender_->RegisterRtpHeaderExtension(type, id); |
594 } | 610 } |
595 | 611 |
596 int32_t ModuleRtpRtcpImpl::DeregisterSendRtpHeaderExtension( | 612 int32_t ModuleRtpRtcpImpl::DeregisterSendRtpHeaderExtension( |
597 const RTPExtensionType type) { | 613 const RTPExtensionType type) { |
598 return rtp_sender_.DeregisterRtpHeaderExtension(type); | 614 return rtp_sender_->DeregisterRtpHeaderExtension(type); |
599 } | 615 } |
600 | 616 |
601 bool ModuleRtpRtcpImpl::HasBweExtensions() const { | 617 bool ModuleRtpRtcpImpl::HasBweExtensions() const { |
602 return rtp_sender_.IsRtpHeaderExtensionRegistered( | 618 return rtp_sender_->IsRtpHeaderExtensionRegistered( |
603 kRtpExtensionTransportSequenceNumber) || | 619 kRtpExtensionTransportSequenceNumber) || |
604 rtp_sender_.IsRtpHeaderExtensionRegistered( | 620 rtp_sender_->IsRtpHeaderExtensionRegistered( |
605 kRtpExtensionAbsoluteSendTime) || | 621 kRtpExtensionAbsoluteSendTime) || |
606 rtp_sender_.IsRtpHeaderExtensionRegistered( | 622 rtp_sender_->IsRtpHeaderExtensionRegistered( |
607 kRtpExtensionTransmissionTimeOffset); | 623 kRtpExtensionTransmissionTimeOffset); |
608 } | 624 } |
609 | 625 |
610 // (TMMBR) Temporary Max Media Bit Rate. | 626 // (TMMBR) Temporary Max Media Bit Rate. |
611 bool ModuleRtpRtcpImpl::TMMBR() const { | 627 bool ModuleRtpRtcpImpl::TMMBR() const { |
612 return rtcp_sender_.TMMBR(); | 628 return rtcp_sender_.TMMBR(); |
613 } | 629 } |
614 | 630 |
615 void ModuleRtpRtcpImpl::SetTMMBRStatus(const bool enable) { | 631 void ModuleRtpRtcpImpl::SetTMMBRStatus(const bool enable) { |
616 rtcp_sender_.SetTMMBRStatus(enable); | 632 rtcp_sender_.SetTMMBRStatus(enable); |
617 } | 633 } |
618 | 634 |
619 void ModuleRtpRtcpImpl::SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) { | 635 void ModuleRtpRtcpImpl::SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) { |
620 rtcp_sender_.SetTmmbn(std::move(bounding_set)); | 636 rtcp_sender_.SetTmmbn(std::move(bounding_set)); |
621 } | 637 } |
622 | 638 |
623 // Returns the currently configured retransmission mode. | 639 // Returns the currently configured retransmission mode. |
624 int ModuleRtpRtcpImpl::SelectiveRetransmissions() const { | 640 int ModuleRtpRtcpImpl::SelectiveRetransmissions() const { |
625 return rtp_sender_.SelectiveRetransmissions(); | 641 return rtp_sender_->SelectiveRetransmissions(); |
626 } | 642 } |
627 | 643 |
628 // Enable or disable a retransmission mode, which decides which packets will | 644 // Enable or disable a retransmission mode, which decides which packets will |
629 // be retransmitted if NACKed. | 645 // be retransmitted if NACKed. |
630 int ModuleRtpRtcpImpl::SetSelectiveRetransmissions(uint8_t settings) { | 646 int ModuleRtpRtcpImpl::SetSelectiveRetransmissions(uint8_t settings) { |
631 return rtp_sender_.SetSelectiveRetransmissions(settings); | 647 return rtp_sender_->SetSelectiveRetransmissions(settings); |
632 } | 648 } |
633 | 649 |
634 // Send a Negative acknowledgment packet. | 650 // Send a Negative acknowledgment packet. |
635 int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list, | 651 int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list, |
636 const uint16_t size) { | 652 const uint16_t size) { |
637 for (int i = 0; i < size; ++i) { | 653 for (int i = 0; i < size; ++i) { |
638 receive_loss_stats_.AddLostPacket(nack_list[i]); | 654 receive_loss_stats_.AddLostPacket(nack_list[i]); |
639 } | 655 } |
640 uint16_t nack_length = size; | 656 uint16_t nack_length = size; |
641 uint16_t start_id = 0; | 657 uint16_t start_id = 0; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
692 // Send a full NACK list once within every |wait_time|. | 708 // Send a full NACK list once within every |wait_time|. |
693 if (rtt_stats_) { | 709 if (rtt_stats_) { |
694 return now - nack_last_time_sent_full_ > wait_time; | 710 return now - nack_last_time_sent_full_ > wait_time; |
695 } | 711 } |
696 return now - nack_last_time_sent_full_prev_ > wait_time; | 712 return now - nack_last_time_sent_full_prev_ > wait_time; |
697 } | 713 } |
698 | 714 |
699 // Store the sent packets, needed to answer to Negative acknowledgment requests. | 715 // Store the sent packets, needed to answer to Negative acknowledgment requests. |
700 void ModuleRtpRtcpImpl::SetStorePacketsStatus(const bool enable, | 716 void ModuleRtpRtcpImpl::SetStorePacketsStatus(const bool enable, |
701 const uint16_t number_to_store) { | 717 const uint16_t number_to_store) { |
702 rtp_sender_.SetStorePacketsStatus(enable, number_to_store); | 718 rtp_sender_->SetStorePacketsStatus(enable, number_to_store); |
703 } | 719 } |
704 | 720 |
705 bool ModuleRtpRtcpImpl::StorePackets() const { | 721 bool ModuleRtpRtcpImpl::StorePackets() const { |
706 return rtp_sender_.StorePackets(); | 722 return rtp_sender_->StorePackets(); |
707 } | 723 } |
708 | 724 |
709 void ModuleRtpRtcpImpl::RegisterRtcpStatisticsCallback( | 725 void ModuleRtpRtcpImpl::RegisterRtcpStatisticsCallback( |
710 RtcpStatisticsCallback* callback) { | 726 RtcpStatisticsCallback* callback) { |
711 rtcp_receiver_.RegisterRtcpStatisticsCallback(callback); | 727 rtcp_receiver_.RegisterRtcpStatisticsCallback(callback); |
712 } | 728 } |
713 | 729 |
714 RtcpStatisticsCallback* ModuleRtpRtcpImpl::GetRtcpStatisticsCallback() { | 730 RtcpStatisticsCallback* ModuleRtpRtcpImpl::GetRtcpStatisticsCallback() { |
715 return rtcp_receiver_.GetRtcpStatisticsCallback(); | 731 return rtcp_receiver_.GetRtcpStatisticsCallback(); |
716 } | 732 } |
717 | 733 |
718 bool ModuleRtpRtcpImpl::SendFeedbackPacket( | 734 bool ModuleRtpRtcpImpl::SendFeedbackPacket( |
719 const rtcp::TransportFeedback& packet) { | 735 const rtcp::TransportFeedback& packet) { |
720 return rtcp_sender_.SendFeedbackPacket(packet); | 736 return rtcp_sender_.SendFeedbackPacket(packet); |
721 } | 737 } |
722 | 738 |
723 // Send a TelephoneEvent tone using RFC 2833 (4733). | 739 // Send a TelephoneEvent tone using RFC 2833 (4733). |
724 int32_t ModuleRtpRtcpImpl::SendTelephoneEventOutband( | 740 int32_t ModuleRtpRtcpImpl::SendTelephoneEventOutband( |
725 const uint8_t key, | 741 const uint8_t key, |
726 const uint16_t time_ms, | 742 const uint16_t time_ms, |
727 const uint8_t level) { | 743 const uint8_t level) { |
728 return rtp_sender_.SendTelephoneEvent(key, time_ms, level); | 744 return rtp_sender_->SendTelephoneEvent(key, time_ms, level); |
729 } | 745 } |
730 | 746 |
731 int32_t ModuleRtpRtcpImpl::SetAudioPacketSize( | 747 int32_t ModuleRtpRtcpImpl::SetAudioPacketSize( |
732 const uint16_t packet_size_samples) { | 748 const uint16_t packet_size_samples) { |
733 return audio_ ? 0 : -1; | 749 return audio_ ? 0 : -1; |
734 } | 750 } |
735 | 751 |
736 int32_t ModuleRtpRtcpImpl::SetAudioLevel( | 752 int32_t ModuleRtpRtcpImpl::SetAudioLevel( |
737 const uint8_t level_d_bov) { | 753 const uint8_t level_d_bov) { |
738 return rtp_sender_.SetAudioLevel(level_d_bov); | 754 return rtp_sender_->SetAudioLevel(level_d_bov); |
739 } | 755 } |
740 | 756 |
741 int32_t ModuleRtpRtcpImpl::SetKeyFrameRequestMethod( | 757 int32_t ModuleRtpRtcpImpl::SetKeyFrameRequestMethod( |
742 const KeyFrameRequestMethod method) { | 758 const KeyFrameRequestMethod method) { |
743 key_frame_req_method_ = method; | 759 key_frame_req_method_ = method; |
744 return 0; | 760 return 0; |
745 } | 761 } |
746 | 762 |
747 int32_t ModuleRtpRtcpImpl::RequestKeyFrame() { | 763 int32_t ModuleRtpRtcpImpl::RequestKeyFrame() { |
748 switch (key_frame_req_method_) { | 764 switch (key_frame_req_method_) { |
749 case kKeyFrameReqPliRtcp: | 765 case kKeyFrameReqPliRtcp: |
750 return SendRTCP(kRtcpPli); | 766 return SendRTCP(kRtcpPli); |
751 case kKeyFrameReqFirRtcp: | 767 case kKeyFrameReqFirRtcp: |
752 return SendRTCP(kRtcpFir); | 768 return SendRTCP(kRtcpFir); |
753 } | 769 } |
754 return -1; | 770 return -1; |
755 } | 771 } |
756 | 772 |
757 void ModuleRtpRtcpImpl::SetUlpfecConfig(int red_payload_type, | 773 void ModuleRtpRtcpImpl::SetUlpfecConfig(int red_payload_type, |
758 int ulpfec_payload_type) { | 774 int ulpfec_payload_type) { |
759 rtp_sender_.SetUlpfecConfig(red_payload_type, ulpfec_payload_type); | 775 rtp_sender_->SetUlpfecConfig(red_payload_type, ulpfec_payload_type); |
760 } | 776 } |
761 | 777 |
762 bool ModuleRtpRtcpImpl::SetFecParameters( | 778 bool ModuleRtpRtcpImpl::SetFecParameters( |
763 const FecProtectionParams& delta_params, | 779 const FecProtectionParams& delta_params, |
764 const FecProtectionParams& key_params) { | 780 const FecProtectionParams& key_params) { |
765 return rtp_sender_.SetFecParameters(delta_params, key_params); | 781 return rtp_sender_->SetFecParameters(delta_params, key_params); |
766 } | 782 } |
767 | 783 |
768 void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) { | 784 void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) { |
769 // Inform about the incoming SSRC. | 785 // Inform about the incoming SSRC. |
770 rtcp_sender_.SetRemoteSSRC(ssrc); | 786 rtcp_sender_.SetRemoteSSRC(ssrc); |
771 rtcp_receiver_.SetRemoteSSRC(ssrc); | 787 rtcp_receiver_.SetRemoteSSRC(ssrc); |
772 } | 788 } |
773 | 789 |
774 void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate, | 790 void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate, |
775 uint32_t* video_rate, | 791 uint32_t* video_rate, |
776 uint32_t* fec_rate, | 792 uint32_t* fec_rate, |
777 uint32_t* nack_rate) const { | 793 uint32_t* nack_rate) const { |
778 *total_rate = rtp_sender_.BitrateSent(); | 794 *total_rate = rtp_sender_->BitrateSent(); |
779 *video_rate = rtp_sender_.VideoBitrateSent(); | 795 *video_rate = rtp_sender_->VideoBitrateSent(); |
780 *fec_rate = rtp_sender_.FecOverheadRate(); | 796 *fec_rate = rtp_sender_->FecOverheadRate(); |
781 *nack_rate = rtp_sender_.NackOverheadRate(); | 797 *nack_rate = rtp_sender_->NackOverheadRate(); |
782 } | 798 } |
783 | 799 |
784 void ModuleRtpRtcpImpl::OnRequestSendReport() { | 800 void ModuleRtpRtcpImpl::OnRequestSendReport() { |
785 SendRTCP(kRtcpSr); | 801 SendRTCP(kRtcpSr); |
786 } | 802 } |
787 | 803 |
788 void ModuleRtpRtcpImpl::OnReceivedNack( | 804 void ModuleRtpRtcpImpl::OnReceivedNack( |
789 const std::vector<uint16_t>& nack_sequence_numbers) { | 805 const std::vector<uint16_t>& nack_sequence_numbers) { |
806 if (!rtp_sender_) | |
807 return; | |
808 | |
790 for (uint16_t nack_sequence_number : nack_sequence_numbers) { | 809 for (uint16_t nack_sequence_number : nack_sequence_numbers) { |
791 send_loss_stats_.AddLostPacket(nack_sequence_number); | 810 send_loss_stats_.AddLostPacket(nack_sequence_number); |
792 } | 811 } |
793 if (!rtp_sender_.StorePackets() || | 812 if (!rtp_sender_->StorePackets() || |
794 nack_sequence_numbers.size() == 0) { | 813 nack_sequence_numbers.size() == 0) { |
795 return; | 814 return; |
796 } | 815 } |
797 // Use RTT from RtcpRttStats class if provided. | 816 // Use RTT from RtcpRttStats class if provided. |
798 int64_t rtt = rtt_ms(); | 817 int64_t rtt = rtt_ms(); |
799 if (rtt == 0) { | 818 if (rtt == 0) { |
800 rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL); | 819 rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL); |
801 } | 820 } |
802 rtp_sender_.OnReceivedNack(nack_sequence_numbers, rtt); | 821 rtp_sender_->OnReceivedNack(nack_sequence_numbers, rtt); |
803 } | 822 } |
804 | 823 |
805 void ModuleRtpRtcpImpl::OnReceivedRtcpReportBlocks( | 824 void ModuleRtpRtcpImpl::OnReceivedRtcpReportBlocks( |
806 const ReportBlockList& report_blocks) { | 825 const ReportBlockList& report_blocks) { |
807 rtp_sender_.OnReceivedRtcpReportBlocks(report_blocks); | 826 if (rtp_sender_) |
827 rtp_sender_->OnReceivedRtcpReportBlocks(report_blocks); | |
808 } | 828 } |
809 | 829 |
810 bool ModuleRtpRtcpImpl::LastReceivedNTP( | 830 bool ModuleRtpRtcpImpl::LastReceivedNTP( |
811 uint32_t* rtcp_arrival_time_secs, // When we got the last report. | 831 uint32_t* rtcp_arrival_time_secs, // When we got the last report. |
812 uint32_t* rtcp_arrival_time_frac, | 832 uint32_t* rtcp_arrival_time_frac, |
813 uint32_t* remote_sr) const { | 833 uint32_t* remote_sr) const { |
814 // Remote SR: NTP inside the last received (mid 16 bits from sec and frac). | 834 // Remote SR: NTP inside the last received (mid 16 bits from sec and frac). |
815 uint32_t ntp_secs = 0; | 835 uint32_t ntp_secs = 0; |
816 uint32_t ntp_frac = 0; | 836 uint32_t ntp_frac = 0; |
817 | 837 |
(...skipping 17 matching lines...) Expand all Loading... | |
835 int64_t ModuleRtpRtcpImpl::RtcpReportInterval() { | 855 int64_t ModuleRtpRtcpImpl::RtcpReportInterval() { |
836 if (audio_) | 856 if (audio_) |
837 return RTCP_INTERVAL_AUDIO_MS; | 857 return RTCP_INTERVAL_AUDIO_MS; |
838 else | 858 else |
839 return RTCP_INTERVAL_VIDEO_MS; | 859 return RTCP_INTERVAL_VIDEO_MS; |
840 } | 860 } |
841 | 861 |
842 void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) { | 862 void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) { |
843 std::set<uint32_t> ssrcs; | 863 std::set<uint32_t> ssrcs; |
844 ssrcs.insert(main_ssrc); | 864 ssrcs.insert(main_ssrc); |
845 if (rtp_sender_.RtxStatus() != kRtxOff) | 865 if (RtxSendStatus() != kRtxOff) |
846 ssrcs.insert(rtp_sender_.RtxSsrc()); | 866 ssrcs.insert(rtp_sender_->RtxSsrc()); |
847 rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs); | 867 rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs); |
848 } | 868 } |
849 | 869 |
850 void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) { | 870 void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) { |
851 rtc::CritScope cs(&critical_section_rtt_); | 871 rtc::CritScope cs(&critical_section_rtt_); |
852 rtt_ms_ = rtt_ms; | 872 rtt_ms_ = rtt_ms; |
853 } | 873 } |
854 | 874 |
855 int64_t ModuleRtpRtcpImpl::rtt_ms() const { | 875 int64_t ModuleRtpRtcpImpl::rtt_ms() const { |
856 rtc::CritScope cs(&critical_section_rtt_); | 876 rtc::CritScope cs(&critical_section_rtt_); |
857 return rtt_ms_; | 877 return rtt_ms_; |
858 } | 878 } |
859 | 879 |
860 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( | 880 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( |
861 StreamDataCountersCallback* callback) { | 881 StreamDataCountersCallback* callback) { |
862 rtp_sender_.RegisterRtpStatisticsCallback(callback); | 882 rtp_sender_->RegisterRtpStatisticsCallback(callback); |
863 } | 883 } |
864 | 884 |
865 StreamDataCountersCallback* | 885 StreamDataCountersCallback* |
866 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { | 886 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { |
867 return rtp_sender_.GetRtpStatisticsCallback(); | 887 return rtp_sender_->GetRtpStatisticsCallback(); |
868 } | 888 } |
869 | 889 |
870 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( | 890 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( |
871 const BitrateAllocation& bitrate) { | 891 const BitrateAllocation& bitrate) { |
872 rtcp_sender_.SetVideoBitrateAllocation(bitrate); | 892 rtcp_sender_.SetVideoBitrateAllocation(bitrate); |
873 } | 893 } |
874 } // namespace webrtc | 894 } // namespace webrtc |
OLD | NEW |