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 <stdint.h> | 7 #include <stdint.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 stream_->Close(); | 104 stream_->Close(); |
105 stream_ = NULL; | 105 stream_ = NULL; |
106 stop_closure_.Cancel(); | 106 stop_closure_.Cancel(); |
107 } | 107 } |
108 | 108 |
109 private: | 109 private: |
110 // AudioOutputStream::AudioSourceCallback overrides: | 110 // AudioOutputStream::AudioSourceCallback overrides: |
111 // Following methods could be called from *ANY* thread. | 111 // Following methods could be called from *ANY* thread. |
112 int OnMoreData(AudioBus* dest, | 112 int OnMoreData(AudioBus* dest, |
113 uint32_t /* total_bytes_delay */, | 113 uint32_t /* total_bytes_delay */, |
| 114 base::TimeDelta /* delay_timestamp */, |
114 uint32_t /* frames_skipped */) override { | 115 uint32_t /* frames_skipped */) override { |
115 base::AutoLock al(state_lock_); | 116 base::AutoLock al(state_lock_); |
116 size_t bytes_written = 0; | 117 size_t bytes_written = 0; |
117 | 118 |
118 if (wav_audio_->AtEnd(cursor_) || | 119 if (wav_audio_->AtEnd(cursor_) || |
119 !wav_audio_->CopyTo(dest, cursor_, &bytes_written)) { | 120 !wav_audio_->CopyTo(dest, cursor_, &bytes_written)) { |
120 if (delayed_stop_posted_) | 121 if (delayed_stop_posted_) |
121 return 0; | 122 return 0; |
122 delayed_stop_posted_ = true; | 123 delayed_stop_posted_ = true; |
123 AudioManager::Get()->GetTaskRunner()->PostDelayedTask( | 124 AudioManager::Get()->GetTaskRunner()->PostDelayedTask( |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 g_observer_for_testing = observer; | 243 g_observer_for_testing = observer; |
243 } | 244 } |
244 | 245 |
245 // static | 246 // static |
246 void AudioStreamHandler::SetAudioSourceForTesting( | 247 void AudioStreamHandler::SetAudioSourceForTesting( |
247 AudioOutputStream::AudioSourceCallback* source) { | 248 AudioOutputStream::AudioSourceCallback* source) { |
248 g_audio_source_for_testing = source; | 249 g_audio_source_for_testing = source; |
249 } | 250 } |
250 | 251 |
251 } // namespace media | 252 } // namespace media |
OLD | NEW |