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_.SetTimestampOffset(rtp_sender_.TimestampOffset()); | |
111 | |
112 // Set default packet size limit. | |
113 SetMaxTransferUnit(IP_PACKET_SIZE); | 108 SetMaxTransferUnit(IP_PACKET_SIZE); |
114 } | 109 } |
115 | 110 |
116 // Returns the number of milliseconds until the module want a worker thread | 111 // Returns the number of milliseconds until the module want a worker thread |
117 // to call Process. | 112 // to call Process. |
118 int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() { | 113 int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() { |
119 const int64_t now = clock_->TimeInMilliseconds(); | 114 const int64_t now = clock_->TimeInMilliseconds(); |
120 const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5; | 115 const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5; |
121 return kRtpRtcpMaxIdleTimeProcessMs - (now - last_process_time_); | 116 return kRtpRtcpMaxIdleTimeProcessMs - (now - last_process_time_); |
122 } | 117 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 255 |
261 int32_t ModuleRtpRtcpImpl::DeRegisterSendPayload(const int8_t payload_type) { | 256 int32_t ModuleRtpRtcpImpl::DeRegisterSendPayload(const int8_t payload_type) { |
262 return rtp_sender_.DeRegisterSendPayload(payload_type); | 257 return rtp_sender_.DeRegisterSendPayload(payload_type); |
263 } | 258 } |
264 | 259 |
265 int8_t ModuleRtpRtcpImpl::SendPayloadType() const { | 260 int8_t ModuleRtpRtcpImpl::SendPayloadType() const { |
266 return rtp_sender_.SendPayloadType(); | 261 return rtp_sender_.SendPayloadType(); |
267 } | 262 } |
268 | 263 |
269 uint32_t ModuleRtpRtcpImpl::StartTimestamp() const { | 264 uint32_t ModuleRtpRtcpImpl::StartTimestamp() const { |
270 return rtp_sender_.TimestampOffset(); | 265 return rtp_sender_.StartTimestamp(); |
271 } | 266 } |
272 | 267 |
273 // Configure start timestamp, default is a random number. | 268 // Configure start timestamp, default is a random number. |
274 void ModuleRtpRtcpImpl::SetStartTimestamp(const uint32_t timestamp) { | 269 void ModuleRtpRtcpImpl::SetStartTimestamp(const uint32_t timestamp) { |
275 rtcp_sender_.SetTimestampOffset(timestamp); | 270 rtcp_sender_.SetStartTimestamp(timestamp); |
276 rtp_sender_.SetTimestampOffset(timestamp); | 271 rtp_sender_.SetStartTimestamp(timestamp, true); |
277 } | 272 } |
278 | 273 |
279 uint16_t ModuleRtpRtcpImpl::SequenceNumber() const { | 274 uint16_t ModuleRtpRtcpImpl::SequenceNumber() const { |
280 return rtp_sender_.SequenceNumber(); | 275 return rtp_sender_.SequenceNumber(); |
281 } | 276 } |
282 | 277 |
283 // Set SequenceNumber, default is a random number. | 278 // Set SequenceNumber, default is a random number. |
284 void ModuleRtpRtcpImpl::SetSequenceNumber(const uint16_t seq_num) { | 279 void ModuleRtpRtcpImpl::SetSequenceNumber(const uint16_t seq_num) { |
285 rtp_sender_.SetSequenceNumber(seq_num); | 280 rtp_sender_.SetSequenceNumber(seq_num); |
286 } | 281 } |
287 | 282 |
288 void ModuleRtpRtcpImpl::SetRtpState(const RtpState& rtp_state) { | 283 void ModuleRtpRtcpImpl::SetRtpState(const RtpState& rtp_state) { |
| 284 SetStartTimestamp(rtp_state.start_timestamp); |
289 rtp_sender_.SetRtpState(rtp_state); | 285 rtp_sender_.SetRtpState(rtp_state); |
290 rtcp_sender_.SetTimestampOffset(rtp_state.start_timestamp); | |
291 } | 286 } |
292 | 287 |
293 void ModuleRtpRtcpImpl::SetRtxState(const RtpState& rtp_state) { | 288 void ModuleRtpRtcpImpl::SetRtxState(const RtpState& rtp_state) { |
294 rtp_sender_.SetRtxRtpState(rtp_state); | 289 rtp_sender_.SetRtxRtpState(rtp_state); |
295 } | 290 } |
296 | 291 |
297 RtpState ModuleRtpRtcpImpl::GetRtpState() const { | 292 RtpState ModuleRtpRtcpImpl::GetRtpState() const { |
298 return rtp_sender_.GetRtpState(); | 293 return rtp_sender_.GetRtpState(); |
299 } | 294 } |
300 | 295 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 346 |
352 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) { | 347 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) { |
353 if (rtcp_sender_.Sending() != sending) { | 348 if (rtcp_sender_.Sending() != sending) { |
354 // Sends RTCP BYE when going from true to false | 349 // Sends RTCP BYE when going from true to false |
355 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) { | 350 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) { |
356 LOG(LS_WARNING) << "Failed to send RTCP BYE"; | 351 LOG(LS_WARNING) << "Failed to send RTCP BYE"; |
357 } | 352 } |
358 | 353 |
359 collision_detected_ = false; | 354 collision_detected_ = false; |
360 | 355 |
| 356 // Generate a new time_stamp if true and not configured via API |
361 // Generate a new SSRC for the next "call" if false | 357 // Generate a new SSRC for the next "call" if false |
362 rtp_sender_.SetSendingStatus(sending); | 358 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 |