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

Side by Side Diff: content/renderer/media/audio_device.h

Issue 9805001: Move media/audio files into media namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « content/common/media/audio_param_traits.cc ('k') | content/renderer/media/audio_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 // Audio rendering unit utilizing audio output stream provided by browser 5 // Audio rendering unit utilizing audio output stream provided by browser
6 // process through IPC. 6 // process through IPC.
7 // 7 //
8 // Relationship of classes. 8 // Relationship of classes.
9 // 9 //
10 // AudioOutputController AudioDevice 10 // AudioOutputController AudioDevice
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #include "base/memory/scoped_ptr.h" 69 #include "base/memory/scoped_ptr.h"
70 #include "base/message_loop.h" 70 #include "base/message_loop.h"
71 #include "base/shared_memory.h" 71 #include "base/shared_memory.h"
72 #include "content/common/content_export.h" 72 #include "content/common/content_export.h"
73 #include "content/renderer/media/audio_device_thread.h" 73 #include "content/renderer/media/audio_device_thread.h"
74 #include "content/renderer/media/audio_message_filter.h" 74 #include "content/renderer/media/audio_message_filter.h"
75 #include "content/renderer/media/scoped_loop_observer.h" 75 #include "content/renderer/media/scoped_loop_observer.h"
76 #include "media/audio/audio_parameters.h" 76 #include "media/audio/audio_parameters.h"
77 #include "media/base/audio_renderer_sink.h" 77 #include "media/base/audio_renderer_sink.h"
78 78
79 namespace media {
80 class AudioParameters;
81 }
82
79 class CONTENT_EXPORT AudioDevice 83 class CONTENT_EXPORT AudioDevice
80 : NON_EXPORTED_BASE(public media::AudioRendererSink), 84 : NON_EXPORTED_BASE(public media::AudioRendererSink),
81 public AudioMessageFilter::Delegate, 85 public AudioMessageFilter::Delegate,
82 NON_EXPORTED_BASE(public ScopedLoopObserver) { 86 NON_EXPORTED_BASE(public ScopedLoopObserver) {
83 public: 87 public:
84 // Methods called on main render thread ------------------------------------- 88 // Methods called on main render thread -------------------------------------
85 89
86 // Minimal constructor where Initialize() must be called later. 90 // Minimal constructor where Initialize() must be called later.
87 AudioDevice(); 91 AudioDevice();
88 92
89 AudioDevice(const AudioParameters& params, RenderCallback* callback); 93 AudioDevice(const media::AudioParameters& params, RenderCallback* callback);
90 94
91 // AudioRendererSink implementation. 95 // AudioRendererSink implementation.
92 96
93 virtual void Initialize(const AudioParameters& params, 97 virtual void Initialize(const media::AudioParameters& params,
94 RenderCallback* callback) OVERRIDE; 98 RenderCallback* callback) OVERRIDE;
95 // Starts audio playback. 99 // Starts audio playback.
96 virtual void Start() OVERRIDE; 100 virtual void Start() OVERRIDE;
97 101
98 // Stops audio playback. 102 // Stops audio playback.
99 virtual void Stop() OVERRIDE; 103 virtual void Stop() OVERRIDE;
100 104
101 // Resumes playback if currently paused. 105 // Resumes playback if currently paused.
102 virtual void Play() OVERRIDE; 106 virtual void Play() OVERRIDE;
103 107
(...skipping 21 matching lines...) Expand all
125 private: 129 private:
126 // Magic required by ref_counted.h to avoid any code deleting the object 130 // Magic required by ref_counted.h to avoid any code deleting the object
127 // accidentally while there are references to it. 131 // accidentally while there are references to it.
128 friend class base::RefCountedThreadSafe<AudioDevice>; 132 friend class base::RefCountedThreadSafe<AudioDevice>;
129 virtual ~AudioDevice(); 133 virtual ~AudioDevice();
130 134
131 // Methods called on IO thread ---------------------------------------------- 135 // Methods called on IO thread ----------------------------------------------
132 // The following methods are tasks posted on the IO thread that needs to 136 // The following methods are tasks posted on the IO thread that needs to
133 // be executed on that thread. They interact with AudioMessageFilter and 137 // be executed on that thread. They interact with AudioMessageFilter and
134 // sends IPC messages on that thread. 138 // sends IPC messages on that thread.
135 void InitializeOnIOThread(const AudioParameters& params); 139 void InitializeOnIOThread(const media::AudioParameters& params);
136 void PlayOnIOThread(); 140 void PlayOnIOThread();
137 void PauseOnIOThread(bool flush); 141 void PauseOnIOThread(bool flush);
138 void ShutDownOnIOThread(); 142 void ShutDownOnIOThread();
139 void SetVolumeOnIOThread(double volume); 143 void SetVolumeOnIOThread(double volume);
140 144
141 void Send(IPC::Message* message); 145 void Send(IPC::Message* message);
142 146
143 // MessageLoop::DestructionObserver implementation for the IO loop. 147 // MessageLoop::DestructionObserver implementation for the IO loop.
144 // If the IO loop dies before we do, we shut down the audio thread from here. 148 // If the IO loop dies before we do, we shut down the audio thread from here.
145 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; 149 virtual void WillDestroyCurrentMessageLoop() OVERRIDE;
146 150
147 AudioParameters audio_parameters_; 151 media::AudioParameters audio_parameters_;
148 152
149 RenderCallback* callback_; 153 RenderCallback* callback_;
150 154
151 // The current volume scaling [0.0, 1.0] of the audio stream. 155 // The current volume scaling [0.0, 1.0] of the audio stream.
152 double volume_; 156 double volume_;
153 157
154 // Cached audio message filter (lives on the main render thread). 158 // Cached audio message filter (lives on the main render thread).
155 scoped_refptr<AudioMessageFilter> filter_; 159 scoped_refptr<AudioMessageFilter> filter_;
156 160
157 // Our stream ID on the message filter. Only accessed on the IO thread. 161 // Our stream ID on the message filter. Only accessed on the IO thread.
(...skipping 16 matching lines...) Expand all
174 // guard to control stopping and starting the audio thread. 178 // guard to control stopping and starting the audio thread.
175 base::Lock audio_thread_lock_; 179 base::Lock audio_thread_lock_;
176 AudioDeviceThread audio_thread_; 180 AudioDeviceThread audio_thread_;
177 scoped_ptr<AudioDevice::AudioThreadCallback> audio_callback_; 181 scoped_ptr<AudioDevice::AudioThreadCallback> audio_callback_;
178 182
179 183
180 DISALLOW_COPY_AND_ASSIGN(AudioDevice); 184 DISALLOW_COPY_AND_ASSIGN(AudioDevice);
181 }; 185 };
182 186
183 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_H_ 187 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_H_
OLDNEW
« no previous file with comments | « content/common/media/audio_param_traits.cc ('k') | content/renderer/media/audio_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698