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

Unified Diff: webrtc/api/rtcstats_integrationtest.cc

Issue 2583613003: Fix segfault when PeerConnection is destroyed during stats collection. (Closed)
Patch Set: 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
Index: webrtc/api/rtcstats_integrationtest.cc
diff --git a/webrtc/api/rtcstats_integrationtest.cc b/webrtc/api/rtcstats_integrationtest.cc
index db54b175188c5dc24715129916efabddbb1debb3..0308d57ddad9cb468eb4810933b62b82726caabe 100644
--- a/webrtc/api/rtcstats_integrationtest.cc
+++ b/webrtc/api/rtcstats_integrationtest.cc
@@ -73,6 +73,10 @@ class RTCStatsIntegrationTest : public testing::Test {
callee_->WaitForCallEstablished();
}
+ void DestroyCallerAndCallee() {
+ caller_ = callee_ = nullptr;
+ }
+
rtc::scoped_refptr<const RTCStatsReport> GetStatsFromCaller() {
return GetStats(caller_->pc());
}
@@ -537,6 +541,18 @@ TEST_F(RTCStatsIntegrationTest, GetStatsFromCallee) {
RTCStatsReportVerifier(report.get()).VerifyReport();
}
+TEST_F(RTCStatsIntegrationTest, GetsStatsWhileDestroyingPeerConnections) {
+ StartCall();
+
+ rtc::scoped_refptr<RTCStatsObtainer> stats_obtainer =
+ RTCStatsObtainer::Create();
+ caller_->pc()->GetStats(stats_obtainer);
+ DestroyCallerAndCallee();
hta-webrtc 2016/12/16 14:05:31 In the interest of minimizing the amount of side e
hbos 2016/12/16 14:34:52 Good point, changed to "caller_ = nullptr" and rem
+ // Any pending stats requests should have completed in the act of destroying
+ // the peer connection.
+ EXPECT_TRUE(stats_obtainer->report());
+}
+
} // namespace
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698