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

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

Issue 1710483002: Replace scoped_ptr with unique_ptr in webrtc/modules/audio_processing/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 10 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 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 #include "webrtc/modules/audio_processing/audio_processing_impl.h" 10 #include "webrtc/modules/audio_processing/audio_processing_impl.h"
11 11
12 #include <math.h> 12 #include <math.h>
13 13
14 #include <algorithm> 14 #include <algorithm>
15 #include <memory>
15 #include <vector> 16 #include <vector>
16 17
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "webrtc/base/array_view.h" 19 #include "webrtc/base/array_view.h"
19 #include "webrtc/base/atomicops.h" 20 #include "webrtc/base/atomicops.h"
20 #include "webrtc/base/platform_thread.h" 21 #include "webrtc/base/platform_thread.h"
21 #include "webrtc/base/random.h" 22 #include "webrtc/base/random.h"
22 #include "webrtc/base/safe_conversions.h" 23 #include "webrtc/base/safe_conversions.h"
23 #include "webrtc/config.h" 24 #include "webrtc/config.h"
24 #include "webrtc/modules/audio_processing/test/test_utils.h" 25 #include "webrtc/modules/audio_processing/test/test_utils.h"
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 651
651 // Start the threads used in the test. 652 // Start the threads used in the test.
652 void StartThreads() { 653 void StartThreads() {
653 ASSERT_NO_FATAL_FAILURE(render_thread_->Start()); 654 ASSERT_NO_FATAL_FAILURE(render_thread_->Start());
654 render_thread_->SetPriority(rtc::kRealtimePriority); 655 render_thread_->SetPriority(rtc::kRealtimePriority);
655 ASSERT_NO_FATAL_FAILURE(capture_thread_->Start()); 656 ASSERT_NO_FATAL_FAILURE(capture_thread_->Start());
656 capture_thread_->SetPriority(rtc::kRealtimePriority); 657 capture_thread_->SetPriority(rtc::kRealtimePriority);
657 } 658 }
658 659
659 // Event handler for the test. 660 // Event handler for the test.
660 const rtc::scoped_ptr<EventWrapper> test_complete_; 661 const std::unique_ptr<EventWrapper> test_complete_;
661 662
662 // Thread related variables. 663 // Thread related variables.
663 rtc::scoped_ptr<rtc::PlatformThread> render_thread_; 664 std::unique_ptr<rtc::PlatformThread> render_thread_;
664 rtc::scoped_ptr<rtc::PlatformThread> capture_thread_; 665 std::unique_ptr<rtc::PlatformThread> capture_thread_;
665 Random rand_gen_; 666 Random rand_gen_;
666 667
667 rtc::scoped_ptr<AudioProcessing> apm_; 668 std::unique_ptr<AudioProcessing> apm_;
668 const SimulationConfig simulation_config_; 669 const SimulationConfig simulation_config_;
669 FrameCounters frame_counters_; 670 FrameCounters frame_counters_;
670 LockedFlag capture_call_checker_; 671 LockedFlag capture_call_checker_;
671 rtc::scoped_ptr<TimedThreadApiProcessor> render_thread_state_; 672 std::unique_ptr<TimedThreadApiProcessor> render_thread_state_;
672 rtc::scoped_ptr<TimedThreadApiProcessor> capture_thread_state_; 673 std::unique_ptr<TimedThreadApiProcessor> capture_thread_state_;
673 }; 674 };
674 675
675 // Implements the callback functionality for the threads. 676 // Implements the callback functionality for the threads.
676 bool TimedThreadApiProcessor::Process() { 677 bool TimedThreadApiProcessor::Process() {
677 PrepareFrame(); 678 PrepareFrame();
678 679
679 // Wait in a spinlock manner until it is ok to start processing. 680 // Wait in a spinlock manner until it is ok to start processing.
680 // Note that SleepMs is not applicable since it only allows sleeping 681 // Note that SleepMs is not applicable since it only allows sleeping
681 // on a millisecond basis which is too long. 682 // on a millisecond basis which is too long.
682 // TODO(tommi): This loop may affect the performance of the test that it's 683 // TODO(tommi): This loop may affect the performance of the test that it's
(...skipping 24 matching lines...) Expand all
707 // Run test and verify that it did not time out. 708 // Run test and verify that it did not time out.
708 EXPECT_EQ(kEventSignaled, Run()); 709 EXPECT_EQ(kEventSignaled, Run());
709 } 710 }
710 711
711 INSTANTIATE_TEST_CASE_P( 712 INSTANTIATE_TEST_CASE_P(
712 AudioProcessingPerformanceTest, 713 AudioProcessingPerformanceTest,
713 CallSimulator, 714 CallSimulator,
714 ::testing::ValuesIn(SimulationConfig::GenerateSimulationConfigs())); 715 ::testing::ValuesIn(SimulationConfig::GenerateSimulationConfigs()));
715 716
716 } // namespace webrtc 717 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698