Index: webkit/media/webmediaplayer_impl.cc |
diff --git a/webkit/media/webmediaplayer_impl.cc b/webkit/media/webmediaplayer_impl.cc |
index 87d907aa466904e16f0d3f0dbc7d72ac13b57623..9a21c20bc65d2b630119a5a0189de94616bd300b 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,12 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( |
} |
WebMediaPlayerImpl::~WebMediaPlayerImpl() { |
+ SetVideoFrameProviderClient(NULL); |
+ // No need for a lock here, as GetCurrentFrame/PutCurrentFrame can't be |
+ // called now that the client is no longer using this provider. Also, load() |
+ // and this destructor are called from the same thread. |
+ setStreamTextureClient(NULL); |
scherkus (not reviewing)
2013/03/18 21:38:24
isn't this handled by the call to SVFPC(NULL)?
danakj
2013/03/18 21:57:59
Oh, yes! This is the one sketchy thing about this
scherkus (not reviewing)
2013/03/18 23:34:18
I'm a bit confused. An IM/VC convo might be in ord
danakj
2013/03/18 23:37:15
Without looking at the android code, it would be p
|
+ |
DCHECK(main_loop_->BelongsToCurrentThread()); |
Destroy(); |
media_log_->AddEvent( |
@@ -656,21 +664,42 @@ unsigned WebMediaPlayerImpl::videoDecodedByteCount() const { |
return stats.video_bytes_decoded; |
} |
-WebKit::WebVideoFrame* WebMediaPlayerImpl::getCurrentFrame() { |
+WebKit::WebLayer* WebMediaPlayerImpl::createCompositingLayer() { |
+ return new webkit::WebLayerImpl(cc::VideoLayer::Create(this)); |
+} |
+ |
+void WebMediaPlayerImpl::SetVideoFrameProviderClient( |
+ cc::VideoFrameProvider::Client* client) { |
+ base::AutoLock auto_lock(provider_lock_); |
+ if (video_frame_provider_client_) |
+ video_frame_provider_client_->StopUsingProvider(); |
+ video_frame_provider_client_ = client; |
+ setStreamTextureClient(client ? this : NULL); |
+} |
+ |
+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) { |
+ base::AutoLock auto_lock(lock_); |
if (!accelerated_compositing_reported_) { |
accelerated_compositing_reported_ = true; |
DCHECK(frame_->view()->isAcceleratedCompositingActive()); |
UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", true); |
} |
- delete web_video_frame; |
+} |
+ |
+void WebMediaPlayerImpl::didReceiveFrame() { |
+ // No lock since this gets called on the client's thread. |
+ video_frame_provider_client_->DidReceiveFrame(); |
+} |
+ |
+void WebMediaPlayerImpl::didUpdateMatrix(const float* matrix) { |
+ // No lock since this gets called on the client's thread. |
+ video_frame_provider_client_->DidUpdateMatrix(matrix); |
} |
bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( |