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

Unified Diff: webrtc/modules/rtp_rtcp/source/ssrc_database.cc

Issue 1623543002: Refactor RtpSender and SSRCDatabase a bit. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Update comment and remove the one from ssrc_database.cc Created 4 years, 11 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/ssrc_database.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/ssrc_database.cc
diff --git a/webrtc/modules/rtp_rtcp/source/ssrc_database.cc b/webrtc/modules/rtp_rtcp/source/ssrc_database.cc
index fb02b7ef12cd12f785fd18ed331e1407d3fd38c4..f1d1549e279d5ea47ddae621bdf3407dfdcf4bfe 100644
--- a/webrtc/modules/rtp_rtcp/source/ssrc_database.cc
+++ b/webrtc/modules/rtp_rtcp/source/ssrc_database.cc
@@ -11,15 +11,9 @@
#include "webrtc/modules/rtp_rtcp/source/ssrc_database.h"
#include "webrtc/base/checks.h"
-#include "webrtc/system_wrappers/include/clock.h"
-#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
+#include "webrtc/system_wrappers/include/tick_util.h"
namespace webrtc {
-namespace {
-uint64_t Seed() {
- return Clock::GetRealTimeClock()->TimeInMicroseconds();
-}
-} // namespace
SSRCDatabase* SSRCDatabase::GetSSRCDatabase() {
return GetStaticInstance<SSRCDatabase>(kAddRef);
@@ -30,7 +24,7 @@ void SSRCDatabase::ReturnSSRCDatabase() {
}
uint32_t SSRCDatabase::CreateSSRC() {
- CriticalSectionScoped lock(crit_.get());
+ rtc::CritScope lock(&crit_);
while (true) { // Try until get a new ssrc.
// 0 and 0xffffffff are invalid values for SSRC.
@@ -42,19 +36,17 @@ uint32_t SSRCDatabase::CreateSSRC() {
}
void SSRCDatabase::RegisterSSRC(uint32_t ssrc) {
- CriticalSectionScoped lock(crit_.get());
+ rtc::CritScope lock(&crit_);
ssrcs_.insert(ssrc);
}
void SSRCDatabase::ReturnSSRC(uint32_t ssrc) {
- CriticalSectionScoped lock(crit_.get());
+ rtc::CritScope lock(&crit_);
ssrcs_.erase(ssrc);
}
-SSRCDatabase::SSRCDatabase()
- : crit_(CriticalSectionWrapper::CreateCriticalSection()), random_(Seed()) {}
+SSRCDatabase::SSRCDatabase() : random_(TickTime::Now().Ticks()) {}
-SSRCDatabase::~SSRCDatabase() {
-}
+SSRCDatabase::~SSRCDatabase() {}
} // namespace webrtc
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/ssrc_database.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698