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

Side by Side Diff: media/audio/audio_output_controller.h

Issue 290003002: Remove OnMoreIOData() (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed the media unittests on mac. Created 6 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
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_AUDIO_OUTPUT_CONTROLLER_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_
6 #define MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_
7 7
8 #include "base/atomic_ref_count.h" 8 #include "base/atomic_ref_count.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 class SyncReader { 84 class SyncReader {
85 public: 85 public:
86 virtual ~SyncReader() {} 86 virtual ~SyncReader() {}
87 87
88 // Notify the synchronous reader the number of bytes in the 88 // Notify the synchronous reader the number of bytes in the
89 // AudioOutputController not yet played. This is used by SyncReader to 89 // AudioOutputController not yet played. This is used by SyncReader to
90 // prepare more data and perform synchronization. 90 // prepare more data and perform synchronization.
91 virtual void UpdatePendingBytes(uint32 bytes) = 0; 91 virtual void UpdatePendingBytes(uint32 bytes) = 0;
92 92
93 // Attempts to completely fill |dest|, zeroing |dest| if the request can not 93 // Attempts to completely fill |dest|, zeroing |dest| if the request can not
94 // be fulfilled (due to timeout). |source| may optionally be provided for 94 // be fulfilled (due to timeout).
95 // input data. 95 virtual void Read(AudioBus* dest) = 0;
96 virtual void Read(const AudioBus* source, AudioBus* dest) = 0;
97 96
98 // Close this synchronous reader. 97 // Close this synchronous reader.
99 virtual void Close() = 0; 98 virtual void Close() = 0;
100 }; 99 };
101 100
102 // Factory method for creating an AudioOutputController. 101 // Factory method for creating an AudioOutputController.
103 // This also creates and opens an AudioOutputStream on the audio manager 102 // This also creates and opens an AudioOutputStream on the audio manager
104 // thread, and if this is successful, the |event_handler| will receive an 103 // thread, and if this is successful, the |event_handler| will receive an
105 // OnCreated() call from the same audio manager thread. |audio_manager| must 104 // OnCreated() call from the same audio manager thread. |audio_manager| must
106 // outlive AudioOutputController. 105 // outlive AudioOutputController.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // the same state transition back to the current state as a call to 143 // the same state transition back to the current state as a call to
145 // OnDeviceChange (unless it is currently diverting, see 144 // OnDeviceChange (unless it is currently diverting, see
146 // Start/StopDiverting below, in which case the state transition 145 // Start/StopDiverting below, in which case the state transition
147 // will happen when StopDiverting is called). 146 // will happen when StopDiverting is called).
148 void SwitchOutputDevice(const std::string& output_device_id, 147 void SwitchOutputDevice(const std::string& output_device_id,
149 const base::Closure& callback); 148 const base::Closure& callback);
150 149
151 // AudioSourceCallback implementation. 150 // AudioSourceCallback implementation.
152 virtual int OnMoreData(AudioBus* dest, 151 virtual int OnMoreData(AudioBus* dest,
153 AudioBuffersState buffers_state) OVERRIDE; 152 AudioBuffersState buffers_state) OVERRIDE;
154 virtual int OnMoreIOData(AudioBus* source,
155 AudioBus* dest,
156 AudioBuffersState buffers_state) OVERRIDE;
157 virtual void OnError(AudioOutputStream* stream) OVERRIDE; 153 virtual void OnError(AudioOutputStream* stream) OVERRIDE;
158 154
159 // AudioDeviceListener implementation. When called AudioOutputController will 155 // AudioDeviceListener implementation. When called AudioOutputController will
160 // shutdown the existing |stream_|, transition to the kRecreating state, 156 // shutdown the existing |stream_|, transition to the kRecreating state,
161 // create a new stream, and then transition back to an equivalent state prior 157 // create a new stream, and then transition back to an equivalent state prior
162 // to being called. 158 // to being called.
163 virtual void OnDeviceChange() OVERRIDE; 159 virtual void OnDeviceChange() OVERRIDE;
164 160
165 // AudioSourceDiverter implementation. 161 // AudioSourceDiverter implementation.
166 virtual const AudioParameters& GetAudioParameters() OVERRIDE; 162 virtual const AudioParameters& GetAudioParameters() OVERRIDE;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 void DoReportError(); 202 void DoReportError();
207 void DoStartDiverting(AudioOutputStream* to_stream); 203 void DoStartDiverting(AudioOutputStream* to_stream);
208 void DoStopDiverting(); 204 void DoStopDiverting();
209 205
210 // Helper method that stops the physical stream. 206 // Helper method that stops the physical stream.
211 void StopStream(); 207 void StopStream();
212 208
213 // Helper method that stops, closes, and NULLs |*stream_|. 209 // Helper method that stops, closes, and NULLs |*stream_|.
214 void DoStopCloseAndClearStream(); 210 void DoStopCloseAndClearStream();
215 211
216 // Checks if a stream was started successfully but never calls OnMoreIOData(). 212 // Checks if a stream was started successfully but never calls OnMoreData().
217 void WedgeCheck(); 213 void WedgeCheck();
218 214
219 AudioManager* const audio_manager_; 215 AudioManager* const audio_manager_;
220 const AudioParameters params_; 216 const AudioParameters params_;
221 EventHandler* const handler_; 217 EventHandler* const handler_;
222 218
223 // Specifies the device id of the output device to open or empty for the 219 // Specifies the device id of the output device to open or empty for the
224 // default output device. 220 // default output device.
225 std::string output_device_id_; 221 std::string output_device_id_;
226 222
(...skipping 10 matching lines...) Expand all
237 // is not required for reading on the audio manager thread. 233 // is not required for reading on the audio manager thread.
238 State state_; 234 State state_;
239 235
240 // SyncReader is used only in low latency mode for synchronous reading. 236 // SyncReader is used only in low latency mode for synchronous reading.
241 SyncReader* const sync_reader_; 237 SyncReader* const sync_reader_;
242 238
243 // The message loop of audio manager thread that this object runs on. 239 // The message loop of audio manager thread that this object runs on.
244 const scoped_refptr<base::SingleThreadTaskRunner> message_loop_; 240 const scoped_refptr<base::SingleThreadTaskRunner> message_loop_;
245 241
246 #if defined(AUDIO_POWER_MONITORING) 242 #if defined(AUDIO_POWER_MONITORING)
247 // Scans audio samples from OnMoreIOData() as input to compute power levels. 243 // Scans audio samples from OnMoreData() as input to compute power levels.
248 AudioPowerMonitor power_monitor_; 244 AudioPowerMonitor power_monitor_;
249 #endif 245 #endif
250 246
251 // Flags when we've asked for a stream to start but it never did. 247 // Flags when we've asked for a stream to start but it never did.
252 base::AtomicRefCount on_more_io_data_called_; 248 base::AtomicRefCount on_more_io_data_called_;
253 scoped_ptr<base::OneShotTimer<AudioOutputController> > wedge_timer_; 249 scoped_ptr<base::OneShotTimer<AudioOutputController> > wedge_timer_;
254 250
255 DISALLOW_COPY_AND_ASSIGN(AudioOutputController); 251 DISALLOW_COPY_AND_ASSIGN(AudioOutputController);
256 }; 252 };
257 253
258 } // namespace media 254 } // namespace media
259 255
260 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_ 256 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « media/audio/audio_low_latency_input_output_unittest.cc ('k') | media/audio/audio_output_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698