| 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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 namespace media { | 24 namespace media { |
| 25 class MediaLog; | 25 class MediaLog; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace webkit { | 28 namespace webkit { |
| 29 class WebLayerImpl; | 29 class WebLayerImpl; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace content { | 32 namespace content { |
| 33 class MediaStreamAudioRenderer; | 33 class MediaStreamAudioRenderer; |
| 34 class MediaStreamClient; | 34 class MediaStreamRendererFactory; |
| 35 class VideoFrameProvider; | 35 class VideoFrameProvider; |
| 36 class WebMediaPlayerDelegate; | 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<WebMediaPlayerDelegate> delegate, |
| 62 MediaStreamClient* media_stream_client, | 62 media::MediaLog* media_log, |
| 63 media::MediaLog* media_log); | 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(); |
| 72 virtual void pause(); | 72 virtual void pause(); |
| 73 virtual bool supportsSave() const; | 73 virtual bool supportsSave() const; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 blink::WebTimeRanges buffered_; | 145 blink::WebTimeRanges buffered_; |
| 146 | 146 |
| 147 // Used for DCHECKs to ensure methods calls executed in the correct thread. | 147 // Used for DCHECKs to ensure methods calls executed in the correct thread. |
| 148 base::ThreadChecker thread_checker_; | 148 base::ThreadChecker thread_checker_; |
| 149 | 149 |
| 150 blink::WebMediaPlayerClient* client_; | 150 blink::WebMediaPlayerClient* client_; |
| 151 | 151 |
| 152 base::WeakPtr<WebMediaPlayerDelegate> delegate_; | 152 base::WeakPtr<WebMediaPlayerDelegate> delegate_; |
| 153 | 153 |
| 154 MediaStreamClient* media_stream_client_; | |
| 155 | |
| 156 // Specify content:: to disambiguate from cc::. | 154 // Specify content:: to disambiguate from cc::. |
| 157 scoped_refptr<content::VideoFrameProvider> video_frame_provider_; | 155 scoped_refptr<content::VideoFrameProvider> video_frame_provider_; |
| 158 bool paused_; | 156 bool paused_; |
| 159 | 157 |
| 160 // |current_frame_| is updated only on main thread. The object it holds | 158 // |current_frame_| is updated only on main thread. The object it holds |
| 161 // can be freed on the compositor thread if it is the last to hold a | 159 // can be freed on the compositor thread if it is the last to hold a |
| 162 // reference but media::VideoFrame is a thread-safe ref-pointer. It is | 160 // reference but media::VideoFrame is a thread-safe ref-pointer. It is |
| 163 // however read on the compositing thread so locking is required around all | 161 // however read on the compositing thread so locking is required around all |
| 164 // modifications on the main thread, and all reads on the compositing thread. | 162 // modifications on the main thread, and all reads on the compositing thread. |
| 165 scoped_refptr<media::VideoFrame> current_frame_; | 163 scoped_refptr<media::VideoFrame> current_frame_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 182 base::TimeDelta start_time_; | 180 base::TimeDelta start_time_; |
| 183 base::TimeDelta current_time_; | 181 base::TimeDelta current_time_; |
| 184 unsigned total_frame_count_; | 182 unsigned total_frame_count_; |
| 185 unsigned dropped_frame_count_; | 183 unsigned dropped_frame_count_; |
| 186 media::SkCanvasVideoRenderer video_renderer_; | 184 media::SkCanvasVideoRenderer video_renderer_; |
| 187 | 185 |
| 188 scoped_refptr<MediaStreamAudioRenderer> audio_renderer_; | 186 scoped_refptr<MediaStreamAudioRenderer> audio_renderer_; |
| 189 | 187 |
| 190 scoped_refptr<media::MediaLog> media_log_; | 188 scoped_refptr<media::MediaLog> media_log_; |
| 191 | 189 |
| 190 scoped_ptr<MediaStreamRendererFactory> renderer_factory_; |
| 191 |
| 192 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); | 192 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerMS); |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 } // namespace content | 195 } // namespace content |
| 196 | 196 |
| 197 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ | 197 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_MS_H_ |
| OLD | NEW |