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_output.h" | 5 #include "media/audio/android/opensles_output.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/audio/audio_util.h" | 8 #include "media/audio/audio_util.h" |
9 #include "media/audio/android/audio_manager_android.h" | 9 #include "media/audio/android/audio_manager_android.h" |
10 | 10 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 245 } |
246 | 246 |
247 void OpenSLESOutputStream::FillBufferQueue() { | 247 void OpenSLESOutputStream::FillBufferQueue() { |
248 if (!started_) | 248 if (!started_) |
249 return; | 249 return; |
250 | 250 |
251 // Read data from the registered client source. | 251 // Read data from the registered client source. |
252 // TODO(xians): Get an accurate delay estimation. | 252 // TODO(xians): Get an accurate delay estimation. |
253 uint32 hardware_delay = buffer_size_bytes_; | 253 uint32 hardware_delay = buffer_size_bytes_; |
254 size_t num_filled_bytes = callback_->OnMoreData( | 254 size_t num_filled_bytes = callback_->OnMoreData( |
255 this, | |
256 audio_data_[active_queue_], | 255 audio_data_[active_queue_], |
257 buffer_size_bytes_, | 256 buffer_size_bytes_, |
258 AudioBuffersState(0, hardware_delay)); | 257 AudioBuffersState(0, hardware_delay)); |
259 DCHECK(num_filled_bytes <= buffer_size_bytes_); | 258 DCHECK(num_filled_bytes <= buffer_size_bytes_); |
260 | 259 |
261 // Perform in-place, software-volume adjustments. | 260 // Perform in-place, software-volume adjustments. |
262 media::AdjustVolume(audio_data_[active_queue_], | 261 media::AdjustVolume(audio_data_[active_queue_], |
263 num_filled_bytes, | 262 num_filled_bytes, |
264 format_.numChannels, | 263 format_.numChannels, |
265 format_.containerSize >> 3, | 264 format_.containerSize >> 3, |
(...skipping 26 matching lines...) Expand all Loading... |
292 } | 291 } |
293 } | 292 } |
294 | 293 |
295 void OpenSLESOutputStream::HandleError(SLresult error) { | 294 void OpenSLESOutputStream::HandleError(SLresult error) { |
296 DLOG(FATAL) << "OpenSLES error " << error; | 295 DLOG(FATAL) << "OpenSLES error " << error; |
297 if (callback_) | 296 if (callback_) |
298 callback_->OnError(this, error); | 297 callback_->OnError(this, error); |
299 } | 298 } |
300 | 299 |
301 } // namespace media | 300 } // namespace media |
OLD | NEW |