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

Side by Side Diff: webrtc/modules/audio_processing/audio_processing_impl_locking_unittest.cc

Issue 1469013002: Move ThreadWrapper to ProcessThread in base. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: removed comment Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/modules/audio_processing/audio_processing_impl.h" 11 #include "webrtc/modules/audio_processing/audio_processing_impl.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <vector> 14 #include <vector>
15 15
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "webrtc/base/array_view.h" 17 #include "webrtc/base/array_view.h"
18 #include "webrtc/base/criticalsection.h" 18 #include "webrtc/base/criticalsection.h"
19 #include "webrtc/base/platform_thread.h"
19 #include "webrtc/config.h" 20 #include "webrtc/config.h"
20 #include "webrtc/modules/audio_processing/test/test_utils.h" 21 #include "webrtc/modules/audio_processing/test/test_utils.h"
21 #include "webrtc/modules/include/module_common_types.h" 22 #include "webrtc/modules/include/module_common_types.h"
22 #include "webrtc/system_wrappers/include/event_wrapper.h" 23 #include "webrtc/system_wrappers/include/event_wrapper.h"
23 #include "webrtc/system_wrappers/include/sleep.h" 24 #include "webrtc/system_wrappers/include/sleep.h"
24 #include "webrtc/system_wrappers/include/thread_wrapper.h"
25 #include "webrtc/test/random.h" 25 #include "webrtc/test/random.h"
26 26
27 namespace webrtc { 27 namespace webrtc {
28 28
29 namespace { 29 namespace {
30 30
31 class AudioProcessingImplLockTest; 31 class AudioProcessingImplLockTest;
32 32
33 // Sleeps a random time between 0 and max_sleep milliseconds. 33 // Sleeps a random time between 0 and max_sleep milliseconds.
34 void SleepRandomMs(int max_sleep, test::Random* rand_gen) { 34 void SleepRandomMs(int max_sleep, test::Random* rand_gen) {
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 ASSERT_TRUE(capture_thread_->Start()); 449 ASSERT_TRUE(capture_thread_->Start());
450 capture_thread_->SetPriority(kRealtimePriority); 450 capture_thread_->SetPriority(kRealtimePriority);
451 ASSERT_TRUE(stats_thread_->Start()); 451 ASSERT_TRUE(stats_thread_->Start());
452 stats_thread_->SetPriority(kNormalPriority); 452 stats_thread_->SetPriority(kNormalPriority);
453 } 453 }
454 454
455 // Event handler for the test. 455 // Event handler for the test.
456 const rtc::scoped_ptr<EventWrapper> test_complete_; 456 const rtc::scoped_ptr<EventWrapper> test_complete_;
457 457
458 // Thread related variables. 458 // Thread related variables.
459 rtc::scoped_ptr<ThreadWrapper> render_thread_; 459 rtc::scoped_ptr<PlatformThread> render_thread_;
460 rtc::scoped_ptr<ThreadWrapper> capture_thread_; 460 rtc::scoped_ptr<PlatformThread> capture_thread_;
461 rtc::scoped_ptr<ThreadWrapper> stats_thread_; 461 rtc::scoped_ptr<PlatformThread> stats_thread_;
462 mutable test::Random rand_gen_; 462 mutable test::Random rand_gen_;
463 463
464 rtc::scoped_ptr<AudioProcessing> apm_; 464 rtc::scoped_ptr<AudioProcessing> apm_;
465 TestConfig test_config_; 465 TestConfig test_config_;
466 FrameCounters frame_counters_; 466 FrameCounters frame_counters_;
467 CaptureSideCalledChecker capture_call_checker_; 467 CaptureSideCalledChecker capture_call_checker_;
468 RenderProcessor render_thread_state_; 468 RenderProcessor render_thread_state_;
469 CaptureProcessor capture_thread_state_; 469 CaptureProcessor capture_thread_state_;
470 StatsProcessor stats_thread_state_; 470 StatsProcessor stats_thread_state_;
471 }; 471 };
472 472
473 AudioProcessingImplLockTest::AudioProcessingImplLockTest() 473 AudioProcessingImplLockTest::AudioProcessingImplLockTest()
474 : test_complete_(EventWrapper::Create()), 474 : test_complete_(EventWrapper::Create()),
475 render_thread_(ThreadWrapper::CreateThread(RenderProcessorThreadFunc, 475 render_thread_(PlatformThread::CreateThread(RenderProcessorThreadFunc,
476 this,
477 "render")),
478 capture_thread_(PlatformThread::CreateThread(CaptureProcessorThreadFunc,
479 this,
480 "capture")),
481 stats_thread_(PlatformThread::CreateThread(StatsProcessorThreadFunc,
476 this, 482 this,
477 "render")), 483 "stats")),
478 capture_thread_(ThreadWrapper::CreateThread(CaptureProcessorThreadFunc,
479 this,
480 "capture")),
481 stats_thread_(
482 ThreadWrapper::CreateThread(StatsProcessorThreadFunc, this, "stats")),
483 rand_gen_(42U), 484 rand_gen_(42U),
484 apm_(AudioProcessingImpl::Create()), 485 apm_(AudioProcessingImpl::Create()),
485 render_thread_state_(kMaxFrameSize, 486 render_thread_state_(kMaxFrameSize,
486 &rand_gen_, 487 &rand_gen_,
487 &frame_counters_, 488 &frame_counters_,
488 &capture_call_checker_, 489 &capture_call_checker_,
489 this, 490 this,
490 &test_config_, 491 &test_config_,
491 apm_.get()), 492 apm_.get()),
492 capture_thread_state_(kMaxFrameSize, 493 capture_thread_state_(kMaxFrameSize,
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 DISABLED_AudioProcessingImplLockExtensive, 1110 DISABLED_AudioProcessingImplLockExtensive,
1110 AudioProcessingImplLockTest, 1111 AudioProcessingImplLockTest,
1111 ::testing::ValuesIn(TestConfig::GenerateExtensiveTestConfigs())); 1112 ::testing::ValuesIn(TestConfig::GenerateExtensiveTestConfigs()));
1112 1113
1113 INSTANTIATE_TEST_CASE_P( 1114 INSTANTIATE_TEST_CASE_P(
1114 DISABLED_AudioProcessingImplLockBrief, 1115 DISABLED_AudioProcessingImplLockBrief,
1115 AudioProcessingImplLockTest, 1116 AudioProcessingImplLockTest,
1116 ::testing::ValuesIn(TestConfig::GenerateBriefTestConfigs())); 1117 ::testing::ValuesIn(TestConfig::GenerateBriefTestConfigs()));
1117 1118
1118 } // namespace webrtc 1119 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/win/audio_device_wave_win.cc ('k') | webrtc/modules/rtp_rtcp/test/BWEStandAlone/MatlabPlot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698