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

Side by Side Diff: webrtc/common_audio/resampler/include/push_resampler.h

Issue 1726043002: Revert of Replace scoped_ptr with unique_ptr in webrtc/common_audio/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 #ifndef WEBRTC_COMMON_AUDIO_RESAMPLER_INCLUDE_PUSH_RESAMPLER_H_ 11 #ifndef WEBRTC_COMMON_AUDIO_RESAMPLER_INCLUDE_PUSH_RESAMPLER_H_
12 #define WEBRTC_COMMON_AUDIO_RESAMPLER_INCLUDE_PUSH_RESAMPLER_H_ 12 #define WEBRTC_COMMON_AUDIO_RESAMPLER_INCLUDE_PUSH_RESAMPLER_H_
13 13
14 #include <memory> 14 #include "webrtc/base/scoped_ptr.h"
15
16 #include "webrtc/typedefs.h" 15 #include "webrtc/typedefs.h"
17 16
18 namespace webrtc { 17 namespace webrtc {
19 18
20 class PushSincResampler; 19 class PushSincResampler;
21 20
22 // Wraps PushSincResampler to provide stereo support. 21 // Wraps PushSincResampler to provide stereo support.
23 // TODO(ajm): add support for an arbitrary number of channels. 22 // TODO(ajm): add support for an arbitrary number of channels.
24 template <typename T> 23 template <typename T>
25 class PushResampler { 24 class PushResampler {
26 public: 25 public:
27 PushResampler(); 26 PushResampler();
28 virtual ~PushResampler(); 27 virtual ~PushResampler();
29 28
30 // Must be called whenever the parameters change. Free to be called at any 29 // Must be called whenever the parameters change. Free to be called at any
31 // time as it is a no-op if parameters have not changed since the last call. 30 // time as it is a no-op if parameters have not changed since the last call.
32 int InitializeIfNeeded(int src_sample_rate_hz, int dst_sample_rate_hz, 31 int InitializeIfNeeded(int src_sample_rate_hz, int dst_sample_rate_hz,
33 size_t num_channels); 32 size_t num_channels);
34 33
35 // Returns the total number of samples provided in destination (e.g. 32 kHz, 34 // Returns the total number of samples provided in destination (e.g. 32 kHz,
36 // 2 channel audio gives 640 samples). 35 // 2 channel audio gives 640 samples).
37 int Resample(const T* src, size_t src_length, T* dst, size_t dst_capacity); 36 int Resample(const T* src, size_t src_length, T* dst, size_t dst_capacity);
38 37
39 private: 38 private:
40 std::unique_ptr<PushSincResampler> sinc_resampler_; 39 rtc::scoped_ptr<PushSincResampler> sinc_resampler_;
41 std::unique_ptr<PushSincResampler> sinc_resampler_right_; 40 rtc::scoped_ptr<PushSincResampler> sinc_resampler_right_;
42 int src_sample_rate_hz_; 41 int src_sample_rate_hz_;
43 int dst_sample_rate_hz_; 42 int dst_sample_rate_hz_;
44 size_t num_channels_; 43 size_t num_channels_;
45 std::unique_ptr<T[]> src_left_; 44 rtc::scoped_ptr<T[]> src_left_;
46 std::unique_ptr<T[]> src_right_; 45 rtc::scoped_ptr<T[]> src_right_;
47 std::unique_ptr<T[]> dst_left_; 46 rtc::scoped_ptr<T[]> dst_left_;
48 std::unique_ptr<T[]> dst_right_; 47 rtc::scoped_ptr<T[]> dst_right_;
49 }; 48 };
50 49
51 } // namespace webrtc 50 } // namespace webrtc
52 51
53 #endif // WEBRTC_COMMON_AUDIO_RESAMPLER_INCLUDE_PUSH_RESAMPLER_H_ 52 #endif // WEBRTC_COMMON_AUDIO_RESAMPLER_INCLUDE_PUSH_RESAMPLER_H_
OLDNEW
« no previous file with comments | « webrtc/common_audio/real_fourier_unittest.cc ('k') | webrtc/common_audio/resampler/push_sinc_resampler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698