| 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..403330da75aa3d02d258f29a0a5de34283e2941b 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,8 +121,10 @@ class WebMediaPlayerAndroid :
|
| void OnMediaInfo(int info_type);
|
| void OnVideoSizeChanged(int width, int height);
|
|
|
| - // Method to set the video surface for android media player.
|
| - void SetVideoSurface(jobject j_surface);
|
| + // 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();
|
|
|
| private:
|
| // Create a media player to load the |url_| and prepare for playback.
|
| @@ -133,6 +142,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 +197,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 +211,22 @@ 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_;
|
| +
|
| + // 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);
|
| };
|
|
|
|
|