| Index: content/renderer/media/webmediaplayer_impl.cc
|
| diff --git a/content/renderer/media/webmediaplayer_impl.cc b/content/renderer/media/webmediaplayer_impl.cc
|
| index 09633bde08c4e972a6b4742d67ba4a5bf90ac9bd..36822a12f71cd10322b36c9d0be4611feba3e364 100644
|
| --- a/content/renderer/media/webmediaplayer_impl.cc
|
| +++ b/content/renderer/media/webmediaplayer_impl.cc
|
| @@ -38,8 +38,6 @@
|
| #include "content/renderer/media/webmediasource_impl.h"
|
| #include "content/renderer/pepper/pepper_webplugin_impl.h"
|
| #include "content/renderer/render_thread_impl.h"
|
| -#include "gpu/GLES2/gl2extchromium.h"
|
| -#include "gpu/command_buffer/common/mailbox_holder.h"
|
| #include "media/audio/null_audio_sink.h"
|
| #include "media/base/audio_hardware_config.h"
|
| #include "media/base/bind_to_current_loop.h"
|
| @@ -61,6 +59,7 @@
|
| #include "media/filters/video_renderer_impl.h"
|
| #include "media/filters/vpx_video_decoder.h"
|
| #include "third_party/WebKit/public/platform/WebContentDecryptionModule.h"
|
| +#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
|
| #include "third_party/WebKit/public/platform/WebMediaSource.h"
|
| #include "third_party/WebKit/public/platform/WebRect.h"
|
| #include "third_party/WebKit/public/platform/WebSize.h"
|
| @@ -72,6 +71,8 @@
|
| #include "third_party/WebKit/public/web/WebSecurityOrigin.h"
|
| #include "third_party/WebKit/public/web/WebView.h"
|
| #include "v8/include/v8.h"
|
| +#include "webkit/common/gpu/context_provider_web_context.h"
|
| +#include "webkit/common/gpu/webgraphicscontext3d_impl.h"
|
|
|
| #if defined(ENABLE_PEPPER_CDMS)
|
| #include "content/renderer/media/crypto/pepper_cdm_wrapper_impl.h"
|
| @@ -118,23 +119,6 @@ const double kMaxRate = 16.0;
|
| // Prefix for histograms related to Encrypted Media Extensions.
|
| const char* kMediaEme = "Media.EME.";
|
|
|
| -class SyncPointClientImpl : public media::VideoFrame::SyncPointClient {
|
| - public:
|
| - explicit SyncPointClientImpl(
|
| - blink::WebGraphicsContext3D* web_graphics_context)
|
| - : web_graphics_context_(web_graphics_context) {}
|
| - virtual ~SyncPointClientImpl() {}
|
| - virtual uint32 InsertSyncPoint() OVERRIDE {
|
| - return web_graphics_context_->insertSyncPoint();
|
| - }
|
| - virtual void WaitSyncPoint(uint32 sync_point) OVERRIDE {
|
| - web_graphics_context_->waitSyncPoint(sync_point);
|
| - }
|
| -
|
| - private:
|
| - blink::WebGraphicsContext3D* web_graphics_context_;
|
| -};
|
| -
|
| } // namespace
|
|
|
| namespace content {
|
| @@ -547,7 +531,12 @@ void WebMediaPlayerImpl::paint(WebCanvas* canvas,
|
| GetCurrentFrameFromCompositor();
|
|
|
| gfx::Rect gfx_rect(rect);
|
| - skcanvas_video_renderer_.Paint(video_frame.get(), canvas, gfx_rect, alpha);
|
| + scoped_refptr<cc::ContextProvider> context_provider =
|
| + RenderThreadImpl::current()->SharedMainThreadContextProvider();
|
| + media::SkCanvasVideoRenderer::ContextProvider provider{
|
| + context_provider->ContextGL(), context_provider->GrContext()};
|
| + skcanvas_video_renderer_.Paint(
|
| + video_frame.get(), canvas, gfx_rect, alpha, &provider);
|
| }
|
|
|
| bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const {
|
| @@ -606,44 +595,23 @@ bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture(
|
|
|
| scoped_refptr<media::VideoFrame> video_frame =
|
| GetCurrentFrameFromCompositor();
|
| -
|
| - if (!video_frame)
|
| - return false;
|
| - if (video_frame->format() != media::VideoFrame::NATIVE_TEXTURE)
|
| - return false;
|
| -
|
| - const gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder();
|
| - if (mailbox_holder->texture_target != GL_TEXTURE_2D)
|
| + if (!video_frame ||
|
| + video_frame->format() != media::VideoFrame::NATIVE_TEXTURE)
|
| return false;
|
|
|
| - web_graphics_context->waitSyncPoint(mailbox_holder->sync_point);
|
| - uint32 source_texture = web_graphics_context->createAndConsumeTextureCHROMIUM(
|
| - GL_TEXTURE_2D, mailbox_holder->mailbox.name);
|
| -
|
| - // The video is stored in a unmultiplied format, so premultiply
|
| - // if necessary.
|
| - web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
|
| - premultiply_alpha);
|
| - // Application itself needs to take care of setting the right flip_y
|
| - // value down to get the expected result.
|
| - // flip_y==true means to reverse the video orientation while
|
| - // flip_y==false means to keep the intrinsic orientation.
|
| - web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, flip_y);
|
| - web_graphics_context->copyTextureCHROMIUM(GL_TEXTURE_2D,
|
| - source_texture,
|
| - texture,
|
| - level,
|
| - internal_format,
|
| - type);
|
| - web_graphics_context->pixelStorei(GL_UNPACK_FLIP_Y_CHROMIUM, false);
|
| - web_graphics_context->pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
|
| - false);
|
| -
|
| - web_graphics_context->deleteTexture(source_texture);
|
| - web_graphics_context->flush();
|
| -
|
| - SyncPointClientImpl client(web_graphics_context);
|
| - video_frame->UpdateReleaseSyncPoint(&client);
|
| + // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to
|
| + // GLES2Interface.
|
| + gpu::gles2::GLES2Interface* gl =
|
| + static_cast<webkit::gpu::WebGraphicsContext3DImpl*>(web_graphics_context)
|
| + ->GetGLInterface();
|
| + skcanvas_video_renderer_.CopyVideoFrameToTexture(gl,
|
| + video_frame.get(),
|
| + texture,
|
| + level,
|
| + internal_format,
|
| + type,
|
| + premultiply_alpha,
|
| + flip_y);
|
| return true;
|
| }
|
|
|
|
|