| 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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "media/audio/android/audio_manager_android.h" | 9 #include "media/audio/android/audio_manager_android.h" |
| 10 | 10 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 void OpenSLESOutputStream::FillBufferQueueNoLock() { | 319 void OpenSLESOutputStream::FillBufferQueueNoLock() { |
| 320 // Ensure that the calling thread has acquired the lock since it is not | 320 // Ensure that the calling thread has acquired the lock since it is not |
| 321 // done in this method. | 321 // done in this method. |
| 322 lock_.AssertAcquired(); | 322 lock_.AssertAcquired(); |
| 323 | 323 |
| 324 // Read data from the registered client source. | 324 // Read data from the registered client source. |
| 325 // TODO(henrika): Investigate if it is possible to get a more accurate | 325 // TODO(henrika): Investigate if it is possible to get a more accurate |
| 326 // delay estimation. | 326 // delay estimation. |
| 327 const uint32 hardware_delay = buffer_size_bytes_; | 327 const uint32 hardware_delay = buffer_size_bytes_; |
| 328 int frames_filled = callback_->OnMoreData( | 328 int frames_filled = callback_->OnMoreData( |
| 329 audio_bus_.get(), hardware_delay); | 329 audio_bus_.get(), AudioBuffersState(0, hardware_delay)); |
| 330 if (frames_filled <= 0) { | 330 if (frames_filled <= 0) { |
| 331 // Audio source is shutting down, or halted on error. | 331 // Audio source is shutting down, or halted on error. |
| 332 return; | 332 return; |
| 333 } | 333 } |
| 334 | 334 |
| 335 // Note: If the internal representation ever changes from 16-bit PCM to | 335 // Note: If the internal representation ever changes from 16-bit PCM to |
| 336 // raw float, the data must be clipped and sanitized since it may come | 336 // raw float, the data must be clipped and sanitized since it may come |
| 337 // from an untrusted source such as NaCl. | 337 // from an untrusted source such as NaCl. |
| 338 audio_bus_->Scale(muted_ ? 0.0f : volume_); | 338 audio_bus_->Scale(muted_ ? 0.0f : volume_); |
| 339 audio_bus_->ToInterleaved(frames_filled, | 339 audio_bus_->ToInterleaved(frames_filled, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 373 } |
| 374 } | 374 } |
| 375 | 375 |
| 376 void OpenSLESOutputStream::HandleError(SLresult error) { | 376 void OpenSLESOutputStream::HandleError(SLresult error) { |
| 377 DLOG(ERROR) << "OpenSLES Output error " << error; | 377 DLOG(ERROR) << "OpenSLES Output error " << error; |
| 378 if (callback_) | 378 if (callback_) |
| 379 callback_->OnError(this); | 379 callback_->OnError(this); |
| 380 } | 380 } |
| 381 | 381 |
| 382 } // namespace media | 382 } // namespace media |
| OLD | NEW |