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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
348 BitrateSent(&state.send_bitrate, &tmp, &tmp, &tmp); | 347 BitrateSent(&state.send_bitrate, &tmp, &tmp, &tmp); |
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 | |
danilchap
2017/02/01 12:23:55
I also think this block is obsolete, tried remove
| |
359 collision_detected_ = false; | |
360 | |
361 // Generate a new SSRC for the next "call" if false | |
362 rtp_sender_.SetSendingStatus(sending); | |
363 | |
364 // Make sure that RTCP objects are aware of our SSRC (it could have changed | |
365 // Due to collision) | |
366 uint32_t SSRC = rtp_sender_.SSRC(); | |
367 rtcp_sender_.SetSSRC(SSRC); | |
368 SetRtcpReceiverSsrcs(SSRC); | |
369 | |
370 return 0; | |
371 } | 357 } |
372 return 0; | 358 return 0; |
373 } | 359 } |
374 | 360 |
375 bool ModuleRtpRtcpImpl::Sending() const { | 361 bool ModuleRtpRtcpImpl::Sending() const { |
376 return rtcp_sender_.Sending(); | 362 return rtcp_sender_.Sending(); |
377 } | 363 } |
378 | 364 |
379 void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) { | 365 void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) { |
380 rtp_sender_.SetSendingMediaStatus(sending); | 366 rtp_sender_.SetSendingMediaStatus(sending); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
778 bool ModuleRtpRtcpImpl::SetFecParameters( | 764 bool ModuleRtpRtcpImpl::SetFecParameters( |
779 const FecProtectionParams& delta_params, | 765 const FecProtectionParams& delta_params, |
780 const FecProtectionParams& key_params) { | 766 const FecProtectionParams& key_params) { |
781 return rtp_sender_.SetFecParameters(delta_params, key_params); | 767 return rtp_sender_.SetFecParameters(delta_params, key_params); |
782 } | 768 } |
783 | 769 |
784 void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) { | 770 void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) { |
785 // Inform about the incoming SSRC. | 771 // Inform about the incoming SSRC. |
786 rtcp_sender_.SetRemoteSSRC(ssrc); | 772 rtcp_sender_.SetRemoteSSRC(ssrc); |
787 rtcp_receiver_.SetRemoteSSRC(ssrc); | 773 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 } | 774 } |
807 | 775 |
808 void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate, | 776 void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate, |
809 uint32_t* video_rate, | 777 uint32_t* video_rate, |
810 uint32_t* fec_rate, | 778 uint32_t* fec_rate, |
811 uint32_t* nack_rate) const { | 779 uint32_t* nack_rate) const { |
812 *total_rate = rtp_sender_.BitrateSent(); | 780 *total_rate = rtp_sender_.BitrateSent(); |
813 *video_rate = rtp_sender_.VideoBitrateSent(); | 781 *video_rate = rtp_sender_.VideoBitrateSent(); |
814 *fec_rate = rtp_sender_.FecOverheadRate(); | 782 *fec_rate = rtp_sender_.FecOverheadRate(); |
815 *nack_rate = rtp_sender_.NackOverheadRate(); | 783 *nack_rate = rtp_sender_.NackOverheadRate(); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
911 StreamDataCountersCallback* | 879 StreamDataCountersCallback* |
912 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { | 880 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { |
913 return rtp_sender_.GetRtpStatisticsCallback(); | 881 return rtp_sender_.GetRtpStatisticsCallback(); |
914 } | 882 } |
915 | 883 |
916 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( | 884 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( |
917 const BitrateAllocation& bitrate) { | 885 const BitrateAllocation& bitrate) { |
918 rtcp_sender_.SetVideoBitrateAllocation(bitrate); | 886 rtcp_sender_.SetVideoBitrateAllocation(bitrate); |
919 } | 887 } |
920 } // namespace webrtc | 888 } // namespace webrtc |
OLD | NEW |