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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 482a7418bbdbb70542d9e6fab5c82ff4208651ff..f74ebba0c0e12b09f96a57cc67795fd4054d1de6 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -100,6 +100,7 @@
this),
clock_(configuration.clock),
audio_(configuration.audio),
+ collision_detected_(false),
last_process_time_(configuration.clock->TimeInMilliseconds()),
last_bitrate_process_time_(configuration.clock->TimeInMilliseconds()),
last_rtt_process_time_(configuration.clock->TimeInMilliseconds()),
@@ -111,6 +112,11 @@
remote_bitrate_(configuration.remote_bitrate_estimator),
rtt_stats_(configuration.rtt_stats),
rtt_ms_(0) {
+ // Make sure that RTCP objects are aware of our SSRC.
+ uint32_t SSRC = rtp_sender_.SSRC();
+ rtcp_sender_.SetSSRC(SSRC);
+ SetRtcpReceiverSsrcs(SSRC);
+
// Make sure rtcp sender use same timestamp offset as rtp sender.
rtcp_sender_.SetTimestampOffset(rtp_sender_.TimestampOffset());
@@ -349,6 +355,19 @@
if (rtcp_sender_.SetSendingStatus(GetFeedbackState(), sending) != 0) {
LOG(LS_WARNING) << "Failed to send RTCP BYE";
}
+
+ collision_detected_ = false;
+
+ // Generate a new SSRC for the next "call" if false
+ rtp_sender_.SetSendingStatus(sending);
+
+ // Make sure that RTCP objects are aware of our SSRC (it could have changed
+ // Due to collision)
+ uint32_t SSRC = rtp_sender_.SSRC();
+ rtcp_sender_.SetSSRC(SSRC);
+ SetRtcpReceiverSsrcs(SSRC);
+
+ return 0;
}
return 0;
}
@@ -775,6 +794,24 @@
// Inform about the incoming SSRC.
rtcp_sender_.SetRemoteSSRC(ssrc);
rtcp_receiver_.SetRemoteSSRC(ssrc);
+
+ // Check for a SSRC collision.
+ if (rtp_sender_.SSRC() == ssrc && !collision_detected_) {
+ // If we detect a collision change the SSRC but only once.
+ collision_detected_ = true;
+ uint32_t new_ssrc = rtp_sender_.GenerateNewSSRC();
+ if (new_ssrc == 0) {
+ // Configured via API ignore.
+ return;
+ }
+ if (RtcpMode::kOff != rtcp_sender_.Status()) {
+ // Send RTCP bye on the current SSRC.
+ SendRTCP(kRtcpBye);
+ }
+ // Change local SSRC and inform all objects about the new SSRC.
+ rtcp_sender_.SetSSRC(new_ssrc);
+ SetRtcpReceiverSsrcs(new_ssrc);
+ }
}
void ModuleRtpRtcpImpl::BitrateSent(uint32_t* total_rate,
« 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