Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: webkit/media/android/webmediaplayer_android.h

Issue 10413015: Upstream implementation for embedded video for WebMediaPlayerAndroid (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove GetWebMediaPlayerManager() from render_view.h Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..a0a3ea2c49b00a517868d3244bd4a071499f2f3b 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);
@@ -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.
scherkus (not reviewing) 2012/05/23 22:45:46 nit: Id/id -> ID here and below
qinmin 2012/05/24 20:30:28 Done.
+ 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);
};

Powered by Google App Engine
This is Rietveld 408576698