| 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/audio_output_resampler.h" | 5 #include "media/audio/audio_output_resampler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 const AudioParameters& output_params); | 29 const AudioParameters& output_params); |
| 30 virtual ~OnMoreDataConverter(); | 30 virtual ~OnMoreDataConverter(); |
| 31 | 31 |
| 32 // AudioSourceCallback interface. | 32 // AudioSourceCallback interface. |
| 33 virtual int OnMoreData(AudioBus* dest, | 33 virtual int OnMoreData(AudioBus* dest, |
| 34 AudioBuffersState buffers_state) OVERRIDE; | 34 AudioBuffersState buffers_state) OVERRIDE; |
| 35 virtual int OnMoreIOData(AudioBus* source, | 35 virtual int OnMoreIOData(AudioBus* source, |
| 36 AudioBus* dest, | 36 AudioBus* dest, |
| 37 AudioBuffersState buffers_state) OVERRIDE; | 37 AudioBuffersState buffers_state) OVERRIDE; |
| 38 virtual void OnError(AudioOutputStream* stream) OVERRIDE; | 38 virtual void OnError(AudioOutputStream* stream) OVERRIDE; |
| 39 virtual void WaitTillDataReady() OVERRIDE; | |
| 40 | 39 |
| 41 // Sets |source_callback_|. If this is not a new object, then Stop() must be | 40 // Sets |source_callback_|. If this is not a new object, then Stop() must be |
| 42 // called before Start(). | 41 // called before Start(). |
| 43 void Start(AudioOutputStream::AudioSourceCallback* callback); | 42 void Start(AudioOutputStream::AudioSourceCallback* callback); |
| 44 | 43 |
| 45 // Clears |source_callback_| and flushes the resampler. | 44 // Clears |source_callback_| and flushes the resampler. |
| 46 void Stop(); | 45 void Stop(); |
| 47 | 46 |
| 48 private: | 47 private: |
| 49 // AudioConverter::InputCallback implementation. | 48 // AudioConverter::InputCallback implementation. |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 // TODO(dalecurtis): Return the correct volume here. | 383 // TODO(dalecurtis): Return the correct volume here. |
| 385 return frames > 0 ? 1 : 0; | 384 return frames > 0 ? 1 : 0; |
| 386 } | 385 } |
| 387 | 386 |
| 388 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { | 387 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { |
| 389 base::AutoLock auto_lock(source_lock_); | 388 base::AutoLock auto_lock(source_lock_); |
| 390 if (source_callback_) | 389 if (source_callback_) |
| 391 source_callback_->OnError(stream); | 390 source_callback_->OnError(stream); |
| 392 } | 391 } |
| 393 | 392 |
| 394 void OnMoreDataConverter::WaitTillDataReady() { | |
| 395 base::AutoLock auto_lock(source_lock_); | |
| 396 if (source_callback_) | |
| 397 source_callback_->WaitTillDataReady(); | |
| 398 } | |
| 399 | |
| 400 } // namespace media | 393 } // namespace media |
| OLD | NEW |