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

Side by Side Diff: media/audio/win/audio_manager_win.h

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 (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 #ifndef MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ 5 #ifndef MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_
6 #define MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ 6 #define MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "media/audio/audio_manager_base.h" 12 #include "media/audio/audio_manager_base.h"
13 13
14 namespace media { 14 namespace media {
15 15
16 class AudioDeviceListenerWin; 16 class AudioDeviceListenerWin;
17 17
18 // Windows implementation of the AudioManager singleton. This class is internal 18 // Windows implementation of the AudioManager singleton. This class is internal
19 // to the audio output and only internal users can call methods not exposed by 19 // to the audio output and only internal users can call methods not exposed by
20 // the AudioManager class. 20 // the AudioManager class.
21 class MEDIA_EXPORT AudioManagerWin : public AudioManagerBase { 21 class MEDIA_EXPORT AudioManagerWin : public AudioManagerBase {
22 public: 22 public:
23 AudioManagerWin( 23 AudioManagerWin(
24 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 24 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
25 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, 25 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner,
26 AudioLogFactory* audio_log_factory); 26 AudioLogFactory* audio_log_factory);
27 ~AudioManagerWin() override;
27 28
28 // Implementation of AudioManager. 29 // Implementation of AudioManager.
30 void Shutdown() override;
29 bool HasAudioOutputDevices() override; 31 bool HasAudioOutputDevices() override;
30 bool HasAudioInputDevices() override; 32 bool HasAudioInputDevices() override;
31 base::string16 GetAudioInputDeviceModel() override; 33 base::string16 GetAudioInputDeviceModel() override;
32 void ShowAudioInputSettings() override; 34 void ShowAudioInputSettings() override;
33 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override; 35 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
34 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override; 36 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
35 AudioParameters GetInputStreamParameters( 37 AudioParameters GetInputStreamParameters(
36 const std::string& device_id) override; 38 const std::string& device_id) override;
37 std::string GetAssociatedOutputDeviceID( 39 std::string GetAssociatedOutputDeviceID(
38 const std::string& input_device_id) override; 40 const std::string& input_device_id) override;
(...skipping 11 matching lines...) Expand all
50 const AudioParameters& params, 52 const AudioParameters& params,
51 const std::string& device_id, 53 const std::string& device_id,
52 const LogCallback& log_callback) override; 54 const LogCallback& log_callback) override;
53 AudioInputStream* MakeLowLatencyInputStream( 55 AudioInputStream* MakeLowLatencyInputStream(
54 const AudioParameters& params, 56 const AudioParameters& params,
55 const std::string& device_id, 57 const std::string& device_id,
56 const LogCallback& log_callback) override; 58 const LogCallback& log_callback) override;
57 std::string GetDefaultOutputDeviceID() override; 59 std::string GetDefaultOutputDeviceID() override;
58 60
59 protected: 61 protected:
60 ~AudioManagerWin() override;
61
62 AudioParameters GetPreferredOutputStreamParameters( 62 AudioParameters GetPreferredOutputStreamParameters(
63 const std::string& output_device_id, 63 const std::string& output_device_id,
64 const AudioParameters& input_params) override; 64 const AudioParameters& input_params) override;
65 65
66 private: 66 private:
67 // Allow unit test to modify the utilized enumeration API. 67 // Allow unit test to modify the utilized enumeration API.
68 friend class AudioManagerTest; 68 friend class AudioManagerTest;
69 69
70 // Helper methods for performing expensive initialization tasks on the audio 70 // Helper methods for performing expensive initialization tasks on the audio
71 // thread instead of on the UI thread which AudioManager is constructed on. 71 // thread instead of on the UI thread which AudioManager is constructed on.
72 void InitializeOnAudioThread(); 72 void InitializeOnAudioThread();
73 73
74 void GetAudioDeviceNamesImpl(bool input, AudioDeviceNames* device_names); 74 void GetAudioDeviceNamesImpl(bool input, AudioDeviceNames* device_names);
75 75
76 // Listen for output device changes. 76 // Listen for output device changes.
77 std::unique_ptr<AudioDeviceListenerWin> output_device_listener_; 77 std::unique_ptr<AudioDeviceListenerWin> output_device_listener_;
78 78
79 DISALLOW_COPY_AND_ASSIGN(AudioManagerWin); 79 DISALLOW_COPY_AND_ASSIGN(AudioManagerWin);
80 }; 80 };
81 81
82 } // namespace media 82 } // namespace media
83 83
84 #endif // MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_ 84 #endif // MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698