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

Unified Diff: webrtc/video/video_quality_test.cc

Issue 1601033004: Remove use-after-free when quality tests stall. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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/video/video_quality_test.cc
diff --git a/webrtc/video/video_quality_test.cc b/webrtc/video/video_quality_test.cc
index 08ae0a9cee420241bf41084c32883405e184abef..6e8c9902c65df7b072ce256c52093205f8439f42 100644
--- a/webrtc/video/video_quality_test.cc
+++ b/webrtc/video/video_quality_test.cc
@@ -73,7 +73,7 @@ class VideoAnalyzer : public PacketReceiver,
avg_ssim_threshold_(avg_ssim_threshold),
stats_polling_thread_(&PollStatsThread, this, "StatsPoller"),
comparison_available_event_(false, false),
- done_(false, false) {
+ done_(true, false) {
// Create thread pool for CPU-expensive PSNR/SSIM calculations.
// Try to use about as many threads as cores, but leave kMinCoresLeft alone,
@@ -243,18 +243,18 @@ class VideoAnalyzer : public PacketReceiver,
last_frames_processed = frames_processed;
continue;
}
- ASSERT_GT(frames_processed, last_frames_processed)
pbos-webrtc 2016/01/19 13:37:28 This ASSERT caused the function to abort before st
- << "Analyzer stalled while waiting for test to finish.";
+ if (frames_processed == last_frames_processed) {
+ EXPECT_GT(frames_processed, last_frames_processed)
+ << "Analyzer stalled while waiting for test to finish.";
+ done_.Set();
+ break;
+ }
last_frames_processed = frames_processed;
}
if (iteration > 0)
printf("- Farewell, sweet Concorde!\n");
- // Signal stats polling thread if that is still waiting and stop it now,
- // since it uses the send_stream_ reference that might be reclaimed after
- // returning from this method.
- done_.Set();
stats_polling_thread_.Stop();
}
@@ -359,12 +359,8 @@ class VideoAnalyzer : public PacketReceiver,
}
bool PollStats() {
- if (done_.Wait(kSendStatsPollingIntervalMs)) {
- // Set event again to make sure main thread is also signaled, then we're
- // done.
- done_.Set();
+ if (done_.Wait(kSendStatsPollingIntervalMs))
return false;
- }
VideoSendStream::Stats stats = send_stream_->GetStats();
« 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