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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 // TODO(dalecurtis): Return the correct volume here. | 385 // TODO(dalecurtis): Return the correct volume here. |
387 return frames > 0 ? 1 : 0; | 386 return frames > 0 ? 1 : 0; |
388 } | 387 } |
389 | 388 |
390 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { | 389 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { |
391 base::AutoLock auto_lock(source_lock_); | 390 base::AutoLock auto_lock(source_lock_); |
392 if (source_callback_) | 391 if (source_callback_) |
393 source_callback_->OnError(stream); | 392 source_callback_->OnError(stream); |
394 } | 393 } |
395 | 394 |
396 void OnMoreDataConverter::WaitTillDataReady() { | |
397 base::AutoLock auto_lock(source_lock_); | |
398 if (source_callback_) | |
399 source_callback_->WaitTillDataReady(); | |
400 } | |
401 | |
402 } // namespace media | 395 } // namespace media |
OLD | NEW |