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

Side by Side Diff: media/audio/alsa/alsa_output.h

Issue 193303002: WeakPtr destruction order cleanup: media edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/alsa/alsa_input.cc ('k') | media/audio/alsa/alsa_output.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 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 // Creates an output stream based on the ALSA PCM interface. 5 // Creates an output stream based on the ALSA PCM interface.
6 // 6 //
7 // On device write failure, the stream will move itself to an invalid state. 7 // On device write failure, the stream will move itself to an invalid state.
8 // No more data will be pulled from the data source, or written to the device. 8 // No more data will be pulled from the data source, or written to the device.
9 // All calls to public API functions will either no-op themselves, or return an 9 // All calls to public API functions will either no-op themselves, or return an
10 // error if possible. Specifically, If the stream is in an error state, Open() 10 // error if possible. Specifically, If the stream is in an error state, Open()
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // AudioManagerBase::ShutDown() can invalidate the message loop pointer 194 // AudioManagerBase::ShutDown() can invalidate the message loop pointer
195 // before the stream gets deleted. 195 // before the stream gets deleted.
196 base::MessageLoop* message_loop_; 196 base::MessageLoop* message_loop_;
197 197
198 // Handle to the actual PCM playback device. 198 // Handle to the actual PCM playback device.
199 snd_pcm_t* playback_handle_; 199 snd_pcm_t* playback_handle_;
200 200
201 scoped_ptr<media::SeekableBuffer> buffer_; 201 scoped_ptr<media::SeekableBuffer> buffer_;
202 uint32 frames_per_packet_; 202 uint32 frames_per_packet_;
203 203
204 // Allows us to run tasks on the AlsaPcmOutputStream instance which are
205 // bound by its lifetime.
206 base::WeakPtrFactory<AlsaPcmOutputStream> weak_factory_;
207
208 InternalState state_; 204 InternalState state_;
209 float volume_; // Volume level from 0.0 to 1.0. 205 float volume_; // Volume level from 0.0 to 1.0.
210 206
211 AudioSourceCallback* source_callback_; 207 AudioSourceCallback* source_callback_;
212 208
213 // Container for retrieving data from AudioSourceCallback::OnMoreData(). 209 // Container for retrieving data from AudioSourceCallback::OnMoreData().
214 scoped_ptr<AudioBus> audio_bus_; 210 scoped_ptr<AudioBus> audio_bus_;
215 211
216 // Channel mixer and temporary bus for the final mixed channel data. 212 // Channel mixer and temporary bus for the final mixed channel data.
217 scoped_ptr<ChannelMixer> channel_mixer_; 213 scoped_ptr<ChannelMixer> channel_mixer_;
218 scoped_ptr<AudioBus> mixed_audio_bus_; 214 scoped_ptr<AudioBus> mixed_audio_bus_;
219 215
216 // Allows us to run tasks on the AlsaPcmOutputStream instance which are
217 // bound by its lifetime.
218 // NOTE: Weak pointers must be invalidated before all other member variables.
219 base::WeakPtrFactory<AlsaPcmOutputStream> weak_factory_;
220
220 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream); 221 DISALLOW_COPY_AND_ASSIGN(AlsaPcmOutputStream);
221 }; 222 };
222 223
223 MEDIA_EXPORT std::ostream& operator<<(std::ostream& os, 224 MEDIA_EXPORT std::ostream& operator<<(std::ostream& os,
224 AlsaPcmOutputStream::InternalState); 225 AlsaPcmOutputStream::InternalState);
225 226
226 }; // namespace media 227 }; // namespace media
227 228
228 #endif // MEDIA_AUDIO_ALSA_ALSA_OUTPUT_H_ 229 #endif // MEDIA_AUDIO_ALSA_ALSA_OUTPUT_H_
OLDNEW
« no previous file with comments | « media/audio/alsa/alsa_input.cc ('k') | media/audio/alsa/alsa_output.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698