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

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

Issue 10835025: Plumb render view ID to media observer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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/public/browser/media_observer.h ('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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #include "content/renderer/media/scoped_loop_observer.h" 74 #include "content/renderer/media/scoped_loop_observer.h"
75 #include "media/audio/audio_parameters.h" 75 #include "media/audio/audio_parameters.h"
76 #include "media/base/audio_renderer_sink.h" 76 #include "media/base/audio_renderer_sink.h"
77 77
78 namespace media { 78 namespace media {
79 class AudioParameters; 79 class AudioParameters;
80 } 80 }
81 81
82 namespace content { 82 namespace content {
83 class AudioDeviceFactory; 83 class AudioDeviceFactory;
84 class RenderView;
84 } 85 }
85 86
86 class CONTENT_EXPORT AudioDevice 87 class CONTENT_EXPORT AudioDevice
87 : NON_EXPORTED_BASE(public media::AudioRendererSink), 88 : NON_EXPORTED_BASE(public media::AudioRendererSink),
88 public AudioMessageFilter::Delegate, 89 public AudioMessageFilter::Delegate,
89 NON_EXPORTED_BASE(public ScopedLoopObserver) { 90 NON_EXPORTED_BASE(public ScopedLoopObserver) {
90 public: 91 public:
91 // Methods called on main render thread ------------------------------------- 92 // Methods called on main render thread -------------------------------------
92 93
93 // AudioRendererSink implementation. 94 // AudioRendererSink implementation.
(...skipping 15 matching lines...) Expand all
109 protected: 110 protected:
110 friend class content::AudioDeviceFactory; 111 friend class content::AudioDeviceFactory;
111 112
112 // Creates an uninitialized AudioDevice. Clients must call Initialize() 113 // Creates an uninitialized AudioDevice. Clients must call Initialize()
113 // before using. The constructor is protected to ensure that the 114 // before using. The constructor is protected to ensure that the
114 // AudioDeviceFactory is always used for construction in Chrome. 115 // AudioDeviceFactory is always used for construction in Chrome.
115 // Tests should use a test class that inherits from AudioDevice to gain 116 // Tests should use a test class that inherits from AudioDevice to gain
116 // access to the constructor. 117 // access to the constructor.
117 // TODO(tommi): When all dependencies on |content| have been removed 118 // TODO(tommi): When all dependencies on |content| have been removed
118 // from AudioDevice, move this class over to media/audio. 119 // from AudioDevice, move this class over to media/audio.
119 explicit AudioDevice(const scoped_refptr<base::MessageLoopProxy>& io_loop); 120 AudioDevice(content::RenderView* render_view,
121 const scoped_refptr<base::MessageLoopProxy>& io_loop);
120 122
121 // Magic required by ref_counted.h to avoid any code deleting the object 123 // Magic required by ref_counted.h to avoid any code deleting the object
122 // accidentally while there are references to it. 124 // accidentally while there are references to it.
123 friend class base::RefCountedThreadSafe<AudioDevice>; 125 friend class base::RefCountedThreadSafe<AudioDevice>;
124 virtual ~AudioDevice(); 126 virtual ~AudioDevice();
125 127
126 private: 128 private:
127 // Methods called on IO thread ---------------------------------------------- 129 // Methods called on IO thread ----------------------------------------------
128 // The following methods are tasks posted on the IO thread that needs to 130 // The following methods are tasks posted on the IO thread that needs to
129 // be executed on that thread. They interact with AudioMessageFilter and 131 // be executed on that thread. They interact with AudioMessageFilter and
130 // sends IPC messages on that thread. 132 // sends IPC messages on that thread.
131 void CreateStreamOnIOThread(const media::AudioParameters& params); 133 void CreateStreamOnIOThread(const media::AudioParameters& params);
132 void PlayOnIOThread(); 134 void PlayOnIOThread();
133 void PauseOnIOThread(bool flush); 135 void PauseOnIOThread(bool flush);
134 void ShutDownOnIOThread(); 136 void ShutDownOnIOThread();
135 void SetVolumeOnIOThread(double volume); 137 void SetVolumeOnIOThread(double volume);
136 138
137 void Send(IPC::Message* message); 139 void Send(IPC::Message* message);
138 140
139 // MessageLoop::DestructionObserver implementation for the IO loop. 141 // MessageLoop::DestructionObserver implementation for the IO loop.
140 // If the IO loop dies before we do, we shut down the audio thread from here. 142 // If the IO loop dies before we do, we shut down the audio thread from here.
141 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; 143 virtual void WillDestroyCurrentMessageLoop() OVERRIDE;
142 144
145 content::RenderView* render_view_;
146
143 media::AudioParameters audio_parameters_; 147 media::AudioParameters audio_parameters_;
144 148
145 RenderCallback* callback_; 149 RenderCallback* callback_;
146 150
147 // Cached audio message filter (lives on the main render thread). 151 // Cached audio message filter (lives on the main render thread).
148 scoped_refptr<AudioMessageFilter> filter_; 152 scoped_refptr<AudioMessageFilter> filter_;
149 153
150 // Our stream ID on the message filter. Only accessed on the IO thread. 154 // Our stream ID on the message filter. Only accessed on the IO thread.
151 // Must only be modified on the IO thread. 155 // Must only be modified on the IO thread.
152 int32 stream_id_; 156 int32 stream_id_;
(...skipping 14 matching lines...) Expand all
167 // guard to control stopping and starting the audio thread. 171 // guard to control stopping and starting the audio thread.
168 base::Lock audio_thread_lock_; 172 base::Lock audio_thread_lock_;
169 AudioDeviceThread audio_thread_; 173 AudioDeviceThread audio_thread_;
170 scoped_ptr<AudioDevice::AudioThreadCallback> audio_callback_; 174 scoped_ptr<AudioDevice::AudioThreadCallback> audio_callback_;
171 175
172 176
173 DISALLOW_COPY_AND_ASSIGN(AudioDevice); 177 DISALLOW_COPY_AND_ASSIGN(AudioDevice);
174 }; 178 };
175 179
176 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_H_ 180 #endif // CONTENT_RENDERER_MEDIA_AUDIO_DEVICE_H_
OLDNEW
« no previous file with comments | « content/public/browser/media_observer.h ('k') | content/renderer/media/audio_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698