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

Side by Side Diff: media/base/multi_channel_resampler_unittest.cc

Issue 1906423005: Replace scoped_ptr with std::unique_ptr in //media/base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-media-base: android Created 4 years, 7 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
« no previous file with comments | « media/base/multi_channel_resampler.h ('k') | media/base/null_video_sink.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/multi_channel_resampler.h"
6
5 #include <cmath> 7 #include <cmath>
8 #include <memory>
6 9
7 #include "base/bind.h" 10 #include "base/bind.h"
8 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
9 #include "base/logging.h" 12 #include "base/logging.h"
10 #include "base/macros.h" 13 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "media/base/audio_bus.h" 14 #include "media/base/audio_bus.h"
13 #include "media/base/multi_channel_resampler.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 namespace media { 17 namespace media {
17 18
18 // Just test a basic resampling case. The SincResampler unit test will take 19 // Just test a basic resampling case. The SincResampler unit test will take
19 // care of accuracy testing; we just need to check that multichannel works as 20 // care of accuracy testing; we just need to check that multichannel works as
20 // expected within some tolerance. 21 // expected within some tolerance.
21 static const float kScaleFactor = 192000.0f / 44100.0f; 22 static const float kScaleFactor = 192000.0f / 44100.0f;
22 23
23 // Simulate large and small sample requests used by the different audio paths. 24 // Simulate large and small sample requests used by the different audio paths.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 double rms_error = sqrt( 112 double rms_error = sqrt(
112 sum_of_squares / (frames_ * audio_bus_->channels())); 113 sum_of_squares / (frames_ * audio_bus_->channels()));
113 114
114 EXPECT_LE(rms_error, expected_max_rms_error); 115 EXPECT_LE(rms_error, expected_max_rms_error);
115 EXPECT_LE(max_error, expected_max_error); 116 EXPECT_LE(max_error, expected_max_error);
116 } 117 }
117 118
118 protected: 119 protected:
119 int frames_; 120 int frames_;
120 bool fill_junk_values_; 121 bool fill_junk_values_;
121 scoped_ptr<AudioBus> audio_bus_; 122 std::unique_ptr<AudioBus> audio_bus_;
122 int last_frame_delay_; 123 int last_frame_delay_;
123 124
124 DISALLOW_COPY_AND_ASSIGN(MultiChannelResamplerTest); 125 DISALLOW_COPY_AND_ASSIGN(MultiChannelResamplerTest);
125 }; 126 };
126 127
127 TEST_P(MultiChannelResamplerTest, HighLatency) { 128 TEST_P(MultiChannelResamplerTest, HighLatency) {
128 HighLatencyTest(GetParam()); 129 HighLatencyTest(GetParam());
129 } 130 }
130 131
131 TEST_P(MultiChannelResamplerTest, LowLatency) { 132 TEST_P(MultiChannelResamplerTest, LowLatency) {
132 LowLatencyTest(GetParam()); 133 LowLatencyTest(GetParam());
133 } 134 }
134 135
135 // Test common channel layouts: mono, stereo, 5.1, 7.1. 136 // Test common channel layouts: mono, stereo, 5.1, 7.1.
136 INSTANTIATE_TEST_CASE_P( 137 INSTANTIATE_TEST_CASE_P(
137 MultiChannelResamplerTest, MultiChannelResamplerTest, 138 MultiChannelResamplerTest, MultiChannelResamplerTest,
138 testing::Values(1, 2, 6, 8)); 139 testing::Values(1, 2, 6, 8));
139 140
140 } // namespace media 141 } // namespace media
OLDNEW
« no previous file with comments | « media/base/multi_channel_resampler.h ('k') | media/base/null_video_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698