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