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_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 | 47 |
48 namespace media { | 48 namespace media { |
49 class MediaLog; | 49 class MediaLog; |
50 } | 50 } |
51 | 51 |
52 namespace webkit { | 52 namespace webkit { |
53 class WebLayerImpl; | 53 class WebLayerImpl; |
54 } | 54 } |
55 | 55 |
56 namespace content { | 56 namespace content { |
57 class RendererCdmManager; | |
57 class RendererMediaPlayerManager; | 58 class RendererMediaPlayerManager; |
58 class WebContentDecryptionModuleImpl; | 59 class WebContentDecryptionModuleImpl; |
59 class WebMediaPlayerDelegate; | 60 class WebMediaPlayerDelegate; |
60 | 61 |
61 // This class implements blink::WebMediaPlayer by keeping the android | 62 // This class implements blink::WebMediaPlayer by keeping the android |
62 // media player in the browser process. It listens to all the status changes | 63 // media player in the browser process. It listens to all the status changes |
63 // sent from the browser process and sends playback controls to the media | 64 // sent from the browser process and sends playback controls to the media |
64 // player. | 65 // player. |
65 class WebMediaPlayerAndroid : public blink::WebMediaPlayer, | 66 class WebMediaPlayerAndroid : public blink::WebMediaPlayer, |
66 public cc::VideoFrameProvider, | 67 public cc::VideoFrameProvider, |
67 public RenderFrameObserver { | 68 public RenderFrameObserver { |
68 public: | 69 public: |
69 // Construct a WebMediaPlayerAndroid object. This class communicates with the | 70 // Construct a WebMediaPlayerAndroid object. This class communicates with the |
70 // MediaPlayerAndroid object in the browser process through |proxy|. | 71 // MediaPlayerAndroid object in the browser process through |proxy|. |
71 // TODO(qinmin): |frame| argument is used to determine whether the current | 72 // TODO(qinmin): |frame| argument is used to determine whether the current |
72 // player can enter fullscreen. This logic should probably be moved into | 73 // player can enter fullscreen. This logic should probably be moved into |
73 // blink, so that enterFullscreen() will not be called if another video is | 74 // blink, so that enterFullscreen() will not be called if another video is |
74 // already in fullscreen. | 75 // already in fullscreen. |
75 WebMediaPlayerAndroid(blink::WebFrame* frame, | 76 WebMediaPlayerAndroid(blink::WebFrame* frame, |
76 blink::WebMediaPlayerClient* client, | 77 blink::WebMediaPlayerClient* client, |
77 base::WeakPtr<WebMediaPlayerDelegate> delegate, | 78 base::WeakPtr<WebMediaPlayerDelegate> delegate, |
78 RendererMediaPlayerManager* manager, | 79 RendererMediaPlayerManager* player_manager, |
80 RendererCdmManager* cdm_manager, | |
79 scoped_refptr<StreamTextureFactory> factory, | 81 scoped_refptr<StreamTextureFactory> factory, |
80 const scoped_refptr<base::MessageLoopProxy>& media_loop, | 82 const scoped_refptr<base::MessageLoopProxy>& media_loop, |
81 media::MediaLog* media_log); | 83 media::MediaLog* media_log); |
82 virtual ~WebMediaPlayerAndroid(); | 84 virtual ~WebMediaPlayerAndroid(); |
83 | 85 |
84 // blink::WebMediaPlayer implementation. | 86 // blink::WebMediaPlayer implementation. |
85 virtual void enterFullscreen(); | 87 virtual void enterFullscreen(); |
86 virtual void exitFullscreen(); | 88 virtual void exitFullscreen(); |
87 virtual bool canEnterFullscreen() const; | 89 virtual bool canEnterFullscreen() const; |
88 | 90 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 | 331 |
330 // Internal seek state. | 332 // Internal seek state. |
331 bool seeking_; | 333 bool seeking_; |
332 base::TimeDelta seek_time_; | 334 base::TimeDelta seek_time_; |
333 | 335 |
334 // Whether loading has progressed since the last call to didLoadingProgress. | 336 // Whether loading has progressed since the last call to didLoadingProgress. |
335 bool did_loading_progress_; | 337 bool did_loading_progress_; |
336 | 338 |
337 // Manager for managing this object and for delegating method calls on | 339 // Manager for managing this object and for delegating method calls on |
338 // Render Thread. | 340 // Render Thread. |
339 RendererMediaPlayerManager* manager_; | 341 RendererMediaPlayerManager* player_manager_; |
340 | 342 |
341 // Player ID assigned by the |manager_|. | 343 // Manager for managing CDMs on the Render Thread. |
ddorwin
2014/05/23 23:28:37
nit: "Manager for managing" is redundant. "Manages
xhwang
2014/05/27 22:57:41
Done.
| |
344 // TODO(xhwang): Remove |cdm_manager_| when prefixed EME is deprecated. See | |
345 // http://crbug.com/249976 | |
346 RendererCdmManager* cdm_manager_; | |
ddorwin
2014/05/23 23:28:37
Should we explain who owns these?
xhwang
2014/05/27 22:57:41
Done.
| |
347 | |
348 // Player ID assigned by the |player_manager_|. | |
342 int player_id_; | 349 int player_id_; |
343 | 350 |
344 // Current player states. | 351 // Current player states. |
345 blink::WebMediaPlayer::NetworkState network_state_; | 352 blink::WebMediaPlayer::NetworkState network_state_; |
346 blink::WebMediaPlayer::ReadyState ready_state_; | 353 blink::WebMediaPlayer::ReadyState ready_state_; |
347 | 354 |
348 // GL texture ID allocated to the video. | 355 // GL texture ID allocated to the video. |
349 unsigned int texture_id_; | 356 unsigned int texture_id_; |
350 | 357 |
351 // GL texture mailbox for texture_id_ to provide in the VideoFrame, and sync | 358 // GL texture mailbox for texture_id_ to provide in the VideoFrame, and sync |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 // Manages decryption keys and decrypts encrypted frames. | 440 // Manages decryption keys and decrypts encrypted frames. |
434 scoped_ptr<ProxyDecryptor> proxy_decryptor_; | 441 scoped_ptr<ProxyDecryptor> proxy_decryptor_; |
435 | 442 |
436 // Non-owned pointer to the CDM. Updated via calls to | 443 // Non-owned pointer to the CDM. Updated via calls to |
437 // setContentDecryptionModule(). | 444 // setContentDecryptionModule(). |
438 WebContentDecryptionModuleImpl* web_cdm_; | 445 WebContentDecryptionModuleImpl* web_cdm_; |
439 | 446 |
440 // This is only Used by Clear Key key system implementation, where a renderer | 447 // This is only Used by Clear Key key system implementation, where a renderer |
441 // side CDM will be used. This is similar to WebMediaPlayerImpl. For other key | 448 // side CDM will be used. This is similar to WebMediaPlayerImpl. For other key |
442 // systems, a browser side CDM will be used and we set CDM by calling | 449 // systems, a browser side CDM will be used and we set CDM by calling |
443 // manager_->SetCdm() directly. | 450 // player_manager_->SetCdm() directly. |
444 media::DecryptorReadyCB decryptor_ready_cb_; | 451 media::DecryptorReadyCB decryptor_ready_cb_; |
445 | 452 |
446 // NOTE: Weak pointers must be invalidated before all other member variables. | 453 // NOTE: Weak pointers must be invalidated before all other member variables. |
447 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 454 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
448 | 455 |
449 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 456 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
450 }; | 457 }; |
451 | 458 |
452 } // namespace content | 459 } // namespace content |
453 | 460 |
454 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 461 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |