Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: media/audio/fake_audio_manager.cc

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/audio/fake_audio_manager.h ('k') | media/audio/linux/audio_manager_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/fake_audio_manager.h" 5 #include "media/audio/fake_audio_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 namespace media { 10 namespace media {
11 11
12 namespace { 12 namespace {
13 13
14 const int kDefaultInputBufferSize = 1024; 14 const int kDefaultInputBufferSize = 1024;
15 const int kDefaultSampleRate = 48000; 15 const int kDefaultSampleRate = 48000;
16 16
17 } // namespace 17 } // namespace
18 18
19 FakeAudioManager::FakeAudioManager( 19 FakeAudioManager::FakeAudioManager(std::unique_ptr<AudioThread> audio_thread,
20 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 20 AudioLogFactory* audio_log_factory)
21 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 21 : AudioManagerBase(std::move(audio_thread), audio_log_factory) {}
22 AudioLogFactory* audio_log_factory)
23 : AudioManagerBase(std::move(task_runner),
24 std::move(worker_task_runner),
25 audio_log_factory) {
26 }
27 22
28 FakeAudioManager::~FakeAudioManager() { 23 FakeAudioManager::~FakeAudioManager() = default;
29 Shutdown();
30 }
31 24
32 // Implementation of AudioManager. 25 // Implementation of AudioManager.
33 bool FakeAudioManager::HasAudioOutputDevices() { return false; } 26 bool FakeAudioManager::HasAudioOutputDevices() { return false; }
34 27
35 bool FakeAudioManager::HasAudioInputDevices() { return false; } 28 bool FakeAudioManager::HasAudioInputDevices() { return false; }
36 29
37 const char* FakeAudioManager::GetName() { 30 const char* FakeAudioManager::GetName() {
38 return "Fake"; 31 return "Fake";
39 } 32 }
40 33
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 80 }
88 81
89 AudioParameters FakeAudioManager::GetInputStreamParameters( 82 AudioParameters FakeAudioManager::GetInputStreamParameters(
90 const std::string& device_id) { 83 const std::string& device_id) {
91 return AudioParameters( 84 return AudioParameters(
92 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, 85 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO,
93 kDefaultSampleRate, 16, kDefaultInputBufferSize); 86 kDefaultSampleRate, 16, kDefaultInputBufferSize);
94 } 87 }
95 88
96 } // namespace media 89 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/fake_audio_manager.h ('k') | media/audio/linux/audio_manager_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698