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

Side by Side Diff: media/audio/mac/audio_manager_mac.h

Issue 655713003: Standardize usage of virtual/override/final in media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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_MAC_AUDIO_MANAGER_MAC_H_ 5 #ifndef MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_
6 #define MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ 6 #define MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_
7 7
8 #include <CoreAudio/AudioHardware.h> 8 #include <CoreAudio/AudioHardware.h>
9 #include <list> 9 #include <list>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "media/audio/audio_manager_base.h" 14 #include "media/audio/audio_manager_base.h"
15 #include "media/audio/mac/audio_device_listener_mac.h" 15 #include "media/audio/mac/audio_device_listener_mac.h"
16 16
17 namespace media { 17 namespace media {
18 18
19 // Mac OS X implementation of the AudioManager singleton. This class is internal 19 // Mac OS X implementation of the AudioManager singleton. This class is internal
20 // to the audio output and only internal users can call methods not exposed by 20 // to the audio output and only internal users can call methods not exposed by
21 // the AudioManager class. 21 // the AudioManager class.
22 class MEDIA_EXPORT AudioManagerMac : public AudioManagerBase { 22 class MEDIA_EXPORT AudioManagerMac : public AudioManagerBase {
23 public: 23 public:
24 AudioManagerMac(AudioLogFactory* audio_log_factory); 24 AudioManagerMac(AudioLogFactory* audio_log_factory);
25 25
26 // Implementation of AudioManager. 26 // Implementation of AudioManager.
27 virtual bool HasAudioOutputDevices() override; 27 bool HasAudioOutputDevices() override;
28 virtual bool HasAudioInputDevices() override; 28 bool HasAudioInputDevices() override;
29 virtual void GetAudioInputDeviceNames( 29 void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
30 AudioDeviceNames* device_names) override; 30 void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
31 virtual void GetAudioOutputDeviceNames( 31 AudioParameters GetInputStreamParameters(
32 AudioDeviceNames* device_names) override;
33 virtual AudioParameters GetInputStreamParameters(
34 const std::string& device_id) override; 32 const std::string& device_id) override;
35 virtual std::string GetAssociatedOutputDeviceID( 33 std::string GetAssociatedOutputDeviceID(
36 const std::string& input_device_id) override; 34 const std::string& input_device_id) override;
37 35
38 // Implementation of AudioManagerBase. 36 // Implementation of AudioManagerBase.
39 virtual AudioOutputStream* MakeLinearOutputStream( 37 AudioOutputStream* MakeLinearOutputStream(
40 const AudioParameters& params) override; 38 const AudioParameters& params) override;
41 virtual AudioOutputStream* MakeLowLatencyOutputStream( 39 AudioOutputStream* MakeLowLatencyOutputStream(
42 const AudioParameters& params, 40 const AudioParameters& params,
43 const std::string& device_id) override; 41 const std::string& device_id) override;
44 virtual AudioInputStream* MakeLinearInputStream( 42 AudioInputStream* MakeLinearInputStream(
45 const AudioParameters& params, const std::string& device_id) override; 43 const AudioParameters& params,
46 virtual AudioInputStream* MakeLowLatencyInputStream( 44 const std::string& device_id) override;
47 const AudioParameters& params, const std::string& device_id) override; 45 AudioInputStream* MakeLowLatencyInputStream(
48 virtual std::string GetDefaultOutputDeviceID() override; 46 const AudioParameters& params,
47 const std::string& device_id) override;
48 std::string GetDefaultOutputDeviceID() override;
49 49
50 // Used to track destruction of input and output streams. 50 // Used to track destruction of input and output streams.
51 virtual void ReleaseOutputStream(AudioOutputStream* stream) override; 51 void ReleaseOutputStream(AudioOutputStream* stream) override;
52 virtual void ReleaseInputStream(AudioInputStream* stream) override; 52 void ReleaseInputStream(AudioInputStream* stream) override;
53 53
54 static bool GetDefaultInputDevice(AudioDeviceID* device); 54 static bool GetDefaultInputDevice(AudioDeviceID* device);
55 static bool GetDefaultOutputDevice(AudioDeviceID* device); 55 static bool GetDefaultOutputDevice(AudioDeviceID* device);
56 static bool GetDefaultDevice(AudioDeviceID* device, bool input); 56 static bool GetDefaultDevice(AudioDeviceID* device, bool input);
57 57
58 static bool GetDefaultOutputChannels(int* channels); 58 static bool GetDefaultOutputChannels(int* channels);
59 59
60 static bool GetDeviceChannels(AudioDeviceID device, 60 static bool GetDeviceChannels(AudioDeviceID device,
61 AudioObjectPropertyScope scope, 61 AudioObjectPropertyScope scope,
62 int* channels); 62 int* channels);
63 63
64 static int HardwareSampleRateForDevice(AudioDeviceID device_id); 64 static int HardwareSampleRateForDevice(AudioDeviceID device_id);
65 static int HardwareSampleRate(); 65 static int HardwareSampleRate();
66 66
67 // OSX has issues with starting streams as the sytem goes into suspend and 67 // OSX has issues with starting streams as the sytem goes into suspend and
68 // immediately after it wakes up from resume. See http://crbug.com/160920. 68 // immediately after it wakes up from resume. See http://crbug.com/160920.
69 // As a workaround we delay Start() when it occurs after suspend and for a 69 // As a workaround we delay Start() when it occurs after suspend and for a
70 // small amount of time after resume. 70 // small amount of time after resume.
71 // 71 //
72 // Streams should consult ShouldDeferStreamStart() and if true check the value 72 // Streams should consult ShouldDeferStreamStart() and if true check the value
73 // again after |kStartDelayInSecsForPowerEvents| has elapsed. If false, the 73 // again after |kStartDelayInSecsForPowerEvents| has elapsed. If false, the
74 // stream may be started immediately. 74 // stream may be started immediately.
75 enum { kStartDelayInSecsForPowerEvents = 1 }; 75 enum { kStartDelayInSecsForPowerEvents = 1 };
76 bool ShouldDeferStreamStart(); 76 bool ShouldDeferStreamStart();
77 77
78 protected: 78 protected:
79 virtual ~AudioManagerMac(); 79 ~AudioManagerMac() override;
80 80
81 virtual AudioParameters GetPreferredOutputStreamParameters( 81 AudioParameters GetPreferredOutputStreamParameters(
82 const std::string& output_device_id, 82 const std::string& output_device_id,
83 const AudioParameters& input_params) override; 83 const AudioParameters& input_params) override;
84 84
85 private: 85 private:
86 void InitializeOnAudioThread(); 86 void InitializeOnAudioThread();
87 void ShutdownOnAudioThread(); 87 void ShutdownOnAudioThread();
88 88
89 int ChooseBufferSize(int output_sample_rate); 89 int ChooseBufferSize(int output_sample_rate);
90 90
91 // Notify streams of a device change if the default output device or its 91 // Notify streams of a device change if the default output device or its
(...skipping 17 matching lines...) Expand all
109 // shutdown. See ShutdownOnAudioThread() for more details. 109 // shutdown. See ShutdownOnAudioThread() for more details.
110 std::list<AudioInputStream*> input_streams_; 110 std::list<AudioInputStream*> input_streams_;
111 std::list<AudioOutputStream*> output_streams_; 111 std::list<AudioOutputStream*> output_streams_;
112 112
113 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac); 113 DISALLOW_COPY_AND_ASSIGN(AudioManagerMac);
114 }; 114 };
115 115
116 } // namespace media 116 } // namespace media
117 117
118 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_ 118 #endif // MEDIA_AUDIO_MAC_AUDIO_MANAGER_MAC_H_
OLDNEW
« no previous file with comments | « media/audio/mac/audio_low_latency_input_mac_unittest.cc ('k') | media/audio/mac/audio_manager_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698