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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 class RendererCdmManager; | 65 class RendererCdmManager; |
66 class RendererMediaPlayerManager; | 66 class RendererMediaPlayerManager; |
67 class WebContentDecryptionModuleImpl; | 67 class WebContentDecryptionModuleImpl; |
68 | 68 |
69 // This class implements blink::WebMediaPlayer by keeping the android | 69 // This class implements blink::WebMediaPlayer by keeping the android |
70 // media player in the browser process. It listens to all the status changes | 70 // media player in the browser process. It listens to all the status changes |
71 // sent from the browser process and sends playback controls to the media | 71 // sent from the browser process and sends playback controls to the media |
72 // player. | 72 // player. |
73 class WebMediaPlayerAndroid : public blink::WebMediaPlayer, | 73 class WebMediaPlayerAndroid : public blink::WebMediaPlayer, |
74 public cc::VideoFrameProvider, | 74 public cc::VideoFrameProvider, |
75 public RenderFrameObserver { | 75 public RenderFrameObserver, |
76 public StreamTextureFactoryContextObserver { | |
76 public: | 77 public: |
77 // Construct a WebMediaPlayerAndroid object. This class communicates with the | 78 // Construct a WebMediaPlayerAndroid object. This class communicates with the |
78 // MediaPlayerAndroid object in the browser process through |proxy|. | 79 // MediaPlayerAndroid object in the browser process through |proxy|. |
79 // TODO(qinmin): |frame| argument is used to determine whether the current | 80 // TODO(qinmin): |frame| argument is used to determine whether the current |
80 // player can enter fullscreen. This logic should probably be moved into | 81 // player can enter fullscreen. This logic should probably be moved into |
81 // blink, so that enterFullscreen() will not be called if another video is | 82 // blink, so that enterFullscreen() will not be called if another video is |
82 // already in fullscreen. | 83 // already in fullscreen. |
83 WebMediaPlayerAndroid( | 84 WebMediaPlayerAndroid( |
84 blink::WebFrame* frame, | 85 blink::WebFrame* frame, |
85 blink::WebMediaPlayerClient* client, | 86 blink::WebMediaPlayerClient* client, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 | 193 |
193 // Functions called when media player status changes. | 194 // Functions called when media player status changes. |
194 void OnConnectedToRemoteDevice(const std::string& remote_playback_message); | 195 void OnConnectedToRemoteDevice(const std::string& remote_playback_message); |
195 void OnDisconnectedFromRemoteDevice(); | 196 void OnDisconnectedFromRemoteDevice(); |
196 void OnDidEnterFullscreen(); | 197 void OnDidEnterFullscreen(); |
197 void OnDidExitFullscreen(); | 198 void OnDidExitFullscreen(); |
198 void OnMediaPlayerPlay(); | 199 void OnMediaPlayerPlay(); |
199 void OnMediaPlayerPause(); | 200 void OnMediaPlayerPause(); |
200 void OnRequestFullscreen(); | 201 void OnRequestFullscreen(); |
201 | 202 |
203 // StreamTextureFactoryContextObserver implementation. | |
204 virtual void ResetStreamTextureProxy() OVERRIDE; | |
205 | |
202 // Called when the player is released. | 206 // Called when the player is released. |
203 virtual void OnPlayerReleased(); | 207 virtual void OnPlayerReleased(); |
204 | 208 |
205 // This function is called by the RendererMediaPlayerManager to pause the | 209 // This function is called by the RendererMediaPlayerManager to pause the |
206 // video and release the media player and surface texture when we switch tabs. | 210 // video and release the media player and surface texture when we switch tabs. |
207 // However, the actual GlTexture is not released to keep the video screenshot. | 211 // However, the actual GlTexture is not released to keep the video screenshot. |
208 virtual void ReleaseMediaResources(); | 212 virtual void ReleaseMediaResources(); |
209 | 213 |
210 // RenderFrameObserver implementation. | 214 // RenderFrameObserver implementation. |
211 virtual void OnDestruct() OVERRIDE; | 215 virtual void OnDestruct() OVERRIDE; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
407 // Stream texture ID allocated to the video. | 411 // Stream texture ID allocated to the video. |
408 unsigned int stream_id_; | 412 unsigned int stream_id_; |
409 | 413 |
410 // Whether the mediaplayer is playing. | 414 // Whether the mediaplayer is playing. |
411 bool is_playing_; | 415 bool is_playing_; |
412 | 416 |
413 // Whether media player needs to re-establish the surface texture peer. | 417 // Whether media player needs to re-establish the surface texture peer. |
414 bool needs_establish_peer_; | 418 bool needs_establish_peer_; |
415 | 419 |
416 // Whether |stream_texture_proxy_| is initialized. | 420 // Whether |stream_texture_proxy_| is initialized. |
421 // Accessed on main thread and on compositor thread when main thread is | |
422 // blocked. | |
417 bool stream_texture_proxy_initialized_; | 423 bool stream_texture_proxy_initialized_; |
qinmin
2014/09/15 17:16:26
Is this variable still needed?
boliu
2014/09/15 17:54:07
Removed
| |
418 | 424 |
419 // Whether the video size info is available. | 425 // Whether the video size info is available. |
420 bool has_size_info_; | 426 bool has_size_info_; |
421 | 427 |
422 // Object for allocating stream textures. | 428 // Object for allocating stream textures. |
423 scoped_refptr<StreamTextureFactory> stream_texture_factory_; | 429 scoped_refptr<StreamTextureFactory> stream_texture_factory_; |
424 | 430 |
425 // Object for calling back the compositor thread to repaint the video when a | 431 // Object for calling back the compositor thread to repaint the video when a |
426 // frame available. It should be initialized on the compositor thread. | 432 // frame available. It should be initialized on the compositor thread. |
433 // Accessed on main thread and on compositor thread when main thread is | |
434 // blocked. | |
427 ScopedStreamTextureProxy stream_texture_proxy_; | 435 ScopedStreamTextureProxy stream_texture_proxy_; |
428 | 436 |
429 // Whether media player needs external surface. | 437 // Whether media player needs external surface. |
430 // Only used for the VIDEO_HOLE logic. | 438 // Only used for the VIDEO_HOLE logic. |
431 bool needs_external_surface_; | 439 bool needs_external_surface_; |
432 | 440 |
433 // Whether valid metadata are available | 441 // Whether valid metadata are available |
434 bool has_valid_metadata_; | 442 bool has_valid_metadata_; |
435 | 443 |
436 // A pointer back to the compositor to inform it about state changes. This is | 444 // A pointer back to the compositor to inform it about state changes. This is |
437 // not NULL while the compositor is actively using this webmediaplayer. | 445 // not NULL while the compositor is actively using this webmediaplayer. |
446 // Accessed on main thread and on compositor thread when main thread is | |
447 // blocked. | |
438 cc::VideoFrameProvider::Client* video_frame_provider_client_; | 448 cc::VideoFrameProvider::Client* video_frame_provider_client_; |
439 | 449 |
440 scoped_ptr<cc_blink::WebLayerImpl> video_weblayer_; | 450 scoped_ptr<cc_blink::WebLayerImpl> video_weblayer_; |
441 | 451 |
442 #if defined(VIDEO_HOLE) | 452 #if defined(VIDEO_HOLE) |
443 // A rectangle represents the geometry of video frame, when computed last | 453 // A rectangle represents the geometry of video frame, when computed last |
444 // time. | 454 // time. |
445 gfx::RectF last_computed_rect_; | 455 gfx::RectF last_computed_rect_; |
446 | 456 |
447 // Whether to use the video overlay for all embedded video. | 457 // Whether to use the video overlay for all embedded video. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
503 | 513 |
504 // NOTE: Weak pointers must be invalidated before all other member variables. | 514 // NOTE: Weak pointers must be invalidated before all other member variables. |
505 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 515 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
506 | 516 |
507 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 517 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
508 }; | 518 }; |
509 | 519 |
510 } // namespace content | 520 } // namespace content |
511 | 521 |
512 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 522 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
OLD | NEW |