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

Side by Side Diff: webrtc/modules/audio_device/android/opensles_player.h

Issue 1722083002: Replace scoped_ptr with unique_ptr in webrtc/modules/audio_device/ (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) 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 #ifndef WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_PLAYER_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_PLAYER_H_
12 #define WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_PLAYER_H_ 12 #define WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_PLAYER_H_
13 13
14 #include <memory>
15
14 #include <SLES/OpenSLES.h> 16 #include <SLES/OpenSLES.h>
15 #include <SLES/OpenSLES_Android.h> 17 #include <SLES/OpenSLES_Android.h>
16 #include <SLES/OpenSLES_AndroidConfiguration.h> 18 #include <SLES/OpenSLES_AndroidConfiguration.h>
17 19
18 #include "webrtc/base/scoped_ptr.h"
19 #include "webrtc/base/thread_checker.h" 20 #include "webrtc/base/thread_checker.h"
20 #include "webrtc/modules/audio_device/android/audio_common.h" 21 #include "webrtc/modules/audio_device/android/audio_common.h"
21 #include "webrtc/modules/audio_device/android/audio_manager.h" 22 #include "webrtc/modules/audio_device/android/audio_manager.h"
22 #include "webrtc/modules/audio_device/android/opensles_common.h" 23 #include "webrtc/modules/audio_device/android/opensles_common.h"
23 #include "webrtc/modules/audio_device/include/audio_device_defines.h" 24 #include "webrtc/modules/audio_device/include/audio_device_defines.h"
24 #include "webrtc/modules/audio_device/audio_device_generic.h" 25 #include "webrtc/modules/audio_device/audio_device_generic.h"
25 #include "webrtc/modules/utility/include/helpers_android.h" 26 #include "webrtc/modules/utility/include/helpers_android.h"
26 27
27 namespace webrtc { 28 namespace webrtc {
28 29
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 SLDataFormat_PCM pcm_format_; 144 SLDataFormat_PCM pcm_format_;
144 145
145 // Number of bytes per audio buffer in each |audio_buffers_[i]|. 146 // Number of bytes per audio buffer in each |audio_buffers_[i]|.
146 // Typical sizes are 480 or 512 bytes corresponding to native output buffer 147 // Typical sizes are 480 or 512 bytes corresponding to native output buffer
147 // sizes of 240 or 256 audio frames respectively. 148 // sizes of 240 or 256 audio frames respectively.
148 size_t bytes_per_buffer_; 149 size_t bytes_per_buffer_;
149 150
150 // Queue of audio buffers to be used by the player object for rendering 151 // Queue of audio buffers to be used by the player object for rendering
151 // audio. They will be used in a Round-robin way and the size of each buffer 152 // audio. They will be used in a Round-robin way and the size of each buffer
152 // is given by FineAudioBuffer::RequiredBufferSizeBytes(). 153 // is given by FineAudioBuffer::RequiredBufferSizeBytes().
153 rtc::scoped_ptr<SLint8[]> audio_buffers_[kNumOfOpenSLESBuffers]; 154 std::unique_ptr<SLint8[]> audio_buffers_[kNumOfOpenSLESBuffers];
154 155
155 // FineAudioBuffer takes an AudioDeviceBuffer which delivers audio data 156 // FineAudioBuffer takes an AudioDeviceBuffer which delivers audio data
156 // in chunks of 10ms. It then allows for this data to be pulled in 157 // in chunks of 10ms. It then allows for this data to be pulled in
157 // a finer or coarser granularity. I.e. interacting with this class instead 158 // a finer or coarser granularity. I.e. interacting with this class instead
158 // of directly with the AudioDeviceBuffer one can ask for any number of 159 // of directly with the AudioDeviceBuffer one can ask for any number of
159 // audio data samples. 160 // audio data samples.
160 // Example: native buffer size is 240 audio frames at 48kHz sample rate. 161 // Example: native buffer size is 240 audio frames at 48kHz sample rate.
161 // WebRTC will provide 480 audio frames per 10ms but OpenSL ES asks for 240 162 // WebRTC will provide 480 audio frames per 10ms but OpenSL ES asks for 240
162 // in each callback (one every 5ms). This class can then ask for 240 and the 163 // in each callback (one every 5ms). This class can then ask for 240 and the
163 // FineAudioBuffer will ask WebRTC for new data only every second callback 164 // FineAudioBuffer will ask WebRTC for new data only every second callback
164 // and also cach non-utilized audio. 165 // and also cach non-utilized audio.
165 rtc::scoped_ptr<FineAudioBuffer> fine_buffer_; 166 std::unique_ptr<FineAudioBuffer> fine_buffer_;
166 167
167 // Keeps track of active audio buffer 'n' in the audio_buffers_[n] queue. 168 // Keeps track of active audio buffer 'n' in the audio_buffers_[n] queue.
168 // Example (kNumOfOpenSLESBuffers = 2): counts 0, 1, 0, 1, ... 169 // Example (kNumOfOpenSLESBuffers = 2): counts 0, 1, 0, 1, ...
169 int buffer_index_; 170 int buffer_index_;
170 171
171 // The engine object which provides the SLEngineItf interface. 172 // The engine object which provides the SLEngineItf interface.
172 // Created by the global Open SL ES constructor slCreateEngine(). 173 // Created by the global Open SL ES constructor slCreateEngine().
173 webrtc::ScopedSLObjectItf engine_object_; 174 webrtc::ScopedSLObjectItf engine_object_;
174 175
175 // This interface exposes creation methods for all the OpenSL ES object types. 176 // This interface exposes creation methods for all the OpenSL ES object types.
(...skipping 20 matching lines...) Expand all
196 // properties. This interface is supported on the Audio Player object. 197 // properties. This interface is supported on the Audio Player object.
197 SLVolumeItf volume_; 198 SLVolumeItf volume_;
198 199
199 // Last time the OpenSL ES layer asked for audio data to play out. 200 // Last time the OpenSL ES layer asked for audio data to play out.
200 uint32_t last_play_time_; 201 uint32_t last_play_time_;
201 }; 202 };
202 203
203 } // namespace webrtc 204 } // namespace webrtc
204 205
205 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_PLAYER_H_ 206 #endif // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_OPENSLES_PLAYER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/android/build_info.cc ('k') | webrtc/modules/audio_device/audio_device_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698