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

Unified Diff: webrtc/api/rtcstatscollector.cc

Issue 2583613003: Fix segfault when PeerConnection is destroyed during stats collection. (Closed)
Patch Set: Addressed comments Created 4 years 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
« webrtc/api/peerconnection.cc ('K') | « webrtc/api/rtcstatscollector.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/rtcstatscollector.cc
diff --git a/webrtc/api/rtcstatscollector.cc b/webrtc/api/rtcstatscollector.cc
index a6d691c33339fd453ccf03175017e2422764e840..f4a1604f9df70e613aa226d02d8bf2f843b8007d 100644
--- a/webrtc/api/rtcstatscollector.cc
+++ b/webrtc/api/rtcstatscollector.cc
@@ -430,6 +430,17 @@ void RTCStatsCollector::ClearCachedStatsReport() {
cached_report_ = nullptr;
}
+void RTCStatsCollector::WaitForPendingRequest() {
+ RTC_DCHECK(signaling_thread_->IsCurrent());
+ if (num_pending_partial_reports_) {
+ rtc::Thread::Current()->ProcessMessages(0);
+ while (num_pending_partial_reports_) {
+ rtc::Thread::Current()->SleepMs(1);
Taylor Brandstetter 2016/12/16 18:53:27 nit: Could use an rtc::Event that's set when a par
hbos 2016/12/19 09:52:48 rtc::Event's wait does not process messages. In or
+ rtc::Thread::Current()->ProcessMessages(0);
+ }
+ }
+}
+
void RTCStatsCollector::ProducePartialResultsOnSignalingThread(
int64_t timestamp_us) {
RTC_DCHECK(signaling_thread_->IsCurrent());
« webrtc/api/peerconnection.cc ('K') | « webrtc/api/rtcstatscollector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698