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

Unified Diff: webkit/media/webmediaplayer_ms.cc

Issue 12902002: Remove WebVideoFrame, WebVideoFrameProvider, and WebVideoLayer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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_ms.cc
diff --git a/webkit/media/webmediaplayer_ms.cc b/webkit/media/webmediaplayer_ms.cc
index fc21a3a5639b85af2470fcc8ca59aa5b5757828b..99d73b596a1287d4eeeebfbb131bbb6b972a0aa9 100644
--- a/webkit/media/webmediaplayer_ms.cc
+++ b/webkit/media/webmediaplayer_ms.cc
@@ -10,21 +10,21 @@
#include "base/callback.h"
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
+#include "cc/layers/video_layer.h"
#include "media/base/media_log.h"
#include "media/base/video_frame.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebRect.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebVideoFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerClient.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
+#include "webkit/compositor_bindings/web_layer_impl.h"
#include "webkit/media/media_stream_audio_renderer.h"
#include "webkit/media/media_stream_client.h"
#include "webkit/media/video_frame_provider.h"
#include "webkit/media/webmediaplayer_delegate.h"
#include "webkit/media/webmediaplayer_util.h"
-#include "webkit/media/webvideoframe_impl.h"
using WebKit::WebCanvas;
using WebKit::WebMediaPlayer;
@@ -49,12 +49,13 @@ WebMediaPlayerMS::WebMediaPlayerMS(
paused_(true),
current_frame_used_(false),
pending_repaint_(false),
+ video_frame_provider_client_(NULL),
received_first_frame_(false),
sequence_started_(false),
total_frame_count_(0),
dropped_frame_count_(0),
media_log_(media_log) {
- DVLOG(1) << "WebMediaPlayerMS::ctor";
+ DVLOG(1) << "WebMediaPlayerMS::ctor";
DCHECK(media_stream_client);
media_log_->AddEvent(
media_log_->CreateEvent(media::MediaLogEvent::WEBMEDIAPLAYER_CREATED));
@@ -63,9 +64,15 @@ WebMediaPlayerMS::WebMediaPlayerMS(
WebMediaPlayerMS::~WebMediaPlayerMS() {
DVLOG(1) << "WebMediaPlayerMS::dtor";
DCHECK(thread_checker_.CalledOnValidThread());
- if (video_frame_provider_) {
+
+ 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 ditto
+
+ if (video_frame_provider_)
video_frame_provider_->Stop();
- }
if (audio_renderer_) {
if (audio_renderer_->IsLocalRenderer()) {
@@ -358,27 +365,46 @@ unsigned WebMediaPlayerMS::videoDecodedByteCount() const {
return 0;
}
-WebKit::WebVideoFrame* WebMediaPlayerMS::getCurrentFrame() {
+WebKit::WebLayer* WebMediaPlayerMS::createCompositingLayer() {
+ return new webkit::WebLayerImpl(cc::VideoLayer::Create(this));
+}
+
+void WebMediaPlayerMS::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> WebMediaPlayerMS::GetCurrentFrame() {
DVLOG(3) << "WebMediaPlayerMS::getCurrentFrame";
base::AutoLock auto_lock(current_frame_lock_);
DCHECK(!pending_repaint_);
- if (current_frame_.get()) {
- pending_repaint_ = true;
- current_frame_used_ = true;
- return new webkit_media::WebVideoFrameImpl(current_frame_);
- }
- return NULL;
+ if (!current_frame_)
+ return NULL;
+ pending_repaint_ = true;
+ current_frame_used_ = true;
+ return current_frame_;
}
-void WebMediaPlayerMS::putCurrentFrame(
- WebKit::WebVideoFrame* web_video_frame) {
+void WebMediaPlayerMS::PutCurrentFrame(
+ const scoped_refptr<media::VideoFrame>& frame) {
DVLOG(3) << "WebMediaPlayerMS::putCurrentFrame";
base::AutoLock auto_lock(current_frame_lock_);
DCHECK(pending_repaint_);
pending_repaint_ = false;
- if (web_video_frame) {
- delete web_video_frame;
- }
+}
+
+void WebMediaPlayerMS::didReceiveFrame() {
+ // No lock since this gets called on the client's thread.
+ video_frame_provider_client_->DidReceiveFrame();
+}
+
+void WebMediaPlayerMS::didUpdateMatrix(const float* matrix) {
+ // No lock since this gets called on the client's thread.
+ video_frame_provider_client_->DidUpdateMatrix(matrix);
}
void WebMediaPlayerMS::OnFrameAvailable(

Powered by Google App Engine
This is Rietveld 408576698