aboutsummaryrefslogtreecommitdiff
path: root/video/video_analyzer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'video/video_analyzer.cc')
-rw-r--r--video/video_analyzer.cc22
1 files changed, 8 insertions, 14 deletions
diff --git a/video/video_analyzer.cc b/video/video_analyzer.cc
index 6698dadf42..81dcf055b8 100644
--- a/video/video_analyzer.cc
+++ b/video/video_analyzer.cc
@@ -137,10 +137,12 @@ VideoAnalyzer::VideoAnalyzer(test::LayerFilteringTransport* transport,
}
for (uint32_t i = 0; i < num_cores; ++i) {
- rtc::PlatformThread* thread =
- new rtc::PlatformThread(&FrameComparisonThread, this, "Analyzer");
- thread->Start();
- comparison_thread_pool_.push_back(thread);
+ comparison_thread_pool_.push_back(rtc::PlatformThread::SpawnJoinable(
+ [this] {
+ while (CompareFrames()) {
+ }
+ },
+ "Analyzer"));
}
if (!rtp_dump_name.empty()) {
@@ -155,10 +157,8 @@ VideoAnalyzer::~VideoAnalyzer() {
MutexLock lock(&comparison_lock_);
quit_ = true;
}
- for (rtc::PlatformThread* thread : comparison_thread_pool_) {
- thread->Stop();
- delete thread;
- }
+ // Joins all threads.
+ comparison_thread_pool_.clear();
}
void VideoAnalyzer::SetReceiver(PacketReceiver* receiver) {
@@ -533,12 +533,6 @@ void VideoAnalyzer::PollStats() {
memory_usage_.AddSample(rtc::GetProcessResidentSizeBytes());
}
-void VideoAnalyzer::FrameComparisonThread(void* obj) {
- VideoAnalyzer* analyzer = static_cast<VideoAnalyzer*>(obj);
- while (analyzer->CompareFrames()) {
- }
-}
-
bool VideoAnalyzer::CompareFrames() {
if (AllFramesRecorded())
return false;