OLD | NEW |
---|---|
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/audio/android/opensles_input.h" | 5 #include "media/audio/android/opensles_input.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | |
7 #include "base/logging.h" | 8 #include "base/logging.h" |
8 #include "media/audio/android/audio_manager_android.h" | 9 #include "media/audio/android/audio_manager_android.h" |
9 | 10 |
10 #define LOG_ON_FAILURE_AND_RETURN(op, ...) \ | 11 #define LOG_ON_FAILURE_AND_RETURN(op, ...) \ |
11 do { \ | 12 do { \ |
12 SLresult err = (op); \ | 13 SLresult err = (op); \ |
13 if (err != SL_RESULT_SUCCESS) { \ | 14 if (err != SL_RESULT_SUCCESS) { \ |
14 DLOG(ERROR) << #op << " failed: " << err; \ | 15 DLOG(ERROR) << #op << " failed: " << err; \ |
15 return __VA_ARGS__; \ | 16 return __VA_ARGS__; \ |
16 } \ | 17 } \ |
17 } while (0) | 18 } while (0) |
18 | 19 |
19 namespace media { | 20 namespace media { |
20 | 21 |
21 OpenSLESInputStream::OpenSLESInputStream(AudioManagerAndroid* audio_manager, | 22 OpenSLESInputStream::OpenSLESInputStream(AudioManagerAndroid* audio_manager, |
22 const AudioParameters& params) | 23 const AudioParameters& params) |
23 : audio_manager_(audio_manager), | 24 : audio_manager_(audio_manager), |
24 callback_(NULL), | 25 callback_(NULL), |
25 recorder_(NULL), | 26 recorder_(NULL), |
26 simple_buffer_queue_(NULL), | 27 simple_buffer_queue_(NULL), |
27 active_queue_(0), | 28 active_buffer_(0), |
28 buffer_size_bytes_(0), | 29 buffer_size_bytes_(0), |
29 started_(false) { | 30 started_(false) { |
31 DVLOG(2) << "OpenSLESInputStream::OpenSLESInputStream()"; | |
30 format_.formatType = SL_DATAFORMAT_PCM; | 32 format_.formatType = SL_DATAFORMAT_PCM; |
31 format_.numChannels = static_cast<SLuint32>(params.channels()); | 33 format_.numChannels = static_cast<SLuint32>(params.channels()); |
32 // Provides sampling rate in milliHertz to OpenSLES. | 34 // Provides sampling rate in milliHertz to OpenSLES. |
33 format_.samplesPerSec = static_cast<SLuint32>(params.sample_rate() * 1000); | 35 format_.samplesPerSec = static_cast<SLuint32>(params.sample_rate() * 1000); |
34 format_.bitsPerSample = params.bits_per_sample(); | 36 format_.bitsPerSample = params.bits_per_sample(); |
35 format_.containerSize = params.bits_per_sample(); | 37 format_.containerSize = params.bits_per_sample(); |
36 format_.endianness = SL_BYTEORDER_LITTLEENDIAN; | 38 format_.endianness = SL_BYTEORDER_LITTLEENDIAN; |
37 if (format_.numChannels == 1) | 39 if (format_.numChannels == 1) |
38 format_.channelMask = SL_SPEAKER_FRONT_CENTER; | 40 format_.channelMask = SL_SPEAKER_FRONT_CENTER; |
39 else if (format_.numChannels == 2) | 41 else if (format_.numChannels == 2) |
40 format_.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT; | 42 format_.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT; |
41 else | 43 else |
42 NOTREACHED() << "Unsupported number of channels: " << format_.numChannels; | 44 NOTREACHED() << "Unsupported number of channels: " << format_.numChannels; |
43 | 45 |
44 buffer_size_bytes_ = params.GetBytesPerBuffer(); | 46 buffer_size_bytes_ = params.GetBytesPerBuffer(); |
45 | 47 |
46 memset(&audio_data_, 0, sizeof(audio_data_)); | 48 memset(&audio_data_, 0, sizeof(audio_data_)); |
47 } | 49 } |
48 | 50 |
49 OpenSLESInputStream::~OpenSLESInputStream() { | 51 OpenSLESInputStream::~OpenSLESInputStream() { |
52 DVLOG(2) << "OpenSLESInputStream::~OpenSLESInputStream()"; | |
53 DCHECK(thread_checker_.CalledOnValidThread()); | |
50 DCHECK(!recorder_object_.Get()); | 54 DCHECK(!recorder_object_.Get()); |
51 DCHECK(!engine_object_.Get()); | 55 DCHECK(!engine_object_.Get()); |
52 DCHECK(!recorder_); | 56 DCHECK(!recorder_); |
53 DCHECK(!simple_buffer_queue_); | 57 DCHECK(!simple_buffer_queue_); |
54 DCHECK(!audio_data_[0]); | 58 DCHECK(!audio_data_[0]); |
55 } | 59 } |
56 | 60 |
57 bool OpenSLESInputStream::Open() { | 61 bool OpenSLESInputStream::Open() { |
62 DVLOG(2) << "OpenSLESInputStream::Open()"; | |
63 DCHECK(thread_checker_.CalledOnValidThread()); | |
58 if (engine_object_.Get()) | 64 if (engine_object_.Get()) |
59 return false; | 65 return false; |
60 | 66 |
61 if (!CreateRecorder()) | 67 if (!CreateRecorder()) |
62 return false; | 68 return false; |
63 | 69 |
64 SetupAudioBuffer(); | 70 SetupAudioBuffer(); |
71 active_buffer_ = 0; | |
65 | 72 |
66 return true; | 73 return true; |
67 } | 74 } |
68 | 75 |
69 void OpenSLESInputStream::Start(AudioInputCallback* callback) { | 76 void OpenSLESInputStream::Start(AudioInputCallback* callback) { |
77 DVLOG(2) << "OpenSLESInputStream::Start()"; | |
78 DCHECK(thread_checker_.CalledOnValidThread()); | |
70 DCHECK(callback); | 79 DCHECK(callback); |
71 DCHECK(recorder_); | 80 DCHECK(recorder_); |
72 DCHECK(simple_buffer_queue_); | 81 DCHECK(simple_buffer_queue_); |
73 if (started_) | 82 if (started_) |
74 return; | 83 return; |
75 | 84 |
76 // Enable the flags before streaming. | 85 base::AutoLock lock(lock_); |
86 DCHECK(callback_ == NULL || callback_ == callback); | |
77 callback_ = callback; | 87 callback_ = callback; |
78 active_queue_ = 0; | |
79 started_ = true; | |
80 | 88 |
81 SLresult err = SL_RESULT_UNKNOWN_ERROR; | 89 // Check queue state and derive the number of free buffers in the queue. |
82 // Enqueues |kNumOfQueuesInBuffer| zero buffers to get the ball rolling. | 90 SLAndroidSimpleBufferQueueState buffer_queue_state; |
83 for (int i = 0; i < kNumOfQueuesInBuffer; ++i) { | 91 SLresult err = (*simple_buffer_queue_)->GetState(simple_buffer_queue_, |
92 &buffer_queue_state); | |
93 if (SL_RESULT_SUCCESS != err) { | |
94 HandleError(err); | |
95 return; | |
96 } | |
97 int num_free_buffers = kMaxNumOfBuffersInQueue - buffer_queue_state.count; | |
98 DCHECK(num_free_buffers == kMaxNumOfBuffersInQueue || num_free_buffers == 0); | |
99 | |
100 // Enqueues |num_free_buffers| zero buffers to get the ball rolling. | |
101 // |num_free_buffers| can be zero if Stop() has been called followed by a | |
102 // new call to Start(). We do clear the queue in Stop, and the buffer state | |
103 // should then be cleared, but for some reason it is not. Using this | |
104 // approach enables call sequences like: Start(), Stop(), Start(), even if | |
105 // there might be some old data remaining at the second call to Start(). | |
106 for (int i = 0; i < num_free_buffers; ++i) { | |
84 err = (*simple_buffer_queue_)->Enqueue( | 107 err = (*simple_buffer_queue_)->Enqueue( |
85 simple_buffer_queue_, | 108 simple_buffer_queue_, |
86 audio_data_[i], | 109 audio_data_[i], |
87 buffer_size_bytes_); | 110 buffer_size_bytes_); |
88 if (SL_RESULT_SUCCESS != err) { | 111 if (SL_RESULT_SUCCESS != err) { |
89 HandleError(err); | 112 HandleError(err); |
90 return; | 113 return; |
91 } | 114 } |
92 } | 115 } |
93 | 116 |
94 // Start the recording by setting the state to |SL_RECORDSTATE_RECORDING|. | 117 // Start the recording by setting the state to SL_RECORDSTATE_RECORDING. |
118 // When the object is in the SL_RECORDSTATE_RECORDING state, adding buffers | |
119 // will implicitly start the filling process. | |
95 err = (*recorder_)->SetRecordState(recorder_, SL_RECORDSTATE_RECORDING); | 120 err = (*recorder_)->SetRecordState(recorder_, SL_RECORDSTATE_RECORDING); |
96 if (SL_RESULT_SUCCESS != err) | 121 if (SL_RESULT_SUCCESS != err) { |
97 HandleError(err); | 122 HandleError(err); |
123 return; | |
124 } | |
125 | |
126 started_ = true; | |
98 } | 127 } |
99 | 128 |
100 void OpenSLESInputStream::Stop() { | 129 void OpenSLESInputStream::Stop() { |
130 DVLOG(2) << "OpenSLESInputStream::Stop()"; | |
131 DCHECK(thread_checker_.CalledOnValidThread()); | |
101 if (!started_) | 132 if (!started_) |
102 return; | 133 return; |
103 | 134 |
104 // Stop recording by setting the record state to |SL_RECORDSTATE_STOPPED|. | 135 base::AutoLock lock(lock_); |
136 | |
137 // Stop recording by setting the record state to SL_RECORDSTATE_STOPPED. | |
105 LOG_ON_FAILURE_AND_RETURN( | 138 LOG_ON_FAILURE_AND_RETURN( |
106 (*recorder_)->SetRecordState(recorder_, | 139 (*recorder_)->SetRecordState(recorder_, |
107 SL_RECORDSTATE_STOPPED)); | 140 SL_RECORDSTATE_STOPPED)); |
108 | 141 |
109 // Clear the buffer queue to get rid of old data when resuming recording. | 142 // Clear the buffer queue to get rid of old data when resuming recording. |
110 LOG_ON_FAILURE_AND_RETURN( | 143 LOG_ON_FAILURE_AND_RETURN( |
111 (*simple_buffer_queue_)->Clear(simple_buffer_queue_)); | 144 (*simple_buffer_queue_)->Clear(simple_buffer_queue_)); |
112 | 145 |
113 started_ = false; | 146 started_ = false; |
114 } | 147 } |
115 | 148 |
116 void OpenSLESInputStream::Close() { | 149 void OpenSLESInputStream::Close() { |
150 DVLOG(2) << "OpenSLESInputStream::Close()"; | |
151 DCHECK(thread_checker_.CalledOnValidThread()); | |
152 | |
117 // Stop the stream if it is still recording. | 153 // Stop the stream if it is still recording. |
118 Stop(); | 154 Stop(); |
155 { | |
156 base::AutoLock lock(lock_); | |
119 | 157 |
120 // Explicitly free the player objects and invalidate their associated | 158 if (callback_) { |
121 // interfaces. They have to be done in the correct order. | 159 callback_->OnClose(this); |
122 recorder_object_.Reset(); | 160 callback_ = NULL; |
123 engine_object_.Reset(); | 161 } |
124 simple_buffer_queue_ = NULL; | |
125 recorder_ = NULL; | |
126 | 162 |
127 ReleaseAudioBuffer(); | 163 // Destroy the buffer queue recorder object and invalidate all associated |
164 // interfaces. | |
165 recorder_object_.Reset(); | |
166 simple_buffer_queue_ = NULL; | |
167 recorder_ = NULL; | |
168 | |
169 // Destroy the engine object. We don't store any associated interface for | |
170 // this object. | |
171 engine_object_.Reset(); | |
172 ReleaseAudioBuffer(); | |
173 } | |
128 | 174 |
129 audio_manager_->ReleaseInputStream(this); | 175 audio_manager_->ReleaseInputStream(this); |
130 } | 176 } |
131 | 177 |
132 double OpenSLESInputStream::GetMaxVolume() { | 178 double OpenSLESInputStream::GetMaxVolume() { |
133 NOTIMPLEMENTED(); | 179 NOTIMPLEMENTED(); |
134 return 0.0; | 180 return 0.0; |
135 } | 181 } |
136 | 182 |
137 void OpenSLESInputStream::SetVolume(double volume) { | 183 void OpenSLESInputStream::SetVolume(double volume) { |
138 NOTIMPLEMENTED(); | 184 NOTIMPLEMENTED(); |
139 } | 185 } |
140 | 186 |
141 double OpenSLESInputStream::GetVolume() { | 187 double OpenSLESInputStream::GetVolume() { |
142 NOTIMPLEMENTED(); | 188 NOTIMPLEMENTED(); |
143 return 0.0; | 189 return 0.0; |
144 } | 190 } |
145 | 191 |
146 void OpenSLESInputStream::SetAutomaticGainControl(bool enabled) { | 192 void OpenSLESInputStream::SetAutomaticGainControl(bool enabled) { |
147 NOTIMPLEMENTED(); | 193 NOTIMPLEMENTED(); |
148 } | 194 } |
149 | 195 |
150 bool OpenSLESInputStream::GetAutomaticGainControl() { | 196 bool OpenSLESInputStream::GetAutomaticGainControl() { |
151 NOTIMPLEMENTED(); | 197 NOTIMPLEMENTED(); |
152 return false; | 198 return false; |
153 } | 199 } |
154 | 200 |
155 bool OpenSLESInputStream::CreateRecorder() { | 201 bool OpenSLESInputStream::CreateRecorder() { |
202 DCHECK(thread_checker_.CalledOnValidThread()); | |
203 DCHECK(!engine_object_.Get()); | |
204 DCHECK(!recorder_object_.Get()); | |
205 DCHECK(!recorder_); | |
206 DCHECK(!simple_buffer_queue_); | |
207 | |
156 // Initializes the engine object with specific option. After working with the | 208 // Initializes the engine object with specific option. After working with the |
157 // object, we need to free the object and its resources. | 209 // object, we need to free the object and its resources. |
158 SLEngineOption option[] = { | 210 SLEngineOption option[] = { |
159 { SL_ENGINEOPTION_THREADSAFE, static_cast<SLuint32>(SL_BOOLEAN_TRUE) } | 211 { SL_ENGINEOPTION_THREADSAFE, static_cast<SLuint32>(SL_BOOLEAN_TRUE) } |
160 }; | 212 }; |
161 LOG_ON_FAILURE_AND_RETURN(slCreateEngine(engine_object_.Receive(), | 213 LOG_ON_FAILURE_AND_RETURN(slCreateEngine(engine_object_.Receive(), |
162 1, | 214 1, |
163 option, | 215 option, |
164 0, | 216 0, |
165 NULL, | 217 NULL, |
(...skipping 15 matching lines...) Expand all Loading... | |
181 // Audio source configuration. | 233 // Audio source configuration. |
182 SLDataLocator_IODevice mic_locator = { | 234 SLDataLocator_IODevice mic_locator = { |
183 SL_DATALOCATOR_IODEVICE, SL_IODEVICE_AUDIOINPUT, | 235 SL_DATALOCATOR_IODEVICE, SL_IODEVICE_AUDIOINPUT, |
184 SL_DEFAULTDEVICEID_AUDIOINPUT, NULL | 236 SL_DEFAULTDEVICEID_AUDIOINPUT, NULL |
185 }; | 237 }; |
186 SLDataSource audio_source = { &mic_locator, NULL }; | 238 SLDataSource audio_source = { &mic_locator, NULL }; |
187 | 239 |
188 // Audio sink configuration. | 240 // Audio sink configuration. |
189 SLDataLocator_AndroidSimpleBufferQueue buffer_queue = { | 241 SLDataLocator_AndroidSimpleBufferQueue buffer_queue = { |
190 SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, // Locator type. | 242 SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, // Locator type. |
191 static_cast<SLuint32>(kNumOfQueuesInBuffer) // Number of buffers. | 243 static_cast<SLuint32>(kMaxNumOfBuffersInQueue) // Number of buffers. |
tommi (sloooow) - chröme
2013/09/03 12:15:09
nit: comment not necessary
henrika (OOO until Aug 14)
2013/09/03 12:48:32
Done.
| |
192 }; | 244 }; |
193 SLDataSink audio_sink = { &buffer_queue, &format_ }; | 245 SLDataSink audio_sink = { &buffer_queue, &format_ }; |
194 | 246 |
195 // Create an audio recorder. | 247 // Create an audio recorder. |
196 const SLInterfaceID interface_id[] = { | 248 const SLInterfaceID interface_id[] = { |
197 SL_IID_ANDROIDSIMPLEBUFFERQUEUE, | 249 SL_IID_ANDROIDSIMPLEBUFFERQUEUE, |
198 SL_IID_ANDROIDCONFIGURATION | 250 SL_IID_ANDROIDCONFIGURATION |
199 }; | 251 }; |
200 const SLboolean interface_required[] = { | 252 const SLboolean interface_required[] = { |
201 SL_BOOLEAN_TRUE, | 253 SL_BOOLEAN_TRUE, |
202 SL_BOOLEAN_TRUE | 254 SL_BOOLEAN_TRUE |
203 }; | 255 }; |
256 | |
204 // Create AudioRecorder and specify SL_IID_ANDROIDCONFIGURATION. | 257 // Create AudioRecorder and specify SL_IID_ANDROIDCONFIGURATION. |
205 LOG_ON_FAILURE_AND_RETURN( | 258 LOG_ON_FAILURE_AND_RETURN( |
206 (*engine)->CreateAudioRecorder(engine, | 259 (*engine)->CreateAudioRecorder(engine, |
207 recorder_object_.Receive(), | 260 recorder_object_.Receive(), |
208 &audio_source, | 261 &audio_source, |
209 &audio_sink, | 262 &audio_sink, |
210 arraysize(interface_id), | 263 arraysize(interface_id), |
211 interface_id, | 264 interface_id, |
212 interface_required), | 265 interface_required), |
213 false); | 266 false); |
214 | 267 |
215 SLAndroidConfigurationItf recorder_config; | 268 SLAndroidConfigurationItf recorder_config; |
216 LOG_ON_FAILURE_AND_RETURN( | 269 LOG_ON_FAILURE_AND_RETURN( |
217 recorder_object_->GetInterface(recorder_object_.Get(), | 270 recorder_object_->GetInterface(recorder_object_.Get(), |
218 SL_IID_ANDROIDCONFIGURATION, | 271 SL_IID_ANDROIDCONFIGURATION, |
219 &recorder_config), | 272 &recorder_config), |
220 false); | 273 false); |
221 | 274 |
275 // Uses the main microphone tuned for audio communications. | |
222 SLint32 stream_type = SL_ANDROID_RECORDING_PRESET_VOICE_COMMUNICATION; | 276 SLint32 stream_type = SL_ANDROID_RECORDING_PRESET_VOICE_COMMUNICATION; |
223 LOG_ON_FAILURE_AND_RETURN( | 277 LOG_ON_FAILURE_AND_RETURN( |
224 (*recorder_config)->SetConfiguration(recorder_config, | 278 (*recorder_config)->SetConfiguration(recorder_config, |
225 SL_ANDROID_KEY_RECORDING_PRESET, | 279 SL_ANDROID_KEY_RECORDING_PRESET, |
226 &stream_type, sizeof(SLint32)), | 280 &stream_type, sizeof(SLint32)), |
227 false); | 281 false); |
228 | 282 |
229 // Realize the recorder object in synchronous mode. | 283 // Realize the recorder object in synchronous mode. |
230 LOG_ON_FAILURE_AND_RETURN( | 284 LOG_ON_FAILURE_AND_RETURN( |
231 recorder_object_->Realize(recorder_object_.Get(), | 285 recorder_object_->Realize(recorder_object_.Get(), |
(...skipping 26 matching lines...) Expand all Loading... | |
258 } | 312 } |
259 | 313 |
260 void OpenSLESInputStream::SimpleBufferQueueCallback( | 314 void OpenSLESInputStream::SimpleBufferQueueCallback( |
261 SLAndroidSimpleBufferQueueItf buffer_queue, void* instance) { | 315 SLAndroidSimpleBufferQueueItf buffer_queue, void* instance) { |
262 OpenSLESInputStream* stream = | 316 OpenSLESInputStream* stream = |
263 reinterpret_cast<OpenSLESInputStream*>(instance); | 317 reinterpret_cast<OpenSLESInputStream*>(instance); |
264 stream->ReadBufferQueue(); | 318 stream->ReadBufferQueue(); |
265 } | 319 } |
266 | 320 |
267 void OpenSLESInputStream::ReadBufferQueue() { | 321 void OpenSLESInputStream::ReadBufferQueue() { |
268 if (!started_) | 322 base::AutoLock lock(lock_); |
323 if (!recorder_) | |
269 return; | 324 return; |
270 | 325 |
271 // TODO(xians): Get an accurate delay estimation. | 326 TRACE_EVENT0("audio", "OpenSLESOutputStream::ReadBufferQueue"); |
327 | |
328 // Verify that we are in a recording state. | |
329 SLuint32 state; | |
330 SLresult err = (*recorder_)->GetRecordState(recorder_, &state); | |
331 if (SL_RESULT_SUCCESS != err) { | |
332 HandleError(err); | |
333 return; | |
334 } | |
335 if (state != SL_RECORDSTATE_RECORDING) { | |
336 DLOG(WARNING) << "Received callback in non-recording state"; | |
337 return; | |
338 } | |
339 | |
340 // TODO(henrika): Investigate if it is possible to get an accurate | |
341 // delay estimation. | |
272 callback_->OnData(this, | 342 callback_->OnData(this, |
273 audio_data_[active_queue_], | 343 audio_data_[active_buffer_], |
274 buffer_size_bytes_, | 344 buffer_size_bytes_, |
275 buffer_size_bytes_, | 345 buffer_size_bytes_, |
276 0.0); | 346 0.0); |
277 | 347 |
278 // Done with this buffer. Send it to device for recording. | 348 // Done with this buffer. Send it to device for recording. |
279 SLresult err = (*simple_buffer_queue_)->Enqueue( | 349 err = (*simple_buffer_queue_)->Enqueue( |
280 simple_buffer_queue_, | 350 simple_buffer_queue_, |
281 audio_data_[active_queue_], | 351 audio_data_[active_buffer_], |
282 buffer_size_bytes_); | 352 buffer_size_bytes_); |
283 if (SL_RESULT_SUCCESS != err) | 353 if (SL_RESULT_SUCCESS != err) |
284 HandleError(err); | 354 HandleError(err); |
285 | 355 |
286 active_queue_ = (active_queue_ + 1) % kNumOfQueuesInBuffer; | 356 active_buffer_ = (active_buffer_ + 1) % kMaxNumOfBuffersInQueue; |
287 } | 357 } |
288 | 358 |
289 void OpenSLESInputStream::SetupAudioBuffer() { | 359 void OpenSLESInputStream::SetupAudioBuffer() { |
360 DCHECK(thread_checker_.CalledOnValidThread()); | |
290 DCHECK(!audio_data_[0]); | 361 DCHECK(!audio_data_[0]); |
291 for (int i = 0; i < kNumOfQueuesInBuffer; ++i) { | 362 for (int i = 0; i < kMaxNumOfBuffersInQueue; ++i) { |
292 audio_data_[i] = new uint8[buffer_size_bytes_]; | 363 audio_data_[i] = new uint8[buffer_size_bytes_]; |
293 } | 364 } |
294 } | 365 } |
295 | 366 |
296 void OpenSLESInputStream::ReleaseAudioBuffer() { | 367 void OpenSLESInputStream::ReleaseAudioBuffer() { |
368 DCHECK(thread_checker_.CalledOnValidThread()); | |
297 if (audio_data_[0]) { | 369 if (audio_data_[0]) { |
298 for (int i = 0; i < kNumOfQueuesInBuffer; ++i) { | 370 for (int i = 0; i < kMaxNumOfBuffersInQueue; ++i) { |
299 delete [] audio_data_[i]; | 371 delete [] audio_data_[i]; |
300 audio_data_[i] = NULL; | 372 audio_data_[i] = NULL; |
301 } | 373 } |
302 } | 374 } |
303 } | 375 } |
304 | 376 |
305 void OpenSLESInputStream::HandleError(SLresult error) { | 377 void OpenSLESInputStream::HandleError(SLresult error) { |
306 DLOG(FATAL) << "OpenSLES Input error " << error; | 378 DLOG(ERROR) << "OpenSLES Input error " << error; |
307 if (callback_) | 379 if (callback_) |
308 callback_->OnError(this); | 380 callback_->OnError(this); |
309 } | 381 } |
310 | 382 |
311 } // namespace media | 383 } // namespace media |
OLD | NEW |