| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 bool pending_seek_; | 328 bool pending_seek_; |
| 327 base::TimeDelta pending_seek_time_; | 329 base::TimeDelta pending_seek_time_; |
| 328 | 330 |
| 329 // Internal seek state. | 331 // Internal seek state. |
| 330 bool seeking_; | 332 bool seeking_; |
| 331 base::TimeDelta seek_time_; | 333 base::TimeDelta seek_time_; |
| 332 | 334 |
| 333 // Whether loading has progressed since the last call to didLoadingProgress. | 335 // Whether loading has progressed since the last call to didLoadingProgress. |
| 334 bool did_loading_progress_; | 336 bool did_loading_progress_; |
| 335 | 337 |
| 336 // Manager for managing this object and for delegating method calls on | 338 // Manages this object and delegates player calls to the browser process. |
| 337 // Render Thread. | 339 // Owned by RenderFrameImpl. |
| 338 RendererMediaPlayerManager* manager_; | 340 RendererMediaPlayerManager* player_manager_; |
| 339 | 341 |
| 340 // Player ID assigned by the |manager_|. | 342 // Delegates EME calls to the browser process. Owned by RenderFrameImpl. |
| 343 // TODO(xhwang): Remove |cdm_manager_| when prefixed EME is deprecated. See |
| 344 // http://crbug.com/249976 |
| 345 RendererCdmManager* cdm_manager_; |
| 346 |
| 347 // Player ID assigned by the |player_manager_|. |
| 341 int player_id_; | 348 int player_id_; |
| 342 | 349 |
| 343 // Current player states. | 350 // Current player states. |
| 344 blink::WebMediaPlayer::NetworkState network_state_; | 351 blink::WebMediaPlayer::NetworkState network_state_; |
| 345 blink::WebMediaPlayer::ReadyState ready_state_; | 352 blink::WebMediaPlayer::ReadyState ready_state_; |
| 346 | 353 |
| 347 // GL texture ID allocated to the video. | 354 // GL texture ID allocated to the video. |
| 348 unsigned int texture_id_; | 355 unsigned int texture_id_; |
| 349 | 356 |
| 350 // GL texture mailbox for texture_id_ to provide in the VideoFrame, and sync | 357 // 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... |
| 432 // Manages decryption keys and decrypts encrypted frames. | 439 // Manages decryption keys and decrypts encrypted frames. |
| 433 scoped_ptr<ProxyDecryptor> proxy_decryptor_; | 440 scoped_ptr<ProxyDecryptor> proxy_decryptor_; |
| 434 | 441 |
| 435 // Non-owned pointer to the CDM. Updated via calls to | 442 // Non-owned pointer to the CDM. Updated via calls to |
| 436 // setContentDecryptionModule(). | 443 // setContentDecryptionModule(). |
| 437 WebContentDecryptionModuleImpl* web_cdm_; | 444 WebContentDecryptionModuleImpl* web_cdm_; |
| 438 | 445 |
| 439 // This is only Used by Clear Key key system implementation, where a renderer | 446 // This is only Used by Clear Key key system implementation, where a renderer |
| 440 // side CDM will be used. This is similar to WebMediaPlayerImpl. For other key | 447 // side CDM will be used. This is similar to WebMediaPlayerImpl. For other key |
| 441 // systems, a browser side CDM will be used and we set CDM by calling | 448 // systems, a browser side CDM will be used and we set CDM by calling |
| 442 // manager_->SetCdm() directly. | 449 // player_manager_->SetCdm() directly. |
| 443 media::DecryptorReadyCB decryptor_ready_cb_; | 450 media::DecryptorReadyCB decryptor_ready_cb_; |
| 444 | 451 |
| 445 // NOTE: Weak pointers must be invalidated before all other member variables. | 452 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 446 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 453 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
| 447 | 454 |
| 448 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 455 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
| 449 }; | 456 }; |
| 450 | 457 |
| 451 } // namespace content | 458 } // namespace content |
| 452 | 459 |
| 453 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 460 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| OLD | NEW |