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

Side by Side Diff: media/audio/audio_input_device.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
« no previous file with comments | « media/audio/audio_input_controller.h ('k') | media/audio/audio_input_device.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 (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 // Low-latency audio capturing class utilizing audio input stream provided 5 // Low-latency audio capturing class utilizing audio input stream provided
6 // by a server (browser) process by use of an IPC interface. 6 // by a server (browser) process by use of an IPC interface.
7 // 7 //
8 // Relationship of classes: 8 // Relationship of classes:
9 // 9 //
10 // AudioInputController AudioInputDevice 10 // AudioInputController AudioInputDevice
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 : NON_EXPORTED_BASE(public AudioCapturerSource), 78 : NON_EXPORTED_BASE(public AudioCapturerSource),
79 NON_EXPORTED_BASE(public AudioInputIPCDelegate), 79 NON_EXPORTED_BASE(public AudioInputIPCDelegate),
80 NON_EXPORTED_BASE(public ScopedTaskRunnerObserver) { 80 NON_EXPORTED_BASE(public ScopedTaskRunnerObserver) {
81 public: 81 public:
82 // NOTE: Clients must call Initialize() before using. 82 // NOTE: Clients must call Initialize() before using.
83 AudioInputDevice( 83 AudioInputDevice(
84 scoped_ptr<AudioInputIPC> ipc, 84 scoped_ptr<AudioInputIPC> ipc,
85 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); 85 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner);
86 86
87 // AudioCapturerSource implementation. 87 // AudioCapturerSource implementation.
88 virtual void Initialize(const AudioParameters& params, 88 void Initialize(const AudioParameters& params,
89 CaptureCallback* callback, 89 CaptureCallback* callback,
90 int session_id) override; 90 int session_id) override;
91 virtual void Start() override; 91 void Start() override;
92 virtual void Stop() override; 92 void Stop() override;
93 virtual void SetVolume(double volume) override; 93 void SetVolume(double volume) override;
94 virtual void SetAutomaticGainControl(bool enabled) override; 94 void SetAutomaticGainControl(bool enabled) override;
95 95
96 protected: 96 protected:
97 friend class base::RefCountedThreadSafe<AudioInputDevice>; 97 friend class base::RefCountedThreadSafe<AudioInputDevice>;
98 virtual ~AudioInputDevice(); 98 ~AudioInputDevice() override;
99 99
100 // Methods called on IO thread ---------------------------------------------- 100 // Methods called on IO thread ----------------------------------------------
101 // AudioInputIPCDelegate implementation. 101 // AudioInputIPCDelegate implementation.
102 virtual void OnStreamCreated(base::SharedMemoryHandle handle, 102 void OnStreamCreated(base::SharedMemoryHandle handle,
103 base::SyncSocket::Handle socket_handle, 103 base::SyncSocket::Handle socket_handle,
104 int length, 104 int length,
105 int total_segments) override; 105 int total_segments) override;
106 virtual void OnVolume(double volume) override; 106 void OnVolume(double volume) override;
107 virtual void OnStateChanged( 107 void OnStateChanged(AudioInputIPCDelegate::State state) override;
108 AudioInputIPCDelegate::State state) override; 108 void OnIPCClosed() override;
109 virtual void OnIPCClosed() override;
110 109
111 private: 110 private:
112 // Note: The ordering of members in this enum is critical to correct behavior! 111 // Note: The ordering of members in this enum is critical to correct behavior!
113 enum State { 112 enum State {
114 IPC_CLOSED, // No more IPCs can take place. 113 IPC_CLOSED, // No more IPCs can take place.
115 IDLE, // Not started. 114 IDLE, // Not started.
116 CREATING_STREAM, // Waiting for OnStreamCreated() to be called back. 115 CREATING_STREAM, // Waiting for OnStreamCreated() to be called back.
117 RECORDING, // Receiving audio data. 116 RECORDING, // Receiving audio data.
118 }; 117 };
119 118
120 // Methods called on IO thread ---------------------------------------------- 119 // Methods called on IO thread ----------------------------------------------
121 // The following methods are tasks posted on the IO thread that needs to 120 // The following methods are tasks posted on the IO thread that needs to
122 // be executed on that thread. They interact with AudioInputMessageFilter and 121 // be executed on that thread. They interact with AudioInputMessageFilter and
123 // sends IPC messages on that thread. 122 // sends IPC messages on that thread.
124 void StartUpOnIOThread(); 123 void StartUpOnIOThread();
125 void ShutDownOnIOThread(); 124 void ShutDownOnIOThread();
126 void SetVolumeOnIOThread(double volume); 125 void SetVolumeOnIOThread(double volume);
127 void SetAutomaticGainControlOnIOThread(bool enabled); 126 void SetAutomaticGainControlOnIOThread(bool enabled);
128 127
129 // base::MessageLoop::DestructionObserver implementation for the IO loop. 128 // base::MessageLoop::DestructionObserver implementation for the IO loop.
130 // If the IO loop dies before we do, we shut down the audio thread from here. 129 // If the IO loop dies before we do, we shut down the audio thread from here.
131 virtual void WillDestroyCurrentMessageLoop() override; 130 void WillDestroyCurrentMessageLoop() override;
132 131
133 AudioParameters audio_parameters_; 132 AudioParameters audio_parameters_;
134 133
135 CaptureCallback* callback_; 134 CaptureCallback* callback_;
136 135
137 // A pointer to the IPC layer that takes care of sending requests over to 136 // A pointer to the IPC layer that takes care of sending requests over to
138 // the AudioInputRendererHost. Only valid when state_ != IPC_CLOSED and must 137 // the AudioInputRendererHost. Only valid when state_ != IPC_CLOSED and must
139 // only be accessed on the IO thread. 138 // only be accessed on the IO thread.
140 scoped_ptr<AudioInputIPC> ipc_; 139 scoped_ptr<AudioInputIPC> ipc_;
141 140
(...skipping 25 matching lines...) Expand all
167 // TODO(miu): Replace this by changing AudioCapturerSource to accept the 166 // TODO(miu): Replace this by changing AudioCapturerSource to accept the
168 // callback via Start(). See http://crbug.com/151051 for details. 167 // callback via Start(). See http://crbug.com/151051 for details.
169 bool stopping_hack_; 168 bool stopping_hack_;
170 169
171 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); 170 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice);
172 }; 171 };
173 172
174 } // namespace media 173 } // namespace media
175 174
176 #endif // MEDIA_AUDIO_AUDIO_INPUT_DEVICE_H_ 175 #endif // MEDIA_AUDIO_AUDIO_INPUT_DEVICE_H_
OLDNEW
« no previous file with comments | « media/audio/audio_input_controller.h ('k') | media/audio/audio_input_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698