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

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

Issue 2813753002: Modified the rtp_receiver_unittests. (Closed)
Patch Set: Address the comments before submitting. Created 3 years, 8 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/api/rtpreceiverinterface.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_receiver_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc
index 9dd43c416abd02112087364eb925f5600d8e4cae..2c19298948b04cd92dbb0e24d431fb424c9aafbb 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc
@@ -211,41 +211,36 @@ TelephoneEventHandler* RtpReceiverImpl::GetTelephoneEventHandler() {
}
std::vector<RtpSource> RtpReceiverImpl::GetSources() const {
+ rtc::CritScope lock(&critical_section_rtp_receiver_);
+
int64_t now_ms = clock_->TimeInMilliseconds();
std::vector<RtpSource> sources;
- {
- rtc::CritScope lock(&critical_section_rtp_receiver_);
-
- RTC_DCHECK(std::is_sorted(ssrc_sources_.begin(), ssrc_sources_.end(),
- [](const RtpSource& lhs, const RtpSource& rhs) {
- return lhs.timestamp_ms() < rhs.timestamp_ms();
- }));
- RTC_DCHECK(std::is_sorted(csrc_sources_.begin(), csrc_sources_.end(),
- [](const RtpSource& lhs, const RtpSource& rhs) {
- return lhs.timestamp_ms() < rhs.timestamp_ms();
- }));
-
- std::set<uint32_t> selected_ssrcs;
- for (auto rit = ssrc_sources_.rbegin(); rit != ssrc_sources_.rend();
- ++rit) {
- if ((now_ms - rit->timestamp_ms()) > kGetSourcesTimeoutMs) {
- break;
- }
- if (selected_ssrcs.insert(rit->source_id()).second) {
- sources.push_back(*rit);
- }
+ RTC_DCHECK(std::is_sorted(ssrc_sources_.begin(), ssrc_sources_.end(),
+ [](const RtpSource& lhs, const RtpSource& rhs) {
+ return lhs.timestamp_ms() < rhs.timestamp_ms();
+ }));
+ RTC_DCHECK(std::is_sorted(csrc_sources_.begin(), csrc_sources_.end(),
+ [](const RtpSource& lhs, const RtpSource& rhs) {
+ return lhs.timestamp_ms() < rhs.timestamp_ms();
+ }));
+
+ std::set<uint32_t> selected_ssrcs;
+ for (auto rit = ssrc_sources_.rbegin(); rit != ssrc_sources_.rend(); ++rit) {
+ if ((now_ms - rit->timestamp_ms()) > kGetSourcesTimeoutMs) {
+ break;
}
-
- for (auto rit = csrc_sources_.rbegin(); rit != csrc_sources_.rend();
- ++rit) {
- if ((now_ms - rit->timestamp_ms()) > kGetSourcesTimeoutMs) {
- break;
- }
+ if (selected_ssrcs.insert(rit->source_id()).second) {
sources.push_back(*rit);
}
- } // End critsect.
+ }
+ for (auto rit = csrc_sources_.rbegin(); rit != csrc_sources_.rend(); ++rit) {
+ if ((now_ms - rit->timestamp_ms()) > kGetSourcesTimeoutMs) {
+ break;
+ }
+ sources.push_back(*rit);
+ }
return sources;
}
« no previous file with comments | « webrtc/api/rtpreceiverinterface.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698