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

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

Issue 2644303002: Delete class SSRCDatabase, and its global ssrc registry. (Closed)
Patch Set: Rebase. 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),
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),
114 rtt_ms_(0) { 113 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
120 // Make sure rtcp sender use same timestamp offset as rtp sender. 114 // Make sure rtcp sender use same timestamp offset as rtp sender.
121 rtcp_sender_.SetTimestampOffset(rtp_sender_.TimestampOffset()); 115 rtcp_sender_.SetTimestampOffset(rtp_sender_.TimestampOffset());
122 116
123 // Set default packet size limit. 117 // Set default packet size limit.
124 // TODO(nisse): Kind-of duplicates 118 // TODO(nisse): Kind-of duplicates
125 // webrtc::VideoSendStream::Config::Rtp::kDefaultMaxPacketSize. 119 // webrtc::VideoSendStream::Config::Rtp::kDefaultMaxPacketSize.
126 const size_t kTcpOverIpv4HeaderSize = 40; 120 const size_t kTcpOverIpv4HeaderSize = 40;
127 SetMaxRtpPacketSize(IP_PACKET_SIZE - kTcpOverIpv4HeaderSize); 121 SetMaxRtpPacketSize(IP_PACKET_SIZE - kTcpOverIpv4HeaderSize);
128 } 122 }
129 123
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 BitrateSent(&state.send_bitrate, &tmp, &tmp, &tmp); 342 BitrateSent(&state.send_bitrate, &tmp, &tmp, &tmp);
349 return state; 343 return state;
350 } 344 }
351 345
352 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) { 346 int32_t ModuleRtpRtcpImpl::SetSendingStatus(const bool sending) {
353 if (rtcp_sender_.Sending() != sending) { 347 if (rtcp_sender_.Sending() != sending) {
354 // Sends RTCP BYE when going from true to false 348 // Sends RTCP BYE when going from true to false
355 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) { 349 if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) {
356 LOG(LS_WARNING) << "Failed to send RTCP BYE"; 350 LOG(LS_WARNING) << "Failed to send RTCP BYE";
357 } 351 }
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;
371 } 352 }
372 return 0; 353 return 0;
373 } 354 }
374 355
375 bool ModuleRtpRtcpImpl::Sending() const { 356 bool ModuleRtpRtcpImpl::Sending() const {
376 return rtcp_sender_.Sending(); 357 return rtcp_sender_.Sending();
377 } 358 }
378 359
379 void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) { 360 void ModuleRtpRtcpImpl::SetSendingMediaStatus(const bool sending) {
380 rtp_sender_.SetSendingMediaStatus(sending); 361 rtp_sender_.SetSendingMediaStatus(sending);
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 bool ModuleRtpRtcpImpl::SetFecParameters( 768 bool ModuleRtpRtcpImpl::SetFecParameters(
788 const FecProtectionParams& delta_params, 769 const FecProtectionParams& delta_params,
789 const FecProtectionParams& key_params) { 770 const FecProtectionParams& key_params) {
790 return rtp_sender_.SetFecParameters(delta_params, key_params); 771 return rtp_sender_.SetFecParameters(delta_params, key_params);
791 } 772 }
792 773
793 void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) { 774 void ModuleRtpRtcpImpl::SetRemoteSSRC(const uint32_t ssrc) {
794 // Inform about the incoming SSRC. 775 // Inform about the incoming SSRC.
795 rtcp_sender_.SetRemoteSSRC(ssrc); 776 rtcp_sender_.SetRemoteSSRC(ssrc);
796 rtcp_receiver_.SetRemoteSSRC(ssrc); 777 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 }
815 } 778 }
816 779
817 void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate, 780 void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate,
818 uint32_t* video_rate, 781 uint32_t* video_rate,
819 uint32_t* fec_rate, 782 uint32_t* fec_rate,
820 uint32_t* nack_rate) const { 783 uint32_t* nack_rate) const {
821 *total_rate = rtp_sender_.BitrateSent(); 784 *total_rate = rtp_sender_.BitrateSent();
822 *video_rate = rtp_sender_.VideoBitrateSent(); 785 *video_rate = rtp_sender_.VideoBitrateSent();
823 *fec_rate = rtp_sender_.FecOverheadRate(); 786 *fec_rate = rtp_sender_.FecOverheadRate();
824 *nack_rate = rtp_sender_.NackOverheadRate(); 787 *nack_rate = rtp_sender_.NackOverheadRate();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 StreamDataCountersCallback* 876 StreamDataCountersCallback*
914 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { 877 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const {
915 return rtp_sender_.GetRtpStatisticsCallback(); 878 return rtp_sender_.GetRtpStatisticsCallback();
916 } 879 }
917 880
918 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( 881 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation(
919 const BitrateAllocation& bitrate) { 882 const BitrateAllocation& bitrate) {
920 rtcp_sender_.SetVideoBitrateAllocation(bitrate); 883 rtcp_sender_.SetVideoBitrateAllocation(bitrate);
921 } 884 }
922 } // namespace webrtc 885 } // 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