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

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

Issue 2700413002: Revert of Delete class SSRCDatabase, and its global ssrc registry. (Closed)
Patch Set: Created 3 years, 10 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
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),
103 last_process_time_(configuration.clock->TimeInMilliseconds()), 104 last_process_time_(configuration.clock->TimeInMilliseconds()),
104 last_bitrate_process_time_(configuration.clock->TimeInMilliseconds()), 105 last_bitrate_process_time_(configuration.clock->TimeInMilliseconds()),
105 last_rtt_process_time_(configuration.clock->TimeInMilliseconds()), 106 last_rtt_process_time_(configuration.clock->TimeInMilliseconds()),
106 packet_overhead_(28), // IPV4 UDP. 107 packet_overhead_(28), // IPV4 UDP.
107 nack_last_time_sent_full_(0), 108 nack_last_time_sent_full_(0),
108 nack_last_time_sent_full_prev_(0), 109 nack_last_time_sent_full_prev_(0),
109 nack_last_seq_number_sent_(0), 110 nack_last_seq_number_sent_(0),
110 key_frame_req_method_(kKeyFrameReqPliRtcp), 111 key_frame_req_method_(kKeyFrameReqPliRtcp),
111 remote_bitrate_(configuration.remote_bitrate_estimator), 112 remote_bitrate_(configuration.remote_bitrate_estimator),
112 rtt_stats_(configuration.rtt_stats), 113 rtt_stats_(configuration.rtt_stats),
113 rtt_ms_(0) { 114 rtt_ms_(0) {
115 // Make sure that RTCP objects are aware of our SSRC.
116 uint32_t SSRC = rtp_sender_.SSRC();
117 rtcp_sender_.SetSSRC(SSRC);
118 SetRtcpReceiverSsrcs(SSRC);
119
114 // Make sure rtcp sender use same timestamp offset as rtp sender. 120 // Make sure rtcp sender use same timestamp offset as rtp sender.
115 rtcp_sender_.SetTimestampOffset(rtp_sender_.TimestampOffset()); 121 rtcp_sender_.SetTimestampOffset(rtp_sender_.TimestampOffset());
116 122
117 // Set default packet size limit. 123 // Set default packet size limit.
118 // TODO(nisse): Kind-of duplicates 124 // TODO(nisse): Kind-of duplicates
119 // webrtc::VideoSendStream::Config::Rtp::kDefaultMaxPacketSize. 125 // webrtc::VideoSendStream::Config::Rtp::kDefaultMaxPacketSize.
120 const size_t kTcpOverIpv4HeaderSize = 40; 126 const size_t kTcpOverIpv4HeaderSize = 40;
121 SetMaxRtpPacketSize(IP_PACKET_SIZE - kTcpOverIpv4HeaderSize); 127 SetMaxRtpPacketSize(IP_PACKET_SIZE - kTcpOverIpv4HeaderSize);
122 } 128 }
123 129
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 BitrateSent(&state.send_bitrate, &tmp, &tmp, &tmp); 348 BitrateSent(&state.send_bitrate, &tmp, &tmp, &tmp);
343 return state; 349 return state;
344 } 350 }
345 351
346 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) { 352 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) {
347 if (rtcp_sender_.Sending() != sending) { 353 if (rtcp_sender_.Sending() != sending) {
348 // Sends RTCP BYE when going from true to false 354 // Sends RTCP BYE when going from true to false
349 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) { 355 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) {
350 LOG(LS_WARNING) << "Failed to send RTCP BYE"; 356 LOG(LS_WARNING) << "Failed to send RTCP BYE";
351 } 357 }
358
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;
352 } 371 }
353 return 0; 372 return 0;
354 } 373 }
355 374
356 bool ModuleRtpRtcpImpl::Sending() const { 375 bool ModuleRtpRtcpImpl::Sending() const {
357 return rtcp_sender_.Sending(); 376 return rtcp_sender_.Sending();
358 } 377 }
359 378
360 void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) { 379 void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) {
361 rtp_sender_.SetSendingMediaStatus(sending); 380 rtp_sender_.SetSendingMediaStatus(sending);
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 bool ModuleRtpRtcpImpl::SetFecParameters( 787 bool ModuleRtpRtcpImpl::SetFecParameters(
769 const FecProtectionParams& delta_params, 788 const FecProtectionParams& delta_params,
770 const FecProtectionParams& key_params) { 789 const FecProtectionParams& key_params) {
771 return rtp_sender_.SetFecParameters(delta_params, key_params); 790 return rtp_sender_.SetFecParameters(delta_params, key_params);
772 } 791 }
773 792
774 void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) { 793 void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) {
775 // Inform about the incoming SSRC. 794 // Inform about the incoming SSRC.
776 rtcp_sender_.SetRemoteSSRC(ssrc); 795 rtcp_sender_.SetRemoteSSRC(ssrc);
777 rtcp_receiver_.SetRemoteSSRC(ssrc); 796 rtcp_receiver_.SetRemoteSSRC(ssrc);
797
798 // Check for a SSRC collision.
799 if (rtp_sender_.SSRC() == ssrc && !collision_detected_) {
800 // If we detect a collision change the SSRC but only once.
801 collision_detected_ = true;
802 uint32_t new_ssrc = rtp_sender_.GenerateNewSSRC();
803 if (new_ssrc == 0) {
804 // Configured via API ignore.
805 return;
806 }
807 if (RtcpMode::kOff != rtcp_sender_.Status()) {
808 // Send RTCP bye on the current SSRC.
809 SendRTCP(kRtcpBye);
810 }
811 // Change local SSRC and inform all objects about the new SSRC.
812 rtcp_sender_.SetSSRC(new_ssrc);
813 SetRtcpReceiverSsrcs(new_ssrc);
814 }
778 } 815 }
779 816
780 void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate, 817 void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate,
781 uint32_t* video_rate, 818 uint32_t* video_rate,
782 uint32_t* fec_rate, 819 uint32_t* fec_rate,
783 uint32_t* nack_rate) const { 820 uint32_t* nack_rate) const {
784 *total_rate = rtp_sender_.BitrateSent(); 821 *total_rate = rtp_sender_.BitrateSent();
785 *video_rate = rtp_sender_.VideoBitrateSent(); 822 *video_rate = rtp_sender_.VideoBitrateSent();
786 *fec_rate = rtp_sender_.FecOverheadRate(); 823 *fec_rate = rtp_sender_.FecOverheadRate();
787 *nack_rate = rtp_sender_.NackOverheadRate(); 824 *nack_rate = rtp_sender_.NackOverheadRate();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 StreamDataCountersCallback* 913 StreamDataCountersCallback*
877 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { 914 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const {
878 return rtp_sender_.GetRtpStatisticsCallback(); 915 return rtp_sender_.GetRtpStatisticsCallback();
879 } 916 }
880 917
881 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( 918 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation(
882 const BitrateAllocation& bitrate) { 919 const BitrateAllocation& bitrate) {
883 rtcp_sender_.SetVideoBitrateAllocation(bitrate); 920 rtcp_sender_.SetVideoBitrateAllocation(bitrate);
884 } 921 }
885 } // namespace webrtc 922 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698