OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/sounds/audio_stream_handler.h" | 5 #include "media/audio/sounds/audio_stream_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/cancelable_callback.h" | 9 #include "base/cancelable_callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 StopStream(); | 99 StopStream(); |
100 if (stream_) | 100 if (stream_) |
101 stream_->Close(); | 101 stream_->Close(); |
102 stream_ = NULL; | 102 stream_ = NULL; |
103 stop_closure_.Cancel(); | 103 stop_closure_.Cancel(); |
104 } | 104 } |
105 | 105 |
106 private: | 106 private: |
107 // AudioOutputStream::AudioSourceCallback overrides: | 107 // AudioOutputStream::AudioSourceCallback overrides: |
108 // Following methods could be called from *ANY* thread. | 108 // Following methods could be called from *ANY* thread. |
109 int OnMoreData(AudioBus* dest, uint32 /* total_bytes_delay */) override { | 109 int OnMoreData(AudioBus* dest, |
| 110 uint32_t /* total_bytes_delay */, |
| 111 uint32_t /* frames_skipped */) override { |
110 base::AutoLock al(state_lock_); | 112 base::AutoLock al(state_lock_); |
111 size_t bytes_written = 0; | 113 size_t bytes_written = 0; |
112 | 114 |
113 if (wav_audio_->AtEnd(cursor_) || | 115 if (wav_audio_->AtEnd(cursor_) || |
114 !wav_audio_->CopyTo(dest, cursor_, &bytes_written)) { | 116 !wav_audio_->CopyTo(dest, cursor_, &bytes_written)) { |
115 if (delayed_stop_posted_) | 117 if (delayed_stop_posted_) |
116 return 0; | 118 return 0; |
117 delayed_stop_posted_ = true; | 119 delayed_stop_posted_ = true; |
118 AudioManager::Get()->GetTaskRunner()->PostDelayedTask( | 120 AudioManager::Get()->GetTaskRunner()->PostDelayedTask( |
119 FROM_HERE, | 121 FROM_HERE, |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 g_observer_for_testing = observer; | 238 g_observer_for_testing = observer; |
237 } | 239 } |
238 | 240 |
239 // static | 241 // static |
240 void AudioStreamHandler::SetAudioSourceForTesting( | 242 void AudioStreamHandler::SetAudioSourceForTesting( |
241 AudioOutputStream::AudioSourceCallback* source) { | 243 AudioOutputStream::AudioSourceCallback* source) { |
242 g_audio_source_for_testing = source; | 244 g_audio_source_for_testing = source; |
243 } | 245 } |
244 | 246 |
245 } // namespace media | 247 } // namespace media |
OLD | NEW |