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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 nack_last_time_sent_full_prev_(0), | 98 nack_last_time_sent_full_prev_(0), |
99 nack_last_seq_number_sent_(0), | 99 nack_last_seq_number_sent_(0), |
100 key_frame_req_method_(kKeyFrameReqPliRtcp), | 100 key_frame_req_method_(kKeyFrameReqPliRtcp), |
101 remote_bitrate_(configuration.remote_bitrate_estimator), | 101 remote_bitrate_(configuration.remote_bitrate_estimator), |
102 rtt_stats_(configuration.rtt_stats), | 102 rtt_stats_(configuration.rtt_stats), |
103 rtt_ms_(0) { | 103 rtt_ms_(0) { |
104 // Make sure that RTCP objects are aware of our SSRC. | 104 // Make sure that RTCP objects are aware of our SSRC. |
105 uint32_t SSRC = rtp_sender_.SSRC(); | 105 uint32_t SSRC = rtp_sender_.SSRC(); |
106 rtcp_sender_.SetSSRC(SSRC); | 106 rtcp_sender_.SetSSRC(SSRC); |
107 SetRtcpReceiverSsrcs(SSRC); | 107 SetRtcpReceiverSsrcs(SSRC); |
108 | |
109 // Make sure rtcp sender use same timestamp offset as rtp sender. | |
110 rtcp_sender_.SetStartTimestamp(rtp_sender_.TimestampOffset()); | |
terelius
2016/08/15 14:56:03
Could we rename this function too?
danilchap
2016/08/15 15:23:17
Done.
| |
111 | |
112 // Set default packet size limit. | |
108 SetMaxTransferUnit(IP_PACKET_SIZE); | 113 SetMaxTransferUnit(IP_PACKET_SIZE); |
109 } | 114 } |
110 | 115 |
111 // Returns the number of milliseconds until the module want a worker thread | 116 // Returns the number of milliseconds until the module want a worker thread |
112 // to call Process. | 117 // to call Process. |
113 int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() { | 118 int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() { |
114 const int64_t now = clock_->TimeInMilliseconds(); | 119 const int64_t now = clock_->TimeInMilliseconds(); |
115 const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5; | 120 const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5; |
116 return kRtpRtcpMaxIdleTimeProcessMs - (now - last_process_time_); | 121 return kRtpRtcpMaxIdleTimeProcessMs - (now - last_process_time_); |
117 } | 122 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
255 | 260 |
256 int32_t ModuleRtpRtcpImpl::DeRegisterSendPayload(const int8_t payload_type) { | 261 int32_t ModuleRtpRtcpImpl::DeRegisterSendPayload(const int8_t payload_type) { |
257 return rtp_sender_.DeRegisterSendPayload(payload_type); | 262 return rtp_sender_.DeRegisterSendPayload(payload_type); |
258 } | 263 } |
259 | 264 |
260 int8_t ModuleRtpRtcpImpl::SendPayloadType() const { | 265 int8_t ModuleRtpRtcpImpl::SendPayloadType() const { |
261 return rtp_sender_.SendPayloadType(); | 266 return rtp_sender_.SendPayloadType(); |
262 } | 267 } |
263 | 268 |
264 uint32_t ModuleRtpRtcpImpl::StartTimestamp() const { | 269 uint32_t ModuleRtpRtcpImpl::StartTimestamp() const { |
265 return rtp_sender_.StartTimestamp(); | 270 return rtp_sender_.TimestampOffset(); |
266 } | 271 } |
267 | 272 |
268 // Configure start timestamp, default is a random number. | 273 // Configure start timestamp, default is a random number. |
269 void ModuleRtpRtcpImpl::SetStartTimestamp(const uint32_t timestamp) { | 274 void ModuleRtpRtcpImpl::SetStartTimestamp(const uint32_t timestamp) { |
270 rtcp_sender_.SetStartTimestamp(timestamp); | 275 rtcp_sender_.SetStartTimestamp(timestamp); |
271 rtp_sender_.SetStartTimestamp(timestamp, true); | 276 rtp_sender_.SetTimestampOffset(timestamp); |
272 } | 277 } |
273 | 278 |
274 uint16_t ModuleRtpRtcpImpl::SequenceNumber() const { | 279 uint16_t ModuleRtpRtcpImpl::SequenceNumber() const { |
275 return rtp_sender_.SequenceNumber(); | 280 return rtp_sender_.SequenceNumber(); |
276 } | 281 } |
277 | 282 |
278 // Set SequenceNumber, default is a random number. | 283 // Set SequenceNumber, default is a random number. |
279 void ModuleRtpRtcpImpl::SetSequenceNumber(const uint16_t seq_num) { | 284 void ModuleRtpRtcpImpl::SetSequenceNumber(const uint16_t seq_num) { |
280 rtp_sender_.SetSequenceNumber(seq_num); | 285 rtp_sender_.SetSequenceNumber(seq_num); |
281 } | 286 } |
282 | 287 |
283 void ModuleRtpRtcpImpl::SetRtpState(const RtpState& rtp_state) { | 288 void ModuleRtpRtcpImpl::SetRtpState(const RtpState& rtp_state) { |
284 SetStartTimestamp(rtp_state.start_timestamp); | |
285 rtp_sender_.SetRtpState(rtp_state); | 289 rtp_sender_.SetRtpState(rtp_state); |
290 rtcp_sender_.SetStartTimestamp(rtp_state.start_timestamp); | |
286 } | 291 } |
287 | 292 |
288 void ModuleRtpRtcpImpl::SetRtxState(const RtpState& rtp_state) { | 293 void ModuleRtpRtcpImpl::SetRtxState(const RtpState& rtp_state) { |
289 rtp_sender_.SetRtxRtpState(rtp_state); | 294 rtp_sender_.SetRtxRtpState(rtp_state); |
290 } | 295 } |
291 | 296 |
292 RtpState ModuleRtpRtcpImpl::GetRtpState() const { | 297 RtpState ModuleRtpRtcpImpl::GetRtpState() const { |
293 return rtp_sender_.GetRtpState(); | 298 return rtp_sender_.GetRtpState(); |
294 } | 299 } |
295 | 300 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
346 | 351 |
347 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) { | 352 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) { |
348 if (rtcp_sender_.Sending() != sending) { | 353 if (rtcp_sender_.Sending() != sending) { |
349 // Sends RTCP BYE when going from true to false | 354 // Sends RTCP BYE when going from true to false |
350 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) { | 355 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) { |
351 LOG(LS_WARNING) << "Failed to send RTCP BYE"; | 356 LOG(LS_WARNING) << "Failed to send RTCP BYE"; |
352 } | 357 } |
353 | 358 |
354 collision_detected_ = false; | 359 collision_detected_ = false; |
355 | 360 |
356 // Generate a new time_stamp if true and not configured via API | |
357 // Generate a new SSRC for the next "call" if false | 361 // Generate a new SSRC for the next "call" if false |
358 rtp_sender_.SetSendingStatus(sending); | 362 rtp_sender_.SetSendingStatus(sending); |
359 if (sending) { | |
360 // Make sure the RTCP sender has the same timestamp offset. | |
361 rtcp_sender_.SetStartTimestamp(rtp_sender_.StartTimestamp()); | |
362 } | |
363 | 363 |
364 // Make sure that RTCP objects are aware of our SSRC (it could have changed | 364 // Make sure that RTCP objects are aware of our SSRC (it could have changed |
365 // Due to collision) | 365 // Due to collision) |
366 uint32_t SSRC = rtp_sender_.SSRC(); | 366 uint32_t SSRC = rtp_sender_.SSRC(); |
367 rtcp_sender_.SetSSRC(SSRC); | 367 rtcp_sender_.SetSSRC(SSRC); |
368 SetRtcpReceiverSsrcs(SSRC); | 368 SetRtcpReceiverSsrcs(SSRC); |
369 | 369 |
370 return 0; | 370 return 0; |
371 } | 371 } |
372 return 0; | 372 return 0; |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
969 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( | 969 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( |
970 StreamDataCountersCallback* callback) { | 970 StreamDataCountersCallback* callback) { |
971 rtp_sender_.RegisterRtpStatisticsCallback(callback); | 971 rtp_sender_.RegisterRtpStatisticsCallback(callback); |
972 } | 972 } |
973 | 973 |
974 StreamDataCountersCallback* | 974 StreamDataCountersCallback* |
975 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { | 975 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { |
976 return rtp_sender_.GetRtpStatisticsCallback(); | 976 return rtp_sender_.GetRtpStatisticsCallback(); |
977 } | 977 } |
978 } // namespace webrtc | 978 } // namespace webrtc |
OLD | NEW |