| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 AudioManager::Get()->GetTaskRunner()->PostDelayedTask( | 118 AudioManager::Get()->GetTaskRunner()->PostDelayedTask( |
| 119 FROM_HERE, | 119 FROM_HERE, |
| 120 stop_closure_.callback(), | 120 stop_closure_.callback(), |
| 121 base::TimeDelta::FromMilliseconds(kKeepAliveMs)); | 121 base::TimeDelta::FromMilliseconds(kKeepAliveMs)); |
| 122 return 0; | 122 return 0; |
| 123 } | 123 } |
| 124 cursor_ += bytes_written; | 124 cursor_ += bytes_written; |
| 125 return dest->frames(); | 125 return dest->frames(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void OnSkippedData(uint32_t frames_skipped) override {} |
| 129 |
| 128 void OnError(AudioOutputStream* /* stream */) override { | 130 void OnError(AudioOutputStream* /* stream */) override { |
| 129 LOG(ERROR) << "Error during system sound reproduction."; | 131 LOG(ERROR) << "Error during system sound reproduction."; |
| 130 AudioManager::Get()->GetTaskRunner()->PostTask( | 132 AudioManager::Get()->GetTaskRunner()->PostTask( |
| 131 FROM_HERE, | 133 FROM_HERE, |
| 132 base::Bind(&AudioStreamContainer::Stop, base::Unretained(this))); | 134 base::Bind(&AudioStreamContainer::Stop, base::Unretained(this))); |
| 133 } | 135 } |
| 134 | 136 |
| 135 void StopStream() { | 137 void StopStream() { |
| 136 DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); | 138 DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); |
| 137 | 139 |
| (...skipping 98 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 |