OLD | NEW |
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/filters/skcanvas_video_renderer.h" | 14 #include "media/filters/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 "url/gurl.h" | 17 #include "url/gurl.h" |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 class WebFrame; | 20 class WebFrame; |
21 class WebMediaPlayerClient; | 21 class WebMediaPlayerClient; |
22 } | 22 } |
23 | 23 |
24 namespace media { | 24 namespace media { |
25 class MediaLog; | 25 class MediaLog; |
| 26 class WebMediaPlayerDelegate; |
26 } | 27 } |
27 | 28 |
28 namespace cc_blink { | 29 namespace cc_blink { |
29 class WebLayerImpl; | 30 class WebLayerImpl; |
30 } | 31 } |
31 | 32 |
32 namespace content { | 33 namespace content { |
33 class MediaStreamAudioRenderer; | 34 class MediaStreamAudioRenderer; |
34 class MediaStreamRendererFactory; | 35 class MediaStreamRendererFactory; |
35 class VideoFrameProvider; | 36 class VideoFrameProvider; |
36 class WebMediaPlayerDelegate; | |
37 | 37 |
38 // WebMediaPlayerMS delegates calls from WebCore::MediaPlayerPrivate to | 38 // WebMediaPlayerMS delegates calls from WebCore::MediaPlayerPrivate to |
39 // Chrome's media player when "src" is from media stream. | 39 // Chrome's media player when "src" is from media stream. |
40 // | 40 // |
41 // WebMediaPlayerMS works with multiple objects, the most important ones are: | 41 // WebMediaPlayerMS works with multiple objects, the most important ones are: |
42 // | 42 // |
43 // VideoFrameProvider | 43 // VideoFrameProvider |
44 // provides video frames for rendering. | 44 // provides video frames for rendering. |
45 // | 45 // |
46 // TODO(wjia): add AudioPlayer. | 46 // TODO(wjia): add AudioPlayer. |
47 // AudioPlayer | 47 // AudioPlayer |
48 // plays audio streams. | 48 // plays audio streams. |
49 // | 49 // |
50 // blink::WebMediaPlayerClient | 50 // blink::WebMediaPlayerClient |
51 // WebKit client of this media player object. | 51 // WebKit client of this media player object. |
52 class WebMediaPlayerMS | 52 class WebMediaPlayerMS |
53 : public blink::WebMediaPlayer, | 53 : public blink::WebMediaPlayer, |
54 public cc::VideoFrameProvider, | 54 public cc::VideoFrameProvider, |
55 public base::SupportsWeakPtr<WebMediaPlayerMS> { | 55 public base::SupportsWeakPtr<WebMediaPlayerMS> { |
56 public: | 56 public: |
57 // Construct a WebMediaPlayerMS with reference to the client, and | 57 // Construct a WebMediaPlayerMS with reference to the client, and |
58 // a MediaStreamClient which provides VideoFrameProvider. | 58 // a MediaStreamClient which provides VideoFrameProvider. |
59 WebMediaPlayerMS(blink::WebFrame* frame, | 59 WebMediaPlayerMS(blink::WebFrame* frame, |
60 blink::WebMediaPlayerClient* client, | 60 blink::WebMediaPlayerClient* client, |
61 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 61 base::WeakPtr<media::WebMediaPlayerDelegate> delegate, |
62 media::MediaLog* media_log, | 62 media::MediaLog* media_log, |
63 scoped_ptr<MediaStreamRendererFactory> factory); | 63 scoped_ptr<MediaStreamRendererFactory> factory); |
64 virtual ~WebMediaPlayerMS(); | 64 virtual ~WebMediaPlayerMS(); |
65 | 65 |
66 virtual void load(LoadType load_type, | 66 virtual void load(LoadType load_type, |
67 const blink::WebURL& url, | 67 const blink::WebURL& url, |
68 CORSMode cors_mode); | 68 CORSMode cors_mode); |
69 | 69 |
70 // Playback controls. | 70 // Playback controls. |
71 virtual void play(); | 71 virtual void play(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 blink::WebTimeRanges buffered_; | 149 blink::WebTimeRanges buffered_; |
150 | 150 |
151 float volume_; | 151 float volume_; |
152 | 152 |
153 // Used for DCHECKs to ensure methods calls executed in the correct thread. | 153 // Used for DCHECKs to ensure methods calls executed in the correct thread. |
154 base::ThreadChecker thread_checker_; | 154 base::ThreadChecker thread_checker_; |
155 | 155 |
156 blink::WebMediaPlayerClient* client_; | 156 blink::WebMediaPlayerClient* client_; |
157 | 157 |
158 base::WeakPtr<WebMediaPlayerDelegate> delegate_; | 158 base::WeakPtr<media::WebMediaPlayerDelegate> delegate_; |
159 | 159 |
160 // Specify content:: to disambiguate from cc::. | 160 // Specify content:: to disambiguate from cc::. |
161 scoped_refptr<content::VideoFrameProvider> video_frame_provider_; | 161 scoped_refptr<content::VideoFrameProvider> video_frame_provider_; |
162 bool paused_; | 162 bool paused_; |
163 | 163 |
164 // |current_frame_| is updated only on main thread. The object it holds | 164 // |current_frame_| is updated only on main thread. The object it holds |
165 // can be freed on the compositor thread if it is the last to hold a | 165 // can be freed on the compositor thread if it is the last to hold a |
166 // reference but media::VideoFrame is a thread-safe ref-pointer. It is | 166 // reference but media::VideoFrame is a thread-safe ref-pointer. It is |
167 // however read on the compositing thread so locking is required around all | 167 // however read on the compositing thread so locking is required around all |
168 // modifications on the main thread, and all reads on the compositing thread. | 168 // modifications on the main thread, and all reads on the compositing thread. |
(...skipping 23 matching lines...) Expand all Loading... |
192 scoped_refptr<media::MediaLog> media_log_; | 192 scoped_refptr<media::MediaLog> media_log_; |
193 | 193 |
194 scoped_ptr<MediaStreamRendererFactory> renderer_factory_; | 194 scoped_ptr<MediaStreamRendererFactory> renderer_factory_; |
195 | 195 |
196 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); | 196 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); |
197 }; | 197 }; |
198 | 198 |
199 } // namespace content | 199 } // namespace content |
200 | 200 |
201 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ | 201 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ |
OLD | NEW |