| 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
| 14 #include "content/common/content_export.h" |
| 14 #include "content/public/renderer/render_frame_observer.h" | 15 #include "content/public/renderer/render_frame_observer.h" |
| 15 #include "media/blink/webmediaplayer_util.h" | 16 #include "media/blink/webmediaplayer_util.h" |
| 16 #include "media/renderers/gpu_video_accelerator_factories.h" | 17 #include "media/renderers/gpu_video_accelerator_factories.h" |
| 17 #include "media/renderers/skcanvas_video_renderer.h" | 18 #include "media/renderers/skcanvas_video_renderer.h" |
| 18 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 19 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 19 #include "url/origin.h" | 20 #include "url/origin.h" |
| 20 | 21 |
| 21 namespace blink { | 22 namespace blink { |
| 22 class WebFrame; | 23 class WebFrame; |
| 23 class WebGraphicsContext3D; | 24 class WebGraphicsContext3D; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 49 // 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 |
| 50 // Renderer process. | 51 // Renderer process. |
| 51 // | 52 // |
| 52 // WebMediaPlayerMS works with multiple objects, the most important ones are: | 53 // WebMediaPlayerMS works with multiple objects, the most important ones are: |
| 53 // | 54 // |
| 54 // VideoFrameProvider | 55 // VideoFrameProvider |
| 55 // provides video frames for rendering. | 56 // provides video frames for rendering. |
| 56 // | 57 // |
| 57 // blink::WebMediaPlayerClient | 58 // blink::WebMediaPlayerClient |
| 58 // WebKit client of this media player object. | 59 // WebKit client of this media player object. |
| 59 class WebMediaPlayerMS | 60 class CONTENT_EXPORT WebMediaPlayerMS |
| 60 : public blink::WebMediaPlayer, | 61 : public NON_EXPORTED_BASE(blink::WebMediaPlayer), |
| 61 public base::SupportsWeakPtr<WebMediaPlayerMS>, | 62 public NON_EXPORTED_BASE(base::SupportsWeakPtr<WebMediaPlayerMS>), |
| 62 public RenderFrameObserver { | 63 public NON_EXPORTED_BASE(RenderFrameObserver) { |
| 63 public: | 64 public: |
| 64 // Construct a WebMediaPlayerMS with reference to the client, and | 65 // Construct a WebMediaPlayerMS with reference to the client, and |
| 65 // a MediaStreamClient which provides VideoFrameProvider. | 66 // a MediaStreamClient which provides VideoFrameProvider. |
| 66 WebMediaPlayerMS( | 67 WebMediaPlayerMS( |
| 67 blink::WebFrame* frame, | 68 blink::WebFrame* frame, |
| 68 blink::WebMediaPlayerClient* client, | 69 blink::WebMediaPlayerClient* client, |
| 69 base::WeakPtr<media::WebMediaPlayerDelegate> delegate, | 70 base::WeakPtr<media::WebMediaPlayerDelegate> delegate, |
| 70 media::MediaLog* media_log, | 71 media::MediaLog* media_log, |
| 71 scoped_ptr<MediaStreamRendererFactory> factory, | 72 scoped_ptr<MediaStreamRendererFactory> factory, |
| 72 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, | 73 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 141 |
| 141 bool copyVideoTextureToPlatformTexture( | 142 bool copyVideoTextureToPlatformTexture( |
| 142 blink::WebGraphicsContext3D* web_graphics_context, | 143 blink::WebGraphicsContext3D* web_graphics_context, |
| 143 unsigned int texture, | 144 unsigned int texture, |
| 144 unsigned int internal_format, | 145 unsigned int internal_format, |
| 145 unsigned int type, | 146 unsigned int type, |
| 146 bool premultiply_alpha, | 147 bool premultiply_alpha, |
| 147 bool flip_y) override; | 148 bool flip_y) override; |
| 148 | 149 |
| 149 private: | 150 private: |
| 151 friend class WebMediaPlayerMSTest; |
| 152 |
| 150 // The callback for VideoFrameProvider to signal a new frame is available. | 153 // The callback for VideoFrameProvider to signal a new frame is available. |
| 151 void OnFrameAvailable(const scoped_refptr<media::VideoFrame>& frame); | 154 void OnFrameAvailable(const scoped_refptr<media::VideoFrame>& frame); |
| 152 // Need repaint due to state change. | 155 // Need repaint due to state change. |
| 153 void RepaintInternal(); | 156 void RepaintInternal(); |
| 154 | 157 |
| 155 // The callback for source to report error. | 158 // The callback for source to report error. |
| 156 void OnSourceError(); | 159 void OnSourceError(); |
| 157 | 160 |
| 158 // Helpers that set the network/ready state and notifies the client if | 161 // Helpers that set the network/ready state and notifies the client if |
| 159 // they've changed. | 162 // they've changed. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 208 |
| 206 const std::string initial_audio_output_device_id_; | 209 const std::string initial_audio_output_device_id_; |
| 207 const url::Origin initial_security_origin_; | 210 const url::Origin initial_security_origin_; |
| 208 | 211 |
| 209 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); | 212 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); |
| 210 }; | 213 }; |
| 211 | 214 |
| 212 } // namespace content | 215 } // namespace content |
| 213 | 216 |
| 214 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ | 217 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ |
| OLD | NEW |