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

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: rebase after https://chromiumcodereview.appspot.com/10469003/ got committed 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 c8935faa85ffb4a7c2631bc41223feab9ef8157b..b948d362f6f4ced83d07cb6a3417f6e5ebf2bc96 100644
--- a/webkit/media/android/webmediaplayer_android.h
+++ b/webkit/media/android/webmediaplayer_android.h
@@ -4,6 +4,7 @@
#ifndef WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_
#define WEBKIT_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_
+#pragma once
#include <jni.h>
@@ -18,6 +19,7 @@
namespace WebKit {
class WebCookieJar;
+class WebFrame;
}
namespace media {
@@ -26,6 +28,9 @@ class MediaPlayerBridge;
namespace webkit_media {
+class StreamTextureFactory;
+class StreamTextureProxy;
+class WebMediaPlayerManagerAndroid;
class WebMediaPlayerProxyAndroid;
// This class serves as the android implementation of WebKit::WebMediaPlayer.
@@ -35,8 +40,11 @@ class WebMediaPlayerAndroid :
public WebKit::WebMediaPlayer,
public base::SupportsWeakPtr<WebMediaPlayerAndroid> {
public:
- WebMediaPlayerAndroid(WebKit::WebMediaPlayerClient* client,
- WebKit::WebCookieJar* cookie_jar);
+ WebMediaPlayerAndroid(WebKit::WebFrame* frame,
+ WebKit::WebMediaPlayerClient* client,
+ WebKit::WebCookieJar* cookie_jar,
+ webkit_media::WebMediaPlayerManagerAndroid* manager,
+ webkit_media::StreamTextureFactory* factory);
virtual ~WebMediaPlayerAndroid();
// Set |incognito_mode_| to true if in incognito mode.
@@ -105,6 +113,8 @@ class WebMediaPlayerAndroid :
// compositor thread.
virtual WebKit::WebVideoFrame* getCurrentFrame();
virtual void putCurrentFrame(WebKit::WebVideoFrame*);
+ virtual void setStreamTextureClient(
+ WebKit::WebStreamTextureClient* client);
// Media player callback handlers.
void OnMediaPrepared();
@@ -115,8 +125,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.
@@ -134,9 +146,15 @@ 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_;
+ WebKit::WebFrame* frame_;
+
WebKit::WebMediaPlayerClient* const client_;
// Save the list of buffered time ranges.
@@ -188,6 +206,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_;
@@ -196,6 +220,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);
};
« no previous file with comments | « webkit/media/android/stream_texture_factory_android.h ('k') | webkit/media/android/webmediaplayer_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698