Fix the Chrome crash caused by RtcEventLog
Stop the RtcEventLog when the PeerConnection is closed so that Chrome will not crash because of creating too many threads. BUG=chromium:687553 Review-Url: https://codereview.webrtc.org/2682433005 Cr-Commit-Position: refs/heads/master@{#16482}
This commit is contained in:
parent
9dd77baca4
commit
7798501d7a
@ -1558,6 +1558,7 @@ void PeerConnection::Close() {
|
||||
stats_->UpdateStats(kStatsOutputLevelStandard);
|
||||
|
||||
session_->Close();
|
||||
event_log_.reset();
|
||||
}
|
||||
|
||||
void PeerConnection::OnSessionStateChange(WebRtcSession* /*session*/,
|
||||
@ -2573,10 +2574,15 @@ bool PeerConnection::ReconfigurePortAllocator_n(
|
||||
|
||||
bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file,
|
||||
int64_t max_size_bytes) {
|
||||
if (!event_log_) {
|
||||
return false;
|
||||
}
|
||||
return event_log_->StartLogging(file, max_size_bytes);
|
||||
}
|
||||
|
||||
void PeerConnection::StopRtcEventLog_w() {
|
||||
event_log_->StopLogging();
|
||||
if (event_log_) {
|
||||
event_log_->StopLogging();
|
||||
}
|
||||
}
|
||||
} // namespace webrtc
|
||||
|
||||
@ -3100,6 +3100,20 @@ TEST_F(PeerConnectionInterfaceTest, CurrentAndPendingDescriptions) {
|
||||
EXPECT_EQ(local_answer, pc_->current_local_description());
|
||||
}
|
||||
|
||||
// Tests that it won't crash when calling StartRtcEventLog or StopRtcEventLog
|
||||
// after the PeerConnection is closed.
|
||||
TEST_F(PeerConnectionInterfaceTest,
|
||||
StartAndStopLoggingAfterPeerConnectionClosed) {
|
||||
CreatePeerConnection();
|
||||
// The RtcEventLog will be reset when the PeerConnection is closed.
|
||||
pc_->Close();
|
||||
|
||||
rtc::PlatformFile file = 0;
|
||||
int64_t max_size_bytes = 1024;
|
||||
EXPECT_FALSE(pc_->StartRtcEventLog(file, max_size_bytes));
|
||||
pc_->StopRtcEventLog();
|
||||
}
|
||||
|
||||
class PeerConnectionMediaConfigTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user