Index: webkit/media/android/webmediaplayer_android.h |
diff --git a/webkit/media/android/webmediaplayer_android.h b/webkit/media/android/webmediaplayer_android.h |
index 61ee5d167393a5f7325ba1d296305f0a31c6484e..b6b7baf862df0ce62a76167ea9cf9ab1f116bf69 100644 |
--- a/webkit/media/android/webmediaplayer_android.h |
+++ b/webkit/media/android/webmediaplayer_android.h |
@@ -26,6 +26,9 @@ class MediaPlayerBridge; |
namespace webkit_media { |
+class StreamTextureFactory; |
+class StreamTextureProxy; |
+class WebMediaPlayerManagerAndroid; |
class WebMediaPlayerProxyAndroid; |
// This class serves as the android implementation of WebKit::WebMediaPlayer. |
@@ -36,7 +39,9 @@ class WebMediaPlayerAndroid : |
public base::SupportsWeakPtr<WebMediaPlayerAndroid> { |
public: |
WebMediaPlayerAndroid(WebKit::WebMediaPlayerClient* client, |
- WebKit::WebCookieJar* cookie_jar); |
+ WebKit::WebCookieJar* cookie_jar, |
+ webkit_media::WebMediaPlayerManagerAndroid* manager, |
+ webkit_media::StreamTextureFactory* factory); |
virtual ~WebMediaPlayerAndroid() OVERRIDE; |
// Set |incognito_mode_| to true if in incognito mode. |
@@ -104,6 +109,8 @@ class WebMediaPlayerAndroid : |
// compositor thread. |
virtual WebKit::WebVideoFrame* getCurrentFrame() OVERRIDE; |
virtual void putCurrentFrame(WebKit::WebVideoFrame*) OVERRIDE; |
+ virtual void setStreamTextureClient( |
+ WebKit::WebStreamTextureClient* client) OVERRIDE; |
// Media player callback handlers. |
void OnMediaPrepared(); |
@@ -114,6 +121,11 @@ class WebMediaPlayerAndroid : |
void OnMediaInfo(int info_type); |
void OnVideoSizeChanged(int width, int height); |
+ // This function is called by WebMediaPlayerManagerAndroid to pause the video |
+ // and release |media_player_| and its surface texture when we switch tabs. |
+ // However, the actual GlTexture is not released to keep the video screenshot. |
+ void ReleaseMediaResources(); |
+ |
// Method to set the video surface for android media player. |
void SetVideoSurface(jobject j_surface); |
scherkus (not reviewing)
2012/05/24 21:36:32
so this method is called by the manager... but I d
qinmin
2012/05/25 01:04:21
That code hasn't been upstreamed yet. Eventually i
|
@@ -133,6 +145,10 @@ class WebMediaPlayerAndroid : |
void UpdateNetworkState(WebKit::WebMediaPlayer::NetworkState state); |
void UpdateReadyState(WebKit::WebMediaPlayer::ReadyState state); |
+ // Methods for creation and deletion of stream texture. |
+ void CreateStreamTexture(); |
+ void DestroyStreamTexture(); |
+ |
// whether the current process is incognito mode |
static bool incognito_mode_; |
@@ -184,6 +200,12 @@ class WebMediaPlayerAndroid : |
// Pointer to the cookie jar to get the cookie for the media url. |
WebKit::WebCookieJar* cookie_jar_; |
+ // Manager for managing this media player. |
+ webkit_media::WebMediaPlayerManagerAndroid* manager_; |
+ |
+ // Player ID assigned by the media player manager. |
+ int player_id_; |
+ |
// Whether the user has clicked the play button while media player |
// is preparing. |
bool pending_play_event_; |
@@ -192,6 +214,25 @@ class WebMediaPlayerAndroid : |
WebKit::WebMediaPlayer::NetworkState network_state_; |
WebKit::WebMediaPlayer::ReadyState ready_state_; |
+ // GL texture ID allocated to the video. |
+ unsigned int texture_id_; |
+ |
+ // Stream texture ID allocated to the video. |
+ unsigned int stream_id_; |
+ |
+ // Whether |media_player_| needs to re-establish the surface texture peer. |
+ bool needs_establish_peer_; |
+ |
+ // Whether |stream_texture_proxy_| has been initialized. |
+ bool stream_texture_proxy_initialized_; |
+ |
+ // Object for allocating stream textures. |
+ scoped_ptr<webkit_media::StreamTextureFactory> stream_texture_factory_; |
+ |
+ // Object for calling back the compositor thread to repaint the video when a |
+ // frame available. It should be initialized on the compositor thread. |
+ scoped_ptr<webkit_media::StreamTextureProxy> stream_texture_proxy_; |
+ |
DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
}; |