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_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
| 16 #include "content/common/content_export.h" |
| 17 #include "content/renderer/media/buffered_data_source.h" |
16 #include "content/renderer/media/crypto/proxy_decryptor.h" | 18 #include "content/renderer/media/crypto/proxy_decryptor.h" |
17 #include "content/renderer/media/video_frame_compositor.h" | 19 #include "content/renderer/media/video_frame_compositor.h" |
18 #include "media/base/audio_renderer_sink.h" | 20 #include "media/base/audio_renderer_sink.h" |
19 #include "media/base/decryptor.h" | 21 #include "media/base/decryptor.h" |
20 // TODO(xhwang): Remove when we remove prefixed EME implementation. | 22 // TODO(xhwang): Remove when we remove prefixed EME implementation. |
21 #include "media/base/media_keys.h" | 23 #include "media/base/media_keys.h" |
22 #include "media/base/pipeline.h" | 24 #include "media/base/pipeline.h" |
23 #include "media/base/text_track.h" | 25 #include "media/base/text_track.h" |
24 #include "media/filters/skcanvas_video_renderer.h" | 26 #include "media/filters/skcanvas_video_renderer.h" |
25 #include "skia/ext/platform_canvas.h" | 27 #include "skia/ext/platform_canvas.h" |
(...skipping 30 matching lines...) Expand all Loading... |
56 class VideoFrameCompositor; | 58 class VideoFrameCompositor; |
57 class WebAudioSourceProviderImpl; | 59 class WebAudioSourceProviderImpl; |
58 class WebContentDecryptionModuleImpl; | 60 class WebContentDecryptionModuleImpl; |
59 class WebMediaPlayerDelegate; | 61 class WebMediaPlayerDelegate; |
60 class WebMediaPlayerParams; | 62 class WebMediaPlayerParams; |
61 class WebTextTrackImpl; | 63 class WebTextTrackImpl; |
62 | 64 |
63 // The canonical implementation of blink::WebMediaPlayer that's backed by | 65 // The canonical implementation of blink::WebMediaPlayer that's backed by |
64 // media::Pipeline. Handles normal resource loading, Media Source, and | 66 // media::Pipeline. Handles normal resource loading, Media Source, and |
65 // Encrypted Media. | 67 // Encrypted Media. |
66 class WebMediaPlayerImpl | 68 class CONTENT_EXPORT WebMediaPlayerImpl |
67 : public blink::WebMediaPlayer, | 69 : public blink::WebMediaPlayer, |
68 public base::SupportsWeakPtr<WebMediaPlayerImpl> { | 70 public base::SupportsWeakPtr<WebMediaPlayerImpl> { |
69 public: | 71 public: |
70 // Constructs a WebMediaPlayer implementation using Chromium's media stack. | 72 // Constructs a WebMediaPlayer implementation using Chromium's media stack. |
71 // |delegate| may be null. | 73 // |delegate| may be null. |
72 WebMediaPlayerImpl(blink::WebLocalFrame* frame, | 74 WebMediaPlayerImpl(blink::WebLocalFrame* frame, |
73 blink::WebMediaPlayerClient* client, | 75 blink::WebMediaPlayerClient* client, |
74 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 76 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
75 const WebMediaPlayerParams& params); | 77 const WebMediaPlayerParams& params); |
76 virtual ~WebMediaPlayerImpl(); | 78 virtual ~WebMediaPlayerImpl(); |
(...skipping 30 matching lines...) Expand all Loading... |
107 virtual bool seeking() const; | 109 virtual bool seeking() const; |
108 virtual double duration() const; | 110 virtual double duration() const; |
109 virtual double currentTime() const; | 111 virtual double currentTime() const; |
110 | 112 |
111 // Internal states of loading and network. | 113 // Internal states of loading and network. |
112 // TODO(hclam): Ask the pipeline about the state rather than having reading | 114 // TODO(hclam): Ask the pipeline about the state rather than having reading |
113 // them from members which would cause race conditions. | 115 // them from members which would cause race conditions. |
114 virtual blink::WebMediaPlayer::NetworkState networkState() const; | 116 virtual blink::WebMediaPlayer::NetworkState networkState() const; |
115 virtual blink::WebMediaPlayer::ReadyState readyState() const; | 117 virtual blink::WebMediaPlayer::ReadyState readyState() const; |
116 | 118 |
| 119 // TODO(sandersd): Change this to non-const in blink::WebMediaPlayer. |
| 120 // http://crbug.com/360251 |
117 virtual bool didLoadingProgress() const; | 121 virtual bool didLoadingProgress() const; |
118 | 122 |
119 virtual bool hasSingleSecurityOrigin() const; | 123 virtual bool hasSingleSecurityOrigin() const; |
120 virtual bool didPassCORSAccessCheck() const; | 124 virtual bool didPassCORSAccessCheck() const; |
121 | 125 |
122 virtual double mediaTimeForTimeValue(double timeValue) const; | 126 virtual double mediaTimeForTimeValue(double timeValue) const; |
123 | 127 |
124 virtual unsigned decodedFrameCount() const; | 128 virtual unsigned decodedFrameCount() const; |
125 virtual unsigned droppedFrameCount() const; | 129 virtual unsigned droppedFrameCount() const; |
126 virtual unsigned audioDecodedByteCount() const; | 130 virtual unsigned audioDecodedByteCount() const; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // If |decryptor_ready_cb| is null, the existing callback will be fired with | 241 // If |decryptor_ready_cb| is null, the existing callback will be fired with |
238 // NULL immediately and reset. | 242 // NULL immediately and reset. |
239 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); | 243 void SetDecryptorReadyCB(const media::DecryptorReadyCB& decryptor_ready_cb); |
240 | 244 |
241 blink::WebLocalFrame* frame_; | 245 blink::WebLocalFrame* frame_; |
242 | 246 |
243 // TODO(hclam): get rid of these members and read from the pipeline directly. | 247 // TODO(hclam): get rid of these members and read from the pipeline directly. |
244 blink::WebMediaPlayer::NetworkState network_state_; | 248 blink::WebMediaPlayer::NetworkState network_state_; |
245 blink::WebMediaPlayer::ReadyState ready_state_; | 249 blink::WebMediaPlayer::ReadyState ready_state_; |
246 | 250 |
247 // Keep a list of buffered time ranges. | |
248 blink::WebTimeRanges buffered_; | |
249 | |
250 // Message loops for posting tasks on Chrome's main thread. Also used | 251 // Message loops for posting tasks on Chrome's main thread. Also used |
251 // for DCHECKs so methods calls won't execute in the wrong thread. | 252 // for DCHECKs so methods calls won't execute in the wrong thread. |
252 const scoped_refptr<base::MessageLoopProxy> main_loop_; | 253 const scoped_refptr<base::MessageLoopProxy> main_loop_; |
253 | 254 |
254 scoped_refptr<base::MessageLoopProxy> media_loop_; | 255 scoped_refptr<base::MessageLoopProxy> media_loop_; |
255 scoped_refptr<media::MediaLog> media_log_; | 256 scoped_refptr<media::MediaLog> media_log_; |
256 media::Pipeline pipeline_; | 257 media::Pipeline pipeline_; |
257 | 258 |
258 // The currently selected key system. Empty string means that no key system | 259 // The currently selected key system. Empty string means that no key system |
259 // has been selected. | 260 // has been selected. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 // These two are mutually exclusive: | 314 // These two are mutually exclusive: |
314 // |data_source_| is used for regular resource loads. | 315 // |data_source_| is used for regular resource loads. |
315 // |chunk_demuxer_| is used for Media Source resource loads. | 316 // |chunk_demuxer_| is used for Media Source resource loads. |
316 // | 317 // |
317 // |demuxer_| will contain the appropriate demuxer based on which resource | 318 // |demuxer_| will contain the appropriate demuxer based on which resource |
318 // load strategy we're using. | 319 // load strategy we're using. |
319 scoped_ptr<BufferedDataSource> data_source_; | 320 scoped_ptr<BufferedDataSource> data_source_; |
320 scoped_ptr<media::Demuxer> demuxer_; | 321 scoped_ptr<media::Demuxer> demuxer_; |
321 media::ChunkDemuxer* chunk_demuxer_; | 322 media::ChunkDemuxer* chunk_demuxer_; |
322 | 323 |
| 324 BufferedDataSourceHostImpl buffered_; |
| 325 |
323 // Temporary for EME v0.1. In the future the init data type should be passed | 326 // Temporary for EME v0.1. In the future the init data type should be passed |
324 // through GenerateKeyRequest() directly from WebKit. | 327 // through GenerateKeyRequest() directly from WebKit. |
325 std::string init_data_type_; | 328 std::string init_data_type_; |
326 | 329 |
327 // Video rendering members. | 330 // Video rendering members. |
328 VideoFrameCompositor compositor_; | 331 VideoFrameCompositor compositor_; |
329 media::SkCanvasVideoRenderer skcanvas_video_renderer_; | 332 media::SkCanvasVideoRenderer skcanvas_video_renderer_; |
330 | 333 |
331 // The compositor layer for displaying the video content when using composited | 334 // The compositor layer for displaying the video content when using composited |
332 // playback. | 335 // playback. |
(...skipping 10 matching lines...) Expand all Loading... |
343 WebContentDecryptionModuleImpl* web_cdm_; | 346 WebContentDecryptionModuleImpl* web_cdm_; |
344 | 347 |
345 media::DecryptorReadyCB decryptor_ready_cb_; | 348 media::DecryptorReadyCB decryptor_ready_cb_; |
346 | 349 |
347 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); | 350 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl); |
348 }; | 351 }; |
349 | 352 |
350 } // namespace content | 353 } // namespace content |
351 | 354 |
352 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ | 355 #endif // CONTENT_RENDERER_MEDIA_WEBMEDIAPLAYER_IMPL_H_ |
OLD | NEW |