| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/audio_manager.h" | 5 #include "media/audio/audio_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } else { | 274 } else { |
| 275 // We create multiple instances of AudioManager only when testing. | 275 // We create multiple instances of AudioManager only when testing. |
| 276 // We should not encounter this case in production. | 276 // We should not encounter this case in production. |
| 277 LOG(WARNING) << "Multiple instances of AudioManager detected"; | 277 LOG(WARNING) << "Multiple instances of AudioManager detected"; |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 | 280 |
| 281 // static | 281 // static |
| 282 std::unique_ptr<AudioManager> AudioManager::Create( | 282 std::unique_ptr<AudioManager> AudioManager::Create( |
| 283 std::unique_ptr<AudioThread> audio_thread, | 283 std::unique_ptr<AudioThread> audio_thread, |
| 284 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, | |
| 285 AudioLogFactory* audio_log_factory) { | 284 AudioLogFactory* audio_log_factory) { |
| 286 std::unique_ptr<AudioManager> manager = | 285 std::unique_ptr<AudioManager> manager = |
| 287 CreateAudioManager(std::move(audio_thread), audio_log_factory); | 286 CreateAudioManager(std::move(audio_thread), audio_log_factory); |
| 288 #if BUILDFLAG(ENABLE_WEBRTC) | 287 #if BUILDFLAG(ENABLE_WEBRTC) |
| 289 manager->InitializeOutputDebugRecording(std::move(file_task_runner)); | 288 manager->InitializeOutputDebugRecording(); |
| 290 #endif | 289 #endif |
| 291 return manager; | 290 return manager; |
| 292 } | 291 } |
| 293 | 292 |
| 294 // static | 293 // static |
| 295 std::unique_ptr<AudioManager> AudioManager::CreateForTesting( | 294 std::unique_ptr<AudioManager> AudioManager::CreateForTesting( |
| 296 std::unique_ptr<AudioThread> audio_thread) { | 295 std::unique_ptr<AudioThread> audio_thread) { |
| 297 #if defined(OS_WIN) | 296 #if defined(OS_WIN) |
| 298 GetHelper()->InitializeCOMForTesting(); | 297 GetHelper()->InitializeCOMForTesting(); |
| 299 #endif | 298 #endif |
| 300 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner = | 299 return Create(std::move(audio_thread), GetHelper()->fake_log_factory()); |
| 301 audio_thread->GetWorkerTaskRunner(); | |
| 302 return Create(std::move(audio_thread), std::move(file_task_runner), | |
| 303 GetHelper()->fake_log_factory()); | |
| 304 } | 300 } |
| 305 | 301 |
| 306 // static | 302 // static |
| 307 void AudioManager::StartHangMonitorIfNeeded( | 303 void AudioManager::StartHangMonitorIfNeeded( |
| 308 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { | 304 scoped_refptr<base::SingleThreadTaskRunner> task_runner) { |
| 309 if (GetHelper()->monitor_task_runner()) | 305 if (GetHelper()->monitor_task_runner()) |
| 310 return; | 306 return; |
| 311 | 307 |
| 312 DCHECK(AudioManager::Get()); | 308 DCHECK(AudioManager::Get()); |
| 313 DCHECK(task_runner); | 309 DCHECK(task_runner); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 343 } else { | 339 } else { |
| 344 audio_thread_->GetTaskRunner()->PostTask( | 340 audio_thread_->GetTaskRunner()->PostTask( |
| 345 FROM_HERE, base::Bind(&AudioManager::ShutdownOnAudioThread, | 341 FROM_HERE, base::Bind(&AudioManager::ShutdownOnAudioThread, |
| 346 base::Unretained(this))); | 342 base::Unretained(this))); |
| 347 } | 343 } |
| 348 audio_thread_->Stop(); | 344 audio_thread_->Stop(); |
| 349 shutdown_ = true; | 345 shutdown_ = true; |
| 350 } | 346 } |
| 351 | 347 |
| 352 } // namespace media | 348 } // namespace media |
| OLD | NEW |