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

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

Issue 2984973002: Shrink critical-section scope in ReceiveStatisticsImpl::GetActiveStatisticians() (Closed)
Patch Set: Created 3 years, 5 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 | « no previous file | 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/receive_statistics_impl.cc
diff --git a/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc b/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc
index 6d64304149d662f746c78563e389a1e03deea921..ed6dea73c4def97746fa183216bfa014a10abc8d 100644
--- a/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc
+++ b/webrtc/modules/rtp_rtcp/source/receive_statistics_impl.cc
@@ -422,18 +422,22 @@ void ReceiveStatisticsImpl::FecPacketReceived(const RTPHeader& header,
}
StatisticianMap ReceiveStatisticsImpl::GetActiveStatisticians() const {
- rtc::CritScope cs(&receive_statistics_lock_);
StatisticianMap active_statisticians;
- for (StatisticianImplMap::const_iterator it = statisticians_.begin();
- it != statisticians_.end(); ++it) {
- uint32_t secs;
- uint32_t frac;
- it->second->LastReceiveTimeNtp(&secs, &frac);
- if (clock_->CurrentNtpInMilliseconds() -
- Clock::NtpToMs(secs, frac) < kStatisticsTimeoutMs) {
- active_statisticians[it->first] = it->second;
+
+ {
danilchap 2017/07/25 14:05:41 I think extra indentation make it less readable. s
eladalon 2017/07/25 14:28:49 I'm not sure I don't need this - I am not familiar
+ rtc::CritScope cs(&receive_statistics_lock_);
+ for (StatisticianImplMap::const_iterator it = statisticians_.begin();
+ it != statisticians_.end(); ++it) {
+ uint32_t secs;
+ uint32_t frac;
+ it->second->LastReceiveTimeNtp(&secs, &frac);
+ if (clock_->CurrentNtpInMilliseconds() -
+ Clock::NtpToMs(secs, frac) < kStatisticsTimeoutMs) {
+ active_statisticians[it->first] = it->second;
+ }
}
}
+
return active_statisticians;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698