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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 AudioManager::Get()->GetTaskRunner()->PostTask( | 197 AudioManager::Get()->GetTaskRunner()->PostTask( |
198 FROM_HERE, base::Bind(&AudioStreamContainer::Stop, | 198 FROM_HERE, base::Bind(&AudioStreamContainer::Stop, |
199 base::Unretained(stream_.get()))); | 199 base::Unretained(stream_.get()))); |
200 AudioManager::Get()->GetTaskRunner()->DeleteSoon(FROM_HERE, | 200 AudioManager::Get()->GetTaskRunner()->DeleteSoon(FROM_HERE, |
201 stream_.release()); | 201 stream_.release()); |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 bool AudioStreamHandler::IsInitialized() const { | 205 bool AudioStreamHandler::IsInitialized() const { |
206 DCHECK(CalledOnValidThread()); | 206 DCHECK(CalledOnValidThread()); |
207 return stream_; | 207 return !!stream_; |
208 } | 208 } |
209 | 209 |
210 bool AudioStreamHandler::Play() { | 210 bool AudioStreamHandler::Play() { |
211 DCHECK(CalledOnValidThread()); | 211 DCHECK(CalledOnValidThread()); |
212 | 212 |
213 if (!IsInitialized()) | 213 if (!IsInitialized()) |
214 return false; | 214 return false; |
215 | 215 |
216 AudioManager::Get()->GetTaskRunner()->PostTask( | 216 AudioManager::Get()->GetTaskRunner()->PostTask( |
217 FROM_HERE, | 217 FROM_HERE, |
(...skipping 23 matching lines...) Expand all Loading... |
241 g_observer_for_testing = observer; | 241 g_observer_for_testing = observer; |
242 } | 242 } |
243 | 243 |
244 // static | 244 // static |
245 void AudioStreamHandler::SetAudioSourceForTesting( | 245 void AudioStreamHandler::SetAudioSourceForTesting( |
246 AudioOutputStream::AudioSourceCallback* source) { | 246 AudioOutputStream::AudioSourceCallback* source) { |
247 g_audio_source_for_testing = source; | 247 g_audio_source_for_testing = source; |
248 } | 248 } |
249 | 249 |
250 } // namespace media | 250 } // namespace media |
OLD | NEW |