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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 AudioManager::Get()->GetTaskRunner()->PostDelayedTask( | 117 AudioManager::Get()->GetTaskRunner()->PostDelayedTask( |
118 FROM_HERE, | 118 FROM_HERE, |
119 stop_closure_.callback(), | 119 stop_closure_.callback(), |
120 base::TimeDelta::FromMilliseconds(kKeepAliveMs)); | 120 base::TimeDelta::FromMilliseconds(kKeepAliveMs)); |
121 return 0; | 121 return 0; |
122 } | 122 } |
123 cursor_ += bytes_written; | 123 cursor_ += bytes_written; |
124 return dest->frames(); | 124 return dest->frames(); |
125 } | 125 } |
126 | 126 |
127 virtual int OnMoreIOData(AudioBus* /* source */, | |
128 AudioBus* dest, | |
129 AudioBuffersState state) OVERRIDE { | |
130 return OnMoreData(dest, state); | |
131 } | |
132 | |
133 virtual void OnError(AudioOutputStream* /* stream */) OVERRIDE { | 127 virtual void OnError(AudioOutputStream* /* stream */) OVERRIDE { |
134 LOG(ERROR) << "Error during system sound reproduction."; | 128 LOG(ERROR) << "Error during system sound reproduction."; |
135 } | 129 } |
136 | 130 |
137 void StopStream() { | 131 void StopStream() { |
138 DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); | 132 DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); |
139 | 133 |
140 base::AutoLock al(state_lock_); | 134 base::AutoLock al(state_lock_); |
141 | 135 |
142 if (stream_ && started_) { | 136 if (stream_ && started_) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 g_observer_for_testing = observer; | 209 g_observer_for_testing = observer; |
216 } | 210 } |
217 | 211 |
218 // static | 212 // static |
219 void AudioStreamHandler::SetAudioSourceForTesting( | 213 void AudioStreamHandler::SetAudioSourceForTesting( |
220 AudioOutputStream::AudioSourceCallback* source) { | 214 AudioOutputStream::AudioSourceCallback* source) { |
221 g_audio_source_for_testing = source; | 215 g_audio_source_for_testing = source; |
222 } | 216 } |
223 | 217 |
224 } // namespace media | 218 } // namespace media |
OLD | NEW |