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

Side by Side Diff: media/audio/cras/audio_manager_cras.cc

Issue 2784433002: Ensures that audio tasks cannot run after AudioManager is deleted. (Closed)
Patch Set: fixes content_browsertests and content_unittests Created 3 years, 8 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
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/cras/audio_manager_cras.h" 5 #include "media/audio/cras/audio_manager_cras.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 135 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
136 AudioLogFactory* audio_log_factory) 136 AudioLogFactory* audio_log_factory)
137 : AudioManagerBase(std::move(task_runner), 137 : AudioManagerBase(std::move(task_runner),
138 std::move(worker_task_runner), 138 std::move(worker_task_runner),
139 audio_log_factory), 139 audio_log_factory),
140 beamforming_on_device_id_(nullptr), 140 beamforming_on_device_id_(nullptr),
141 beamforming_off_device_id_(nullptr) { 141 beamforming_off_device_id_(nullptr) {
142 SetMaxOutputStreamsAllowed(kMaxOutputStreams); 142 SetMaxOutputStreamsAllowed(kMaxOutputStreams);
143 } 143 }
144 144
145 AudioManagerCras::~AudioManagerCras() { 145 AudioManagerCras::~AudioManagerCras() = default;
146 Shutdown();
147 }
148 146
149 void AudioManagerCras::ShowAudioInputSettings() { 147 void AudioManagerCras::ShowAudioInputSettings() {
150 NOTIMPLEMENTED(); 148 NOTIMPLEMENTED();
151 } 149 }
152 150
153 void AudioManagerCras::GetAudioDeviceNamesImpl(bool is_input, 151 void AudioManagerCras::GetAudioDeviceNamesImpl(bool is_input,
154 AudioDeviceNames* device_names) { 152 AudioDeviceNames* device_names) {
155 DCHECK(device_names->empty()); 153 DCHECK(device_names->empty());
156 // At least two mic positions indicates we have a beamforming capable mic 154 // At least two mic positions indicates we have a beamforming capable mic
157 // array. Add the virtual beamforming device to the list. When this device is 155 // array. Add the virtual beamforming device to the list. When this device is
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 315
318 bool AudioManagerCras::IsDefault(const std::string& device_id, bool is_input) { 316 bool AudioManagerCras::IsDefault(const std::string& device_id, bool is_input) {
319 AudioDeviceNames device_names; 317 AudioDeviceNames device_names;
320 GetAudioDeviceNamesImpl(is_input, &device_names); 318 GetAudioDeviceNamesImpl(is_input, &device_names);
321 DCHECK(!device_names.empty()); 319 DCHECK(!device_names.empty());
322 const AudioDeviceName& device_name = device_names.front(); 320 const AudioDeviceName& device_name = device_names.front();
323 return device_name.unique_id == device_id; 321 return device_name.unique_id == device_id;
324 } 322 }
325 323
326 } // namespace media 324 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698