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

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

Issue 12902002: Remove WebVideoFrame, WebVideoFrameProvider, and WebVideoLayer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and without cc changes Created 7 years, 9 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
« no previous file with comments | « webkit/media/android/webmediaplayer_android.h ('k') | webkit/media/webkit_media.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/media/android/webmediaplayer_android.cc
diff --git a/webkit/media/android/webmediaplayer_android.cc b/webkit/media/android/webmediaplayer_android.cc
index 1b65211c90502a4bab1875dddca5d3234e767ed7..128e048b48bce462c891d67bb6a5d48935efa63a 100644
--- a/webkit/media/android/webmediaplayer_android.cc
+++ b/webkit/media/android/webmediaplayer_android.cc
@@ -7,15 +7,16 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/logging.h"
+#include "cc/layers/video_layer.h"
#include "media/base/android/media_player_bridge.h"
#include "media/base/video_frame.h"
#include "net/base/mime_util.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient.h"
+#include "webkit/compositor_bindings/web_layer_impl.h"
#include "webkit/media/android/stream_texture_factory_android.h"
#include "webkit/media/android/webmediaplayer_manager_android.h"
#include "webkit/media/media_switches.h"
#include "webkit/media/webmediaplayer_util.h"
-#include "webkit/media/webvideoframe_impl.h"
static const uint32 kGLTextureExternalOES = 0x8D65;
@@ -24,7 +25,6 @@ using WebKit::WebMediaSource;
using WebKit::WebSize;
using WebKit::WebTimeRanges;
using WebKit::WebURL;
-using WebKit::WebVideoFrame;
using media::MediaPlayerBridge;
using media::VideoFrame;
@@ -47,7 +47,8 @@ WebMediaPlayerAndroid::WebMediaPlayerAndroid(
needs_establish_peer_(true),
has_size_info_(false),
stream_texture_factory_(factory),
- needs_external_surface_(false) {
+ needs_external_surface_(false),
+ video_frame_provider_client_(NULL) {
main_loop_->AddDestructionObserver(this);
if (manager_)
player_id_ = manager_->RegisterMediaPlayer(this);
@@ -65,6 +66,9 @@ WebMediaPlayerAndroid::WebMediaPlayerAndroid(
}
WebMediaPlayerAndroid::~WebMediaPlayerAndroid() {
+ SetVideoFrameProviderClient(NULL);
+ client_->setWebLayer(NULL);
+
if (stream_id_)
stream_texture_factory_->DestroyStreamTexture(texture_id_);
@@ -288,10 +292,12 @@ void WebMediaPlayerAndroid::OnMediaPrepared(base::TimeDelta duration) {
if (ready_state_ != WebMediaPlayer::ReadyStateHaveEnoughData) {
UpdateReadyState(WebMediaPlayer::ReadyStateHaveMetadata);
UpdateReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
- } else {
- // If the status is already set to ReadyStateHaveEnoughData, set it again
- // to make sure that Videolayerchromium will get created.
- UpdateReadyState(WebMediaPlayer::ReadyStateHaveEnoughData);
+ }
+
+ if (hasVideo() && !video_weblayer_ && client->needsWebLayer()) {
+ video_weblayer_.reset(
+ new webkit::WebLayerImpl(cc::VideoLayer::Create(this)));
+ client_->setWebLayer(video_weblayer_.get());
}
// In we have skipped loading, we have to update webkit about the new
@@ -407,7 +413,7 @@ void WebMediaPlayerAndroid::Detach() {
stream_id_ = 0;
}
- web_video_frame_.reset();
+ current_frame_ = NULL;
manager_ = NULL;
}
@@ -417,40 +423,46 @@ void WebMediaPlayerAndroid::ReallocateVideoFrame() {
// VideoFrame::CreateHoleFrame is only defined under GOOGLE_TV.
#if defined(GOOGLE_TV)
if (!natural_size_.isEmpty()) {
- web_video_frame_.reset(new WebVideoFrameImpl(VideoFrame::CreateHoleFrame(
+ current__frame_ = VideoFrame::CreateHoleFrame(
scherkus (not reviewing) 2013/03/21 20:38:59 typo (extra _)
natural_size_)));
}
#else
NOTIMPLEMENTED() << "Hole punching not supported outside of Google TV";
#endif
} else if (texture_id_) {
- web_video_frame_.reset(new WebVideoFrameImpl(VideoFrame::WrapNativeTexture(
+ current_frame_ = VideoFrame::WrapNativeTexture(
texture_id_, kGLTextureExternalOES, natural_size_,
gfx::Rect(natural_size_), natural_size_, base::TimeDelta(),
VideoFrame::ReadPixelsCB(),
- base::Closure())));
+ base::Closure());
}
}
-WebVideoFrame* WebMediaPlayerAndroid::getCurrentFrame() {
- if (stream_texture_proxy_.get() && !stream_texture_proxy_->IsInitialized()
+void WebMediaPlayerAndroid::SetVideoFrameProviderClient(
+ cc::VideoFrameProvider::Client* client) {
+ // This is called from both the main renderer thread and the compositor
+ // thread (when the main thread is blocked).
+ if (video_frame_provider_client_)
+ video_frame_provider_client_->StopUsingProvider();
+ video_frame_provider_client_ = client;
+
+ // Set the callback target when a frame is produced.
+ if (stream_texture_proxy_)
+ stream_texture_proxy_->SetClient(client);
+}
+
+scoped_refptr<media::VideoFrame> WebMediaPlayerAndroid::GetCurrentFrame() {
+ if (stream_texture_proxy_ && !stream_texture_proxy_->IsInitialized()
&& stream_id_ && !needs_external_surface_) {
scherkus (not reviewing) 2013/03/21 20:38:59 leading && should be on previous line
- gfx::Size natural_size = web_video_frame_->video_frame->natural_size();
+ gfx::Size natural_size = current_frame_->natural_size();
stream_texture_proxy_->Initialize(
stream_id_, natural_size.width(), natural_size.height());
}
-
- return web_video_frame_.get();
+ return current_frame_;
}
-void WebMediaPlayerAndroid::putCurrentFrame(
- WebVideoFrame* web_video_frame) {
-}
-
-void WebMediaPlayerAndroid::setStreamTextureClient(
- WebKit::WebStreamTextureClient* client) {
- if (stream_texture_proxy_.get())
- stream_texture_proxy_->SetClient(client);
+void WebMediaPlayerAndroid::PutCurrentFrame(
+ const scoped_refptr<media::VideoFrame>& frame) {
}
void WebMediaPlayerAndroid::EstablishSurfaceTexturePeer() {
« no previous file with comments | « webkit/media/android/webmediaplayer_android.h ('k') | webkit/media/webkit_media.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698