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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "content/public/renderer/render_frame_observer.h" | 16 #include "media/blink/webmediaplayer_delegate.h" |
17 #include "media/blink/webmediaplayer_util.h" | 17 #include "media/blink/webmediaplayer_util.h" |
18 #include "media/renderers/gpu_video_accelerator_factories.h" | 18 #include "media/renderers/gpu_video_accelerator_factories.h" |
19 #include "media/renderers/skcanvas_video_renderer.h" | 19 #include "media/renderers/skcanvas_video_renderer.h" |
20 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 20 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
21 #include "url/origin.h" | 21 #include "url/origin.h" |
22 | 22 |
23 namespace blink { | 23 namespace blink { |
24 class WebFrame; | 24 class WebFrame; |
25 class WebGraphicsContext3D; | 25 class WebGraphicsContext3D; |
26 class WebMediaPlayerClient; | 26 class WebMediaPlayerClient; |
27 class WebSecurityOrigin; | 27 class WebSecurityOrigin; |
28 class WebString; | 28 class WebString; |
29 } | 29 } |
30 | 30 |
31 namespace media { | 31 namespace media { |
32 class MediaLog; | 32 class MediaLog; |
33 class WebMediaPlayerDelegate; | |
34 class VideoFrame; | 33 class VideoFrame; |
35 } | 34 } |
36 | 35 |
37 namespace cc_blink { | 36 namespace cc_blink { |
38 class WebLayerImpl; | 37 class WebLayerImpl; |
39 } | 38 } |
40 | 39 |
41 namespace content { | 40 namespace content { |
42 class MediaStreamAudioRenderer; | 41 class MediaStreamAudioRenderer; |
43 class MediaStreamRendererFactory; | 42 class MediaStreamRendererFactory; |
44 class VideoFrameProvider; | 43 class VideoFrameProvider; |
45 class WebMediaPlayerMSCompositor; | 44 class WebMediaPlayerMSCompositor; |
46 class RenderFrameObserver; | 45 class RenderFrameObserver; |
47 | 46 |
48 // WebMediaPlayerMS delegates calls from WebCore::MediaPlayerPrivate to | 47 // WebMediaPlayerMS delegates calls from WebCore::MediaPlayerPrivate to |
49 // Chrome's media player when "src" is from media stream. | 48 // Chrome's media player when "src" is from media stream. |
50 // | 49 // |
51 // All calls to WebMediaPlayerMS methods must be from the main thread of | 50 // All calls to WebMediaPlayerMS methods must be from the main thread of |
52 // Renderer process. | 51 // Renderer process. |
53 // | 52 // |
54 // WebMediaPlayerMS works with multiple objects, the most important ones are: | 53 // WebMediaPlayerMS works with multiple objects, the most important ones are: |
55 // | 54 // |
56 // VideoFrameProvider | 55 // VideoFrameProvider |
57 // provides video frames for rendering. | 56 // provides video frames for rendering. |
58 // | 57 // |
59 // blink::WebMediaPlayerClient | 58 // blink::WebMediaPlayerClient |
60 // WebKit client of this media player object. | 59 // WebKit client of this media player object. |
61 class CONTENT_EXPORT WebMediaPlayerMS | 60 class CONTENT_EXPORT WebMediaPlayerMS |
62 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), | 61 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), |
63 public NON_EXPORTED_BASE(base::SupportsWeakPtr<WebMediaPlayerMS>), | 62 public NON_EXPORTED_BASE(media::WebMediaPlayerDelegate::Observer), |
64 public NON_EXPORTED_BASE(RenderFrameObserver) { | 63 public NON_EXPORTED_BASE(base::SupportsWeakPtr<WebMediaPlayerMS>) { |
65 public: | 64 public: |
66 // Construct a WebMediaPlayerMS with reference to the client, and | 65 // Construct a WebMediaPlayerMS with reference to the client, and |
67 // a MediaStreamClient which provides VideoFrameProvider. | 66 // a MediaStreamClient which provides VideoFrameProvider. |
68 WebMediaPlayerMS( | 67 WebMediaPlayerMS( |
69 blink::WebFrame* frame, | 68 blink::WebFrame* frame, |
70 blink::WebMediaPlayerClient* client, | 69 blink::WebMediaPlayerClient* client, |
71 base::WeakPtr<media::WebMediaPlayerDelegate> delegate, | 70 base::WeakPtr<media::WebMediaPlayerDelegate> delegate, |
72 media::MediaLog* media_log, | 71 media::MediaLog* media_log, |
73 scoped_ptr<MediaStreamRendererFactory> factory, | 72 scoped_ptr<MediaStreamRendererFactory> factory, |
74 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, | 73 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 bool hasSingleSecurityOrigin() const override; | 127 bool hasSingleSecurityOrigin() const override; |
129 bool didPassCORSAccessCheck() const override; | 128 bool didPassCORSAccessCheck() const override; |
130 | 129 |
131 double mediaTimeForTimeValue(double timeValue) const override; | 130 double mediaTimeForTimeValue(double timeValue) const override; |
132 | 131 |
133 unsigned decodedFrameCount() const override; | 132 unsigned decodedFrameCount() const override; |
134 unsigned droppedFrameCount() const override; | 133 unsigned droppedFrameCount() const override; |
135 unsigned audioDecodedByteCount() const override; | 134 unsigned audioDecodedByteCount() const override; |
136 unsigned videoDecodedByteCount() const override; | 135 unsigned videoDecodedByteCount() const override; |
137 | 136 |
138 // RenderFrameObserver implementation. Called when the RenderFrame visiblity | 137 // WebMediaPlayerDelegate::Observer implementation. |
139 // is changed. | 138 void OnHidden() override; |
140 void WasHidden() override; | 139 void OnShown() override; |
141 void WasShown() override; | 140 void OnPlay() override; |
| 141 void OnPause() override; |
| 142 void OnVolumeMultiplierUpdate(double multiplier) override; |
142 | 143 |
143 bool copyVideoTextureToPlatformTexture( | 144 bool copyVideoTextureToPlatformTexture( |
144 blink::WebGraphicsContext3D* web_graphics_context, | 145 blink::WebGraphicsContext3D* web_graphics_context, |
145 unsigned int texture, | 146 unsigned int texture, |
146 unsigned int internal_format, | 147 unsigned int internal_format, |
147 unsigned int type, | 148 unsigned int type, |
148 bool premultiply_alpha, | 149 bool premultiply_alpha, |
149 bool flip_y) override; | 150 bool flip_y) override; |
150 | 151 |
151 private: | 152 private: |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 204 |
204 // WebMediaPlayerMS owns |compositor_| and destroys it on | 205 // WebMediaPlayerMS owns |compositor_| and destroys it on |
205 // |compositor_task_runner_|. | 206 // |compositor_task_runner_|. |
206 scoped_ptr<WebMediaPlayerMSCompositor> compositor_; | 207 scoped_ptr<WebMediaPlayerMSCompositor> compositor_; |
207 | 208 |
208 const scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 209 const scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
209 | 210 |
210 const std::string initial_audio_output_device_id_; | 211 const std::string initial_audio_output_device_id_; |
211 const url::Origin initial_security_origin_; | 212 const url::Origin initial_security_origin_; |
212 | 213 |
| 214 double volume_; |
| 215 double volume_multiplier_; |
| 216 |
213 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); | 217 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); |
214 }; | 218 }; |
215 | 219 |
216 } // namespace content | 220 } // namespace content |
217 | 221 |
218 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ | 222 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ |
OLD | NEW |