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

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

Issue 1122393004: Add support for switching the audio output device for HTMLMediaElements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes to MediaPlayers so that they invoke callbacks in the correct threads. First complete implem… Created 5 years, 6 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 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 #ifndef CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_
6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ 6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
12 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
13 #include "cc/layers/video_frame_provider.h" 13 #include "cc/layers/video_frame_provider.h"
14 #include "media/blink/skcanvas_video_renderer.h" 14 #include "media/blink/skcanvas_video_renderer.h"
15 #include "skia/ext/platform_canvas.h" 15 #include "skia/ext/platform_canvas.h"
16 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" 16 #include "third_party/WebKit/public/platform/WebMediaPlayer.h"
17 #include "third_party/WebKit/public/platform/WebSetAudioOutputDeviceRequest.h"
17 #include "url/gurl.h" 18 #include "url/gurl.h"
18 19
19 namespace blink { 20 namespace blink {
20 class WebFrame; 21 class WebFrame;
21 class WebGraphicsContext3D; 22 class WebGraphicsContext3D;
22 class WebMediaPlayerClient; 23 class WebMediaPlayerClient;
23 } 24 }
24 25
25 namespace media { 26 namespace media {
26 class MediaLog; 27 class MediaLog;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 const blink::WebURL& url, 69 const blink::WebURL& url,
69 CORSMode cors_mode); 70 CORSMode cors_mode);
70 71
71 // Playback controls. 72 // Playback controls.
72 virtual void play(); 73 virtual void play();
73 virtual void pause(); 74 virtual void pause();
74 virtual bool supportsSave() const; 75 virtual bool supportsSave() const;
75 virtual void seek(double seconds); 76 virtual void seek(double seconds);
76 virtual void setRate(double rate); 77 virtual void setRate(double rate);
77 virtual void setVolume(double volume); 78 virtual void setVolume(double volume);
79 virtual void setAudioOutputDevice(
80 const blink::WebSetAudioOutputDeviceRequest& request);
78 virtual void setPreload(blink::WebMediaPlayer::Preload preload); 81 virtual void setPreload(blink::WebMediaPlayer::Preload preload);
79 virtual blink::WebTimeRanges buffered() const; 82 virtual blink::WebTimeRanges buffered() const;
80 virtual blink::WebTimeRanges seekable() const; 83 virtual blink::WebTimeRanges seekable() const;
81 84
82 // Methods for painting. 85 // Methods for painting.
83 virtual void paint(blink::WebCanvas* canvas, 86 virtual void paint(blink::WebCanvas* canvas,
84 const blink::WebRect& rect, 87 const blink::WebRect& rect,
85 unsigned char alpha, 88 unsigned char alpha,
86 SkXfermode::Mode mode); 89 SkXfermode::Mode mode);
87 90
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void OnSourceError(); 152 void OnSourceError();
150 153
151 // Helpers that set the network/ready state and notifies the client if 154 // Helpers that set the network/ready state and notifies the client if
152 // they've changed. 155 // they've changed.
153 void SetNetworkState(blink::WebMediaPlayer::NetworkState state); 156 void SetNetworkState(blink::WebMediaPlayer::NetworkState state);
154 void SetReadyState(blink::WebMediaPlayer::ReadyState state); 157 void SetReadyState(blink::WebMediaPlayer::ReadyState state);
155 158
156 // Getter method to |client_|. 159 // Getter method to |client_|.
157 blink::WebMediaPlayerClient* GetClient(); 160 blink::WebMediaPlayerClient* GetClient();
158 161
159 blink::WebFrame* frame_; 162 static void PrepareFinishSetAudioOutputRequest(
163 WebMediaPlayerMS* media_player,
164 const scoped_refptr<base::SingleThreadTaskRunner> task_runner,
165 blink::WebSetAudioOutputDeviceRequest* request,
166 int result);
167 void FinishSetAudioOutputRequest(
168 blink::WebSetAudioOutputDeviceRequest *request,
169 int result);
170
171 blink::WebFrame* frame_;
160 172
161 blink::WebMediaPlayer::NetworkState network_state_; 173 blink::WebMediaPlayer::NetworkState network_state_;
162 blink::WebMediaPlayer::ReadyState ready_state_; 174 blink::WebMediaPlayer::ReadyState ready_state_;
163 175
164 blink::WebTimeRanges buffered_; 176 blink::WebTimeRanges buffered_;
165 177
166 float volume_; 178 float volume_;
167 179
168 // Used for DCHECKs to ensure methods calls executed in the correct thread. 180 // Task runner for posting tasks on Chrome's main thread. Also used
169 base::ThreadChecker thread_checker_; 181 // for DCHECKs so methods calls won't execute in the wrong thread.
182 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
170 183
171 blink::WebMediaPlayerClient* client_; 184 blink::WebMediaPlayerClient* client_;
172 185
173 base::WeakPtr<media::WebMediaPlayerDelegate> delegate_; 186 base::WeakPtr<media::WebMediaPlayerDelegate> delegate_;
174 187
175 // Specify content:: to disambiguate from cc::. 188 // Specify content:: to disambiguate from cc::.
176 scoped_refptr<content::VideoFrameProvider> video_frame_provider_; 189 scoped_refptr<content::VideoFrameProvider> video_frame_provider_;
177 bool paused_; 190 bool paused_;
178 191
179 // |current_frame_| is updated only on main thread. The object it holds 192 // |current_frame_| is updated only on main thread. The object it holds
(...skipping 27 matching lines...) Expand all
207 scoped_refptr<media::MediaLog> media_log_; 220 scoped_refptr<media::MediaLog> media_log_;
208 221
209 scoped_ptr<MediaStreamRendererFactory> renderer_factory_; 222 scoped_ptr<MediaStreamRendererFactory> renderer_factory_;
210 223
211 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); 224 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS);
212 }; 225 };
213 226
214 } // namespace content 227 } // namespace content
215 228
216 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ 229 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698