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

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

Issue 2740163002: Don't allocate any RTPSender object for a receive only RtpRtcp module (Closed)
Patch Set: Tolerate SetSendingMediaStatus(false) on receive-only streams. Created 3 years, 9 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
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());
116 118
117 // Set default packet size limit. 119 // Set default packet size limit.
118 // TODO(nisse): Kind-of duplicates 120 // TODO(nisse): Kind-of duplicates
119 // webrtc::VideoSendStream::Config::Rtp::kDefaultMaxPacketSize. 121 // webrtc::VideoSendStream::Config::Rtp::kDefaultMaxPacketSize.
120 const size_t kTcpOverIpv4HeaderSize = 40; 122 const size_t kTcpOverIpv4HeaderSize = 40;
121 SetMaxRtpPacketSize(IP_PACKET_SIZE - kTcpOverIpv4HeaderSize); 123 SetMaxRtpPacketSize(IP_PACKET_SIZE - kTcpOverIpv4HeaderSize);
danilchap 2017/03/16 15:41:12 rtcp_sender also need to know max packet size.
nisse-webrtc 2017/03/17 09:29:44 Done.
124 }
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
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_payload_type = rtp_sender_->SendPayloadType();
334 state.send_bitrate = rtp_sender_->BitrateSent();
335 } else {
336 // The default value for RTPSender::payload_type_ is -1,
337 // use same value if RTPSender is missing.
338 state.send_payload_type = static_cast<uint8_t>(-1);
danilchap 2017/03/16 15:41:12 send_payload_type is now unused (thanks to rpsi re
nisse-webrtc 2017/03/17 09:29:44 Ok, I'm deleting the else clause and setting of se
339 state.send_bitrate = 0;
340 }
326 state.module = this; 341 state.module = this;
327 342
328 LastReceivedNTP(&state.last_rr_ntp_secs, 343 LastReceivedNTP(&state.last_rr_ntp_secs,
329 &state.last_rr_ntp_frac, 344 &state.last_rr_ntp_frac,
330 &state.remote_sr); 345 &state.remote_sr);
331 346
332 state.has_last_xr_rr = 347 state.has_last_xr_rr =
333 rtcp_receiver_.LastReceivedXrReferenceTimeInfo(&state.last_xr_rr); 348 rtcp_receiver_.LastReceivedXrReferenceTimeInfo(&state.last_xr_rr);
334 349
335 uint32_t tmp;
336 BitrateSent(&state.send_bitrate, &tmp, &tmp, &tmp);
337 return state; 350 return state;
338 } 351 }
339 352
353 // TODO(nisse): The
354 // TestWithNewVideoJitterBuffer/EndToEndTest.RembWithSendSideBwe/* tests call
355 // this method for a receive-only stream, which makes little sense. If that is
356 // fixed, the rtp_sender_ check can be removed.
340 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) { 357 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) {
341 if (rtcp_sender_.Sending() != sending) { 358 if (rtcp_sender_.Sending() != sending) {
342 // Sends RTCP BYE when going from true to false 359 // Sends RTCP BYE when going from true to false
343 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) { 360 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) {
344 LOG(LS_WARNING) << "Failed to send RTCP BYE"; 361 LOG(LS_WARNING) << "Failed to send RTCP BYE";
345 } 362 }
346 if (sending) { 363 if (sending && rtp_sender_) {
347 // Update Rtcp receiver config, to track Rtx config changes from 364 // Update Rtcp receiver config, to track Rtx config changes from
348 // the SetRtxStatus and SetRtxSsrc methods. 365 // the SetRtxStatus and SetRtxSsrc methods.
349 SetRtcpReceiverSsrcs(rtp_sender_.SSRC()); 366 SetRtcpReceiverSsrcs(rtp_sender_->SSRC());
350 } 367 }
351 } 368 }
352 return 0; 369 return 0;
353 } 370 }
354 371
355 bool ModuleRtpRtcpImpl::Sending() const { 372 bool ModuleRtpRtcpImpl::Sending() const {
356 return rtcp_sender_.Sending(); 373 return rtcp_sender_.Sending();
357 } 374 }
358 375
359 void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) { 376 void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) {
360 rtp_sender_.SetSendingMediaStatus(sending); 377 if (rtp_sender_) {
378 rtp_sender_->SetSendingMediaStatus(sending);
379 } else {
380 RTC_DCHECK(!sending);
381 }
361 } 382 }
362 383
363 bool ModuleRtpRtcpImpl::SendingMedia() const { 384 bool ModuleRtpRtcpImpl::SendingMedia() const {
364 return rtp_sender_.SendingMedia(); 385 return rtp_sender_ ? rtp_sender_->SendingMedia() : false;
365 } 386 }
366 387
367 bool ModuleRtpRtcpImpl::SendOutgoingData( 388 bool ModuleRtpRtcpImpl::SendOutgoingData(
368 FrameType frame_type, 389 FrameType frame_type,
369 int8_t payload_type, 390 int8_t payload_type,
370 uint32_t time_stamp, 391 uint32_t time_stamp,
371 int64_t capture_time_ms, 392 int64_t capture_time_ms,
372 const uint8_t* payload_data, 393 const uint8_t* payload_data,
373 size_t payload_size, 394 size_t payload_size,
374 const RTPFragmentationHeader* fragmentation, 395 const RTPFragmentationHeader* fragmentation,
375 const RTPVideoHeader* rtp_video_header, 396 const RTPVideoHeader* rtp_video_header,
376 uint32_t* transport_frame_id_out) { 397 uint32_t* transport_frame_id_out) {
377 rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms); 398 rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms);
378 // Make sure an RTCP report isn't queued behind a key frame. 399 // Make sure an RTCP report isn't queued behind a key frame.
379 if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) { 400 if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) {
380 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); 401 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport);
381 } 402 }
382 return rtp_sender_.SendOutgoingData( 403 return rtp_sender_->SendOutgoingData(
383 frame_type, payload_type, time_stamp, capture_time_ms, payload_data, 404 frame_type, payload_type, time_stamp, capture_time_ms, payload_data,
384 payload_size, fragmentation, rtp_video_header, transport_frame_id_out); 405 payload_size, fragmentation, rtp_video_header, transport_frame_id_out);
385 } 406 }
386 407
387 bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc, 408 bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc,
388 uint16_t sequence_number, 409 uint16_t sequence_number,
389 int64_t capture_time_ms, 410 int64_t capture_time_ms,
390 bool retransmission, 411 bool retransmission,
391 const PacedPacketInfo& pacing_info) { 412 const PacedPacketInfo& pacing_info) {
392 return rtp_sender_.TimeToSendPacket(ssrc, sequence_number, capture_time_ms, 413 return rtp_sender_->TimeToSendPacket(ssrc, sequence_number, capture_time_ms,
393 retransmission, pacing_info); 414 retransmission, pacing_info);
394 } 415 }
395 416
396 size_t ModuleRtpRtcpImpl::TimeToSendPadding( 417 size_t ModuleRtpRtcpImpl::TimeToSendPadding(
397 size_t bytes, 418 size_t bytes,
398 const PacedPacketInfo& pacing_info) { 419 const PacedPacketInfo& pacing_info) {
399 return rtp_sender_.TimeToSendPadding(bytes, pacing_info); 420 return rtp_sender_->TimeToSendPadding(bytes, pacing_info);
400 } 421 }
401 422
402 size_t ModuleRtpRtcpImpl::MaxPayloadSize() const { 423 size_t ModuleRtpRtcpImpl::MaxPayloadSize() const {
403 return rtp_sender_.MaxPayloadSize(); 424 return rtp_sender_->MaxPayloadSize();
404 } 425 }
405 426
406 size_t ModuleRtpRtcpImpl::MaxRtpPacketSize() const { 427 size_t ModuleRtpRtcpImpl::MaxRtpPacketSize() const {
407 return rtp_sender_.MaxRtpPacketSize(); 428 return rtp_sender_->MaxRtpPacketSize();
408 } 429 }
409 430
410 void ModuleRtpRtcpImpl::SetMaxRtpPacketSize(size_t rtp_packet_size) { 431 void ModuleRtpRtcpImpl::SetMaxRtpPacketSize(size_t rtp_packet_size) {
411 RTC_DCHECK_LE(rtp_packet_size, IP_PACKET_SIZE) 432 RTC_DCHECK_LE(rtp_packet_size, IP_PACKET_SIZE)
412 << "rtp packet size too large: " << rtp_packet_size; 433 << "rtp packet size too large: " << rtp_packet_size;
413 RTC_DCHECK_GT(rtp_packet_size, packet_overhead_) 434 RTC_DCHECK_GT(rtp_packet_size, packet_overhead_)
414 << "rtp packet size too small: " << rtp_packet_size; 435 << "rtp packet size too small: " << rtp_packet_size;
415 436
416 rtcp_sender_.SetMaxRtpPacketSize(rtp_packet_size); 437 rtcp_sender_.SetMaxRtpPacketSize(rtp_packet_size);
417 rtp_sender_.SetMaxRtpPacketSize(rtp_packet_size); 438 rtp_sender_->SetMaxRtpPacketSize(rtp_packet_size);
danilchap 2017/03/16 15:41:13 since SetMaxRtpPacketSize make sense to call for r
nisse-webrtc 2017/03/17 09:29:44 Done.
418 } 439 }
419 440
420 RtcpMode ModuleRtpRtcpImpl::RTCP() const { 441 RtcpMode ModuleRtpRtcpImpl::RTCP() const {
421 return rtcp_sender_.Status(); 442 return rtcp_sender_.Status();
422 } 443 }
423 444
424 // Configure RTCP status i.e on/off. 445 // Configure RTCP status i.e on/off.
425 void ModuleRtpRtcpImpl::SetRTCPStatus(const RtcpMode method) { 446 void ModuleRtpRtcpImpl::SetRTCPStatus(const RtcpMode method) {
426 rtcp_sender_.SetRTCPStatus(method); 447 rtcp_sender_.SetRTCPStatus(method);
427 } 448 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 bool ModuleRtpRtcpImpl::RtcpXrRrtrStatus() const { 529 bool ModuleRtpRtcpImpl::RtcpXrRrtrStatus() const {
509 return rtcp_sender_.RtcpXrReceiverReferenceTime(); 530 return rtcp_sender_.RtcpXrReceiverReferenceTime();
510 } 531 }
511 532
512 // TODO(asapersson): Replace this method with the one below. 533 // TODO(asapersson): Replace this method with the one below.
513 int32_t ModuleRtpRtcpImpl::DataCountersRTP( 534 int32_t ModuleRtpRtcpImpl::DataCountersRTP(
514 size_t* bytes_sent, 535 size_t* bytes_sent,
515 uint32_t* packets_sent) const { 536 uint32_t* packets_sent) const {
516 StreamDataCounters rtp_stats; 537 StreamDataCounters rtp_stats;
517 StreamDataCounters rtx_stats; 538 StreamDataCounters rtx_stats;
518 rtp_sender_.GetDataCounters(&rtp_stats, &rtx_stats); 539 rtp_sender_->GetDataCounters(&rtp_stats, &rtx_stats);
519 540
520 if (bytes_sent) { 541 if (bytes_sent) {
521 *bytes_sent = rtp_stats.transmitted.payload_bytes + 542 *bytes_sent = rtp_stats.transmitted.payload_bytes +
522 rtp_stats.transmitted.padding_bytes + 543 rtp_stats.transmitted.padding_bytes +
523 rtp_stats.transmitted.header_bytes + 544 rtp_stats.transmitted.header_bytes +
524 rtx_stats.transmitted.payload_bytes + 545 rtx_stats.transmitted.payload_bytes +
525 rtx_stats.transmitted.padding_bytes + 546 rtx_stats.transmitted.padding_bytes +
526 rtx_stats.transmitted.header_bytes; 547 rtx_stats.transmitted.header_bytes;
527 } 548 }
528 if (packets_sent) { 549 if (packets_sent) {
529 *packets_sent = rtp_stats.transmitted.packets + 550 *packets_sent = rtp_stats.transmitted.packets +
530 rtx_stats.transmitted.packets; 551 rtx_stats.transmitted.packets;
531 } 552 }
532 return 0; 553 return 0;
533 } 554 }
534 555
535 void ModuleRtpRtcpImpl::GetSendStreamDataCounters( 556 void ModuleRtpRtcpImpl::GetSendStreamDataCounters(
536 StreamDataCounters* rtp_counters, 557 StreamDataCounters* rtp_counters,
537 StreamDataCounters* rtx_counters) const { 558 StreamDataCounters* rtx_counters) const {
538 rtp_sender_.GetDataCounters(rtp_counters, rtx_counters); 559 rtp_sender_->GetDataCounters(rtp_counters, rtx_counters);
539 } 560 }
540 561
541 void ModuleRtpRtcpImpl::GetRtpPacketLossStats( 562 void ModuleRtpRtcpImpl::GetRtpPacketLossStats(
542 bool outgoing, 563 bool outgoing,
543 uint32_t ssrc, 564 uint32_t ssrc,
544 struct RtpPacketLossStats* loss_stats) const { 565 struct RtpPacketLossStats* loss_stats) const {
545 if (!loss_stats) return; 566 if (!loss_stats) return;
546 const PacketLossStats* stats_source = NULL; 567 const PacketLossStats* stats_source = NULL;
547 if (outgoing) { 568 if (outgoing) {
548 if (SSRC() == ssrc) { 569 if (SSRC() == ssrc) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 } 604 }
584 605
585 void ModuleRtpRtcpImpl::SetREMBData(const uint32_t bitrate, 606 void ModuleRtpRtcpImpl::SetREMBData(const uint32_t bitrate,
586 const std::vector<uint32_t>& ssrcs) { 607 const std::vector<uint32_t>& ssrcs) {
587 rtcp_sender_.SetREMBData(bitrate, ssrcs); 608 rtcp_sender_.SetREMBData(bitrate, ssrcs);
588 } 609 }
589 610
590 int32_t ModuleRtpRtcpImpl::RegisterSendRtpHeaderExtension( 611 int32_t ModuleRtpRtcpImpl::RegisterSendRtpHeaderExtension(
591 const RTPExtensionType type, 612 const RTPExtensionType type,
592 const uint8_t id) { 613 const uint8_t id) {
593 return rtp_sender_.RegisterRtpHeaderExtension(type, id); 614 return rtp_sender_->RegisterRtpHeaderExtension(type, id);
594 } 615 }
595 616
596 int32_t ModuleRtpRtcpImpl::DeregisterSendRtpHeaderExtension( 617 int32_t ModuleRtpRtcpImpl::DeregisterSendRtpHeaderExtension(
597 const RTPExtensionType type) { 618 const RTPExtensionType type) {
598 return rtp_sender_.DeregisterRtpHeaderExtension(type); 619 return rtp_sender_->DeregisterRtpHeaderExtension(type);
599 } 620 }
600 621
601 bool ModuleRtpRtcpImpl::HasBweExtensions() const { 622 bool ModuleRtpRtcpImpl::HasBweExtensions() const {
602 return rtp_sender_.IsRtpHeaderExtensionRegistered( 623 return rtp_sender_->IsRtpHeaderExtensionRegistered(
603 kRtpExtensionTransportSequenceNumber) || 624 kRtpExtensionTransportSequenceNumber) ||
604 rtp_sender_.IsRtpHeaderExtensionRegistered( 625 rtp_sender_->IsRtpHeaderExtensionRegistered(
605 kRtpExtensionAbsoluteSendTime) || 626 kRtpExtensionAbsoluteSendTime) ||
606 rtp_sender_.IsRtpHeaderExtensionRegistered( 627 rtp_sender_->IsRtpHeaderExtensionRegistered(
607 kRtpExtensionTransmissionTimeOffset); 628 kRtpExtensionTransmissionTimeOffset);
608 } 629 }
609 630
610 // (TMMBR) Temporary Max Media Bit Rate. 631 // (TMMBR) Temporary Max Media Bit Rate.
611 bool ModuleRtpRtcpImpl::TMMBR() const { 632 bool ModuleRtpRtcpImpl::TMMBR() const {
612 return rtcp_sender_.TMMBR(); 633 return rtcp_sender_.TMMBR();
613 } 634 }
614 635
615 void ModuleRtpRtcpImpl::SetTMMBRStatus(const bool enable) { 636 void ModuleRtpRtcpImpl::SetTMMBRStatus(const bool enable) {
616 rtcp_sender_.SetTMMBRStatus(enable); 637 rtcp_sender_.SetTMMBRStatus(enable);
617 } 638 }
618 639
619 void ModuleRtpRtcpImpl::SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) { 640 void ModuleRtpRtcpImpl::SetTmmbn(std::vector<rtcp::TmmbItem> bounding_set) {
620 rtcp_sender_.SetTmmbn(std::move(bounding_set)); 641 rtcp_sender_.SetTmmbn(std::move(bounding_set));
621 } 642 }
622 643
623 // Returns the currently configured retransmission mode. 644 // Returns the currently configured retransmission mode.
624 int ModuleRtpRtcpImpl::SelectiveRetransmissions() const { 645 int ModuleRtpRtcpImpl::SelectiveRetransmissions() const {
625 return rtp_sender_.SelectiveRetransmissions(); 646 return rtp_sender_->SelectiveRetransmissions();
626 } 647 }
627 648
628 // Enable or disable a retransmission mode, which decides which packets will 649 // Enable or disable a retransmission mode, which decides which packets will
629 // be retransmitted if NACKed. 650 // be retransmitted if NACKed.
630 int ModuleRtpRtcpImpl::SetSelectiveRetransmissions(uint8_t settings) { 651 int ModuleRtpRtcpImpl::SetSelectiveRetransmissions(uint8_t settings) {
631 return rtp_sender_.SetSelectiveRetransmissions(settings); 652 return rtp_sender_->SetSelectiveRetransmissions(settings);
632 } 653 }
633 654
634 // Send a Negative acknowledgment packet. 655 // Send a Negative acknowledgment packet.
635 int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list, 656 int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list,
636 const uint16_t size) { 657 const uint16_t size) {
637 for (int i = 0; i < size; ++i) { 658 for (int i = 0; i < size; ++i) {
638 receive_loss_stats_.AddLostPacket(nack_list[i]); 659 receive_loss_stats_.AddLostPacket(nack_list[i]);
639 } 660 }
640 uint16_t nack_length = size; 661 uint16_t nack_length = size;
641 uint16_t start_id = 0; 662 uint16_t start_id = 0;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 // Send a full NACK list once within every |wait_time|. 713 // Send a full NACK list once within every |wait_time|.
693 if (rtt_stats_) { 714 if (rtt_stats_) {
694 return now - nack_last_time_sent_full_ > wait_time; 715 return now - nack_last_time_sent_full_ > wait_time;
695 } 716 }
696 return now - nack_last_time_sent_full_prev_ > wait_time; 717 return now - nack_last_time_sent_full_prev_ > wait_time;
697 } 718 }
698 719
699 // Store the sent packets, needed to answer to Negative acknowledgment requests. 720 // Store the sent packets, needed to answer to Negative acknowledgment requests.
700 void ModuleRtpRtcpImpl::SetStorePacketsStatus(const bool enable, 721 void ModuleRtpRtcpImpl::SetStorePacketsStatus(const bool enable,
701 const uint16_t number_to_store) { 722 const uint16_t number_to_store) {
702 rtp_sender_.SetStorePacketsStatus(enable, number_to_store); 723 rtp_sender_->SetStorePacketsStatus(enable, number_to_store);
703 } 724 }
704 725
705 bool ModuleRtpRtcpImpl::StorePackets() const { 726 bool ModuleRtpRtcpImpl::StorePackets() const {
706 return rtp_sender_.StorePackets(); 727 return rtp_sender_->StorePackets();
707 } 728 }
708 729
709 void ModuleRtpRtcpImpl::RegisterRtcpStatisticsCallback( 730 void ModuleRtpRtcpImpl::RegisterRtcpStatisticsCallback(
710 RtcpStatisticsCallback* callback) { 731 RtcpStatisticsCallback* callback) {
711 rtcp_receiver_.RegisterRtcpStatisticsCallback(callback); 732 rtcp_receiver_.RegisterRtcpStatisticsCallback(callback);
712 } 733 }
713 734
714 RtcpStatisticsCallback* ModuleRtpRtcpImpl::GetRtcpStatisticsCallback() { 735 RtcpStatisticsCallback* ModuleRtpRtcpImpl::GetRtcpStatisticsCallback() {
715 return rtcp_receiver_.GetRtcpStatisticsCallback(); 736 return rtcp_receiver_.GetRtcpStatisticsCallback();
716 } 737 }
717 738
718 bool ModuleRtpRtcpImpl::SendFeedbackPacket( 739 bool ModuleRtpRtcpImpl::SendFeedbackPacket(
719 const rtcp::TransportFeedback& packet) { 740 const rtcp::TransportFeedback& packet) {
720 return rtcp_sender_.SendFeedbackPacket(packet); 741 return rtcp_sender_.SendFeedbackPacket(packet);
721 } 742 }
722 743
723 // Send a TelephoneEvent tone using RFC 2833 (4733). 744 // Send a TelephoneEvent tone using RFC 2833 (4733).
724 int32_t ModuleRtpRtcpImpl::SendTelephoneEventOutband( 745 int32_t ModuleRtpRtcpImpl::SendTelephoneEventOutband(
725 const uint8_t key, 746 const uint8_t key,
726 const uint16_t time_ms, 747 const uint16_t time_ms,
727 const uint8_t level) { 748 const uint8_t level) {
728 return rtp_sender_.SendTelephoneEvent(key, time_ms, level); 749 return rtp_sender_->SendTelephoneEvent(key, time_ms, level);
729 } 750 }
730 751
731 int32_t ModuleRtpRtcpImpl::SetAudioPacketSize( 752 int32_t ModuleRtpRtcpImpl::SetAudioPacketSize(
732 const uint16_t packet_size_samples) { 753 const uint16_t packet_size_samples) {
733 return audio_ ? 0 : -1; 754 return audio_ ? 0 : -1;
734 } 755 }
735 756
736 int32_t ModuleRtpRtcpImpl::SetAudioLevel( 757 int32_t ModuleRtpRtcpImpl::SetAudioLevel(
737 const uint8_t level_d_bov) { 758 const uint8_t level_d_bov) {
738 return rtp_sender_.SetAudioLevel(level_d_bov); 759 return rtp_sender_->SetAudioLevel(level_d_bov);
739 } 760 }
740 761
741 int32_t ModuleRtpRtcpImpl::SetKeyFrameRequestMethod( 762 int32_t ModuleRtpRtcpImpl::SetKeyFrameRequestMethod(
742 const KeyFrameRequestMethod method) { 763 const KeyFrameRequestMethod method) {
743 key_frame_req_method_ = method; 764 key_frame_req_method_ = method;
744 return 0; 765 return 0;
745 } 766 }
746 767
747 int32_t ModuleRtpRtcpImpl::RequestKeyFrame() { 768 int32_t ModuleRtpRtcpImpl::RequestKeyFrame() {
748 switch (key_frame_req_method_) { 769 switch (key_frame_req_method_) {
749 case kKeyFrameReqPliRtcp: 770 case kKeyFrameReqPliRtcp:
750 return SendRTCP(kRtcpPli); 771 return SendRTCP(kRtcpPli);
751 case kKeyFrameReqFirRtcp: 772 case kKeyFrameReqFirRtcp:
752 return SendRTCP(kRtcpFir); 773 return SendRTCP(kRtcpFir);
753 } 774 }
754 return -1; 775 return -1;
755 } 776 }
756 777
757 void ModuleRtpRtcpImpl::SetUlpfecConfig(int red_payload_type, 778 void ModuleRtpRtcpImpl::SetUlpfecConfig(int red_payload_type,
758 int ulpfec_payload_type) { 779 int ulpfec_payload_type) {
759 rtp_sender_.SetUlpfecConfig(red_payload_type, ulpfec_payload_type); 780 rtp_sender_->SetUlpfecConfig(red_payload_type, ulpfec_payload_type);
760 } 781 }
761 782
762 bool ModuleRtpRtcpImpl::SetFecParameters( 783 bool ModuleRtpRtcpImpl::SetFecParameters(
763 const FecProtectionParams& delta_params, 784 const FecProtectionParams& delta_params,
764 const FecProtectionParams& key_params) { 785 const FecProtectionParams& key_params) {
765 return rtp_sender_.SetFecParameters(delta_params, key_params); 786 return rtp_sender_->SetFecParameters(delta_params, key_params);
766 } 787 }
767 788
768 void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) { 789 void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) {
769 // Inform about the incoming SSRC. 790 // Inform about the incoming SSRC.
770 rtcp_sender_.SetRemoteSSRC(ssrc); 791 rtcp_sender_.SetRemoteSSRC(ssrc);
771 rtcp_receiver_.SetRemoteSSRC(ssrc); 792 rtcp_receiver_.SetRemoteSSRC(ssrc);
772 } 793 }
773 794
774 void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate, 795 void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate,
775 uint32_t* video_rate, 796 uint32_t* video_rate,
776 uint32_t* fec_rate, 797 uint32_t* fec_rate,
777 uint32_t* nack_rate) const { 798 uint32_t* nack_rate) const {
778 *total_rate = rtp_sender_.BitrateSent(); 799 *total_rate = rtp_sender_->BitrateSent();
779 *video_rate = rtp_sender_.VideoBitrateSent(); 800 *video_rate = rtp_sender_->VideoBitrateSent();
780 *fec_rate = rtp_sender_.FecOverheadRate(); 801 *fec_rate = rtp_sender_->FecOverheadRate();
781 *nack_rate = rtp_sender_.NackOverheadRate(); 802 *nack_rate = rtp_sender_->NackOverheadRate();
782 } 803 }
783 804
784 void ModuleRtpRtcpImpl::OnRequestSendReport() { 805 void ModuleRtpRtcpImpl::OnRequestSendReport() {
785 SendRTCP(kRtcpSr); 806 SendRTCP(kRtcpSr);
786 } 807 }
787 808
788 void ModuleRtpRtcpImpl::OnReceivedNack( 809 void ModuleRtpRtcpImpl::OnReceivedNack(
789 const std::vector<uint16_t>& nack_sequence_numbers) { 810 const std::vector<uint16_t>& nack_sequence_numbers) {
811 if (!rtp_sender_)
812 return;
813
790 for (uint16_t nack_sequence_number : nack_sequence_numbers) { 814 for (uint16_t nack_sequence_number : nack_sequence_numbers) {
791 send_loss_stats_.AddLostPacket(nack_sequence_number); 815 send_loss_stats_.AddLostPacket(nack_sequence_number);
792 } 816 }
793 if (!rtp_sender_.StorePackets() || 817 if (!rtp_sender_->StorePackets() ||
794 nack_sequence_numbers.size() == 0) { 818 nack_sequence_numbers.size() == 0) {
795 return; 819 return;
796 } 820 }
797 // Use RTT from RtcpRttStats class if provided. 821 // Use RTT from RtcpRttStats class if provided.
798 int64_t rtt = rtt_ms(); 822 int64_t rtt = rtt_ms();
799 if (rtt == 0) { 823 if (rtt == 0) {
800 rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL); 824 rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL);
801 } 825 }
802 rtp_sender_.OnReceivedNack(nack_sequence_numbers, rtt); 826 rtp_sender_->OnReceivedNack(nack_sequence_numbers, rtt);
803 } 827 }
804 828
805 void ModuleRtpRtcpImpl::OnReceivedRtcpReportBlocks( 829 void ModuleRtpRtcpImpl::OnReceivedRtcpReportBlocks(
806 const ReportBlockList& report_blocks) { 830 const ReportBlockList& report_blocks) {
807 rtp_sender_.OnReceivedRtcpReportBlocks(report_blocks); 831 if (rtp_sender_)
832 rtp_sender_->OnReceivedRtcpReportBlocks(report_blocks);
808 } 833 }
809 834
810 bool ModuleRtpRtcpImpl::LastReceivedNTP( 835 bool ModuleRtpRtcpImpl::LastReceivedNTP(
811 uint32_t* rtcp_arrival_time_secs, // When we got the last report. 836 uint32_t* rtcp_arrival_time_secs, // When we got the last report.
812 uint32_t* rtcp_arrival_time_frac, 837 uint32_t* rtcp_arrival_time_frac,
813 uint32_t* remote_sr) const { 838 uint32_t* remote_sr) const {
814 // Remote SR: NTP inside the last received (mid 16 bits from sec and frac). 839 // Remote SR: NTP inside the last received (mid 16 bits from sec and frac).
815 uint32_t ntp_secs = 0; 840 uint32_t ntp_secs = 0;
816 uint32_t ntp_frac = 0; 841 uint32_t ntp_frac = 0;
817 842
(...skipping 17 matching lines...) Expand all
835 int64_t ModuleRtpRtcpImpl::RtcpReportInterval() { 860 int64_t ModuleRtpRtcpImpl::RtcpReportInterval() {
836 if (audio_) 861 if (audio_)
837 return RTCP_INTERVAL_AUDIO_MS; 862 return RTCP_INTERVAL_AUDIO_MS;
838 else 863 else
839 return RTCP_INTERVAL_VIDEO_MS; 864 return RTCP_INTERVAL_VIDEO_MS;
840 } 865 }
841 866
842 void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) { 867 void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) {
843 std::set<uint32_t> ssrcs; 868 std::set<uint32_t> ssrcs;
844 ssrcs.insert(main_ssrc); 869 ssrcs.insert(main_ssrc);
845 if (rtp_sender_.RtxStatus() != kRtxOff) 870 if (RtxSendStatus() != kRtxOff)
846 ssrcs.insert(rtp_sender_.RtxSsrc()); 871 ssrcs.insert(rtp_sender_->RtxSsrc());
847 rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs); 872 rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs);
848 } 873 }
849 874
850 void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) { 875 void ModuleRtpRtcpImpl::set_rtt_ms(int64_t rtt_ms) {
851 rtc::CritScope cs(&critical_section_rtt_); 876 rtc::CritScope cs(&critical_section_rtt_);
852 rtt_ms_ = rtt_ms; 877 rtt_ms_ = rtt_ms;
853 } 878 }
854 879
855 int64_t ModuleRtpRtcpImpl::rtt_ms() const { 880 int64_t ModuleRtpRtcpImpl::rtt_ms() const {
856 rtc::CritScope cs(&critical_section_rtt_); 881 rtc::CritScope cs(&critical_section_rtt_);
857 return rtt_ms_; 882 return rtt_ms_;
858 } 883 }
859 884
860 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( 885 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback(
861 StreamDataCountersCallback* callback) { 886 StreamDataCountersCallback* callback) {
862 rtp_sender_.RegisterRtpStatisticsCallback(callback); 887 rtp_sender_->RegisterRtpStatisticsCallback(callback);
863 } 888 }
864 889
865 StreamDataCountersCallback* 890 StreamDataCountersCallback*
866 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { 891 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const {
867 return rtp_sender_.GetRtpStatisticsCallback(); 892 return rtp_sender_->GetRtpStatisticsCallback();
868 } 893 }
869 894
870 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( 895 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation(
871 const BitrateAllocation& bitrate) { 896 const BitrateAllocation& bitrate) {
872 rtcp_sender_.SetVideoBitrateAllocation(bitrate); 897 rtcp_sender_.SetVideoBitrateAllocation(bitrate);
873 } 898 }
874 } // namespace webrtc 899 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698