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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 rtcp_receiver_(configuration.clock, | 93 rtcp_receiver_(configuration.clock, |
94 configuration.receiver_only, | 94 configuration.receiver_only, |
95 configuration.rtcp_packet_type_counter_observer, | 95 configuration.rtcp_packet_type_counter_observer, |
96 configuration.bandwidth_callback, | 96 configuration.bandwidth_callback, |
97 configuration.intra_frame_callback, | 97 configuration.intra_frame_callback, |
98 configuration.transport_feedback_callback, | 98 configuration.transport_feedback_callback, |
99 configuration.bitrate_allocation_observer, | 99 configuration.bitrate_allocation_observer, |
100 this), | 100 this), |
101 clock_(configuration.clock), | 101 clock_(configuration.clock), |
102 audio_(configuration.audio), | 102 audio_(configuration.audio), |
103 collision_detected_(false), | |
104 last_process_time_(configuration.clock->TimeInMilliseconds()), | 103 last_process_time_(configuration.clock->TimeInMilliseconds()), |
105 last_bitrate_process_time_(configuration.clock->TimeInMilliseconds()), | 104 last_bitrate_process_time_(configuration.clock->TimeInMilliseconds()), |
106 last_rtt_process_time_(configuration.clock->TimeInMilliseconds()), | 105 last_rtt_process_time_(configuration.clock->TimeInMilliseconds()), |
107 packet_overhead_(28), // IPV4 UDP. | 106 packet_overhead_(28), // IPV4 UDP. |
108 nack_last_time_sent_full_(0), | 107 nack_last_time_sent_full_(0), |
109 nack_last_time_sent_full_prev_(0), | 108 nack_last_time_sent_full_prev_(0), |
110 nack_last_seq_number_sent_(0), | 109 nack_last_seq_number_sent_(0), |
111 key_frame_req_method_(kKeyFrameReqPliRtcp), | 110 key_frame_req_method_(kKeyFrameReqPliRtcp), |
112 remote_bitrate_(configuration.remote_bitrate_estimator), | 111 remote_bitrate_(configuration.remote_bitrate_estimator), |
113 rtt_stats_(configuration.rtt_stats), | 112 rtt_stats_(configuration.rtt_stats), |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
349 return state; | 348 return state; |
350 } | 349 } |
351 | 350 |
352 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) { | 351 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) { |
353 if (rtcp_sender_.Sending() != sending) { | 352 if (rtcp_sender_.Sending() != sending) { |
354 // Sends RTCP BYE when going from true to false | 353 // Sends RTCP BYE when going from true to false |
355 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) { | 354 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) { |
356 LOG(LS_WARNING) << "Failed to send RTCP BYE"; | 355 LOG(LS_WARNING) << "Failed to send RTCP BYE"; |
357 } | 356 } |
358 | 357 |
359 collision_detected_ = false; | |
360 | |
361 // Generate a new SSRC for the next "call" if false | 358 // Generate a new SSRC for the next "call" if false |
nisse-webrtc
2017/01/31 14:23:42
This is no longer true, the SetSendingStatus is a
nisse-webrtc
2017/02/01 10:52:50
I just deleted this function and the below logic.
| |
362 rtp_sender_.SetSendingStatus(sending); | 359 rtp_sender_.SetSendingStatus(sending); |
363 | 360 |
364 // Make sure that RTCP objects are aware of our SSRC (it could have changed | 361 // Make sure that RTCP objects are aware of our SSRC (it could have changed |
365 // Due to collision) | 362 // Due to collision) |
366 uint32_t SSRC = rtp_sender_.SSRC(); | 363 uint32_t SSRC = rtp_sender_.SSRC(); |
367 rtcp_sender_.SetSSRC(SSRC); | 364 rtcp_sender_.SetSSRC(SSRC); |
368 SetRtcpReceiverSsrcs(SSRC); | 365 SetRtcpReceiverSsrcs(SSRC); |
369 | 366 |
370 return 0; | 367 return 0; |
371 } | 368 } |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
778 bool ModuleRtpRtcpImpl::SetFecParameters( | 775 bool ModuleRtpRtcpImpl::SetFecParameters( |
779 const FecProtectionParams& delta_params, | 776 const FecProtectionParams& delta_params, |
780 const FecProtectionParams& key_params) { | 777 const FecProtectionParams& key_params) { |
781 return rtp_sender_.SetFecParameters(delta_params, key_params); | 778 return rtp_sender_.SetFecParameters(delta_params, key_params); |
782 } | 779 } |
783 | 780 |
784 void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) { | 781 void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) { |
785 // Inform about the incoming SSRC. | 782 // Inform about the incoming SSRC. |
786 rtcp_sender_.SetRemoteSSRC(ssrc); | 783 rtcp_sender_.SetRemoteSSRC(ssrc); |
787 rtcp_receiver_.SetRemoteSSRC(ssrc); | 784 rtcp_receiver_.SetRemoteSSRC(ssrc); |
788 | |
789 // Check for a SSRC collision. | |
790 if (rtp_sender_.SSRC() == ssrc && !collision_detected_) { | |
791 // If we detect a collision change the SSRC but only once. | |
792 collision_detected_ = true; | |
793 uint32_t new_ssrc = rtp_sender_.GenerateNewSSRC(); | |
794 if (new_ssrc == 0) { | |
795 // Configured via API ignore. | |
796 return; | |
797 } | |
798 if (RtcpMode::kOff != rtcp_sender_.Status()) { | |
799 // Send RTCP bye on the current SSRC. | |
800 SendRTCP(kRtcpBye); | |
801 } | |
802 // Change local SSRC and inform all objects about the new SSRC. | |
803 rtcp_sender_.SetSSRC(new_ssrc); | |
804 SetRtcpReceiverSsrcs(new_ssrc); | |
805 } | |
806 } | 785 } |
807 | 786 |
808 void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate, | 787 void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate, |
809 uint32_t* video_rate, | 788 uint32_t* video_rate, |
810 uint32_t* fec_rate, | 789 uint32_t* fec_rate, |
811 uint32_t* nack_rate) const { | 790 uint32_t* nack_rate) const { |
812 *total_rate = rtp_sender_.BitrateSent(); | 791 *total_rate = rtp_sender_.BitrateSent(); |
813 *video_rate = rtp_sender_.VideoBitrateSent(); | 792 *video_rate = rtp_sender_.VideoBitrateSent(); |
814 *fec_rate = rtp_sender_.FecOverheadRate(); | 793 *fec_rate = rtp_sender_.FecOverheadRate(); |
815 *nack_rate = rtp_sender_.NackOverheadRate(); | 794 *nack_rate = rtp_sender_.NackOverheadRate(); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
911 StreamDataCountersCallback* | 890 StreamDataCountersCallback* |
912 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { | 891 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { |
913 return rtp_sender_.GetRtpStatisticsCallback(); | 892 return rtp_sender_.GetRtpStatisticsCallback(); |
914 } | 893 } |
915 | 894 |
916 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( | 895 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( |
917 const BitrateAllocation& bitrate) { | 896 const BitrateAllocation& bitrate) { |
918 rtcp_sender_.SetVideoBitrateAllocation(bitrate); | 897 rtcp_sender_.SetVideoBitrateAllocation(bitrate); |
919 } | 898 } |
920 } // namespace webrtc | 899 } // namespace webrtc |
OLD | NEW |