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

Unified Diff: webkit/media/webmediaplayer_impl.cc

Issue 12902002: Remove WebVideoFrame, WebVideoFrameProvider, and WebVideoLayer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No provider client lock 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
Index: webkit/media/webmediaplayer_impl.cc
diff --git a/webkit/media/webmediaplayer_impl.cc b/webkit/media/webmediaplayer_impl.cc
index 87d907aa466904e16f0d3f0dbc7d72ac13b57623..a6f1b62ddeabcbf6570e012d788dc798e7e1dd33 100644
--- a/webkit/media/webmediaplayer_impl.cc
+++ b/webkit/media/webmediaplayer_impl.cc
@@ -15,6 +15,7 @@
#include "base/metrics/histogram.h"
#include "base/string_number_conversions.h"
#include "base/synchronization/waitable_event.h"
+#include "cc/layers/video_layer.h"
#include "gpu/GLES2/gl2extchromium.h"
#include "media/audio/null_audio_sink.h"
#include "media/base/bind_to_loop.h"
@@ -34,6 +35,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
#include "v8/include/v8.h"
+#include "webkit/compositor_bindings/web_layer_impl.h"
#include "webkit/media/buffered_data_source.h"
#include "webkit/media/filter_helpers.h"
#include "webkit/media/webaudiosourceprovider_impl.h"
@@ -41,7 +43,6 @@
#include "webkit/media/webmediaplayer_params.h"
#include "webkit/media/webmediaplayer_util.h"
#include "webkit/media/webmediasourceclient_impl.h"
-#include "webkit/media/webvideoframe_impl.h"
#include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
using WebKit::WebCanvas;
@@ -145,7 +146,8 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
is_local_source_(false),
supports_save_(true),
starting_(false),
- pending_repaint_(false) {
+ pending_repaint_(false),
+ video_frame_provider_client_(NULL) {
media_log_->AddEvent(
media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED));
@@ -211,6 +213,9 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
}
WebMediaPlayerImpl::~WebMediaPlayerImpl() {
+ SetVideoFrameProviderClient(NULL);
+ GetClient()->setWebLayer(NULL);
+
DCHECK(main_loop_->BelongsToCurrentThread());
Destroy();
media_log_->AddEvent(
@@ -656,21 +661,27 @@ unsigned WebMediaPlayerImpl::videoDecodedByteCount() const {
return stats.video_bytes_decoded;
}
-WebKit::WebVideoFrame* WebMediaPlayerImpl::getCurrentFrame() {
+void WebMediaPlayerImpl::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;
+}
+
+scoped_refptr<media::VideoFrame> WebMediaPlayerImpl::GetCurrentFrame() {
base::AutoLock auto_lock(lock_);
- if (current_frame_)
- return new WebVideoFrameImpl(current_frame_);
- return NULL;
+ return current_frame_;
}
-void WebMediaPlayerImpl::putCurrentFrame(
- WebKit::WebVideoFrame* web_video_frame) {
+void WebMediaPlayerImpl::PutCurrentFrame(
+ const scoped_refptr<media::VideoFrame>& frame) {
if (!accelerated_compositing_reported_) {
accelerated_compositing_reported_ = true;
DCHECK(frame_->view()->isAcceleratedCompositingActive());
UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", true);
}
- delete web_video_frame;
}
bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture(
@@ -1116,8 +1127,14 @@ void WebMediaPlayerImpl::SetReadyState(WebMediaPlayer::ReadyState state) {
if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing &&
state >= WebMediaPlayer::ReadyStateHaveMetadata) {
- if (!hasVideo())
+ if (!hasVideo()) {
GetClient()->disableAcceleratedCompositing();
+ } else {
+ DCHECK(!video_weblayer_);
+ video_weblayer_.reset(
+ new webkit::WebLayerImpl(cc::VideoLayer::Create(this)));
+ GetClient()->setWebLayer(video_weblayer_.get());
+ }
} else if (state == WebMediaPlayer::ReadyStateHaveEnoughData) {
if (is_local_source_ &&
network_state_ == WebMediaPlayer::NetworkStateLoading) {

Powered by Google App Engine
This is Rietveld 408576698