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

Side by Side Diff: content/renderer/media/webmediaplayer_ms.cc

Issue 1833273002: Remove WebGraphicsContext3D::getGLES2Interface(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: getgles2: media Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/webmediaplayer_ms.h" 5 #include "content/renderer/media/webmediaplayer_ms.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "cc/blink/context_provider_web_context.h" 15 #include "cc/blink/context_provider_web_context.h"
16 #include "cc/blink/web_layer_impl.h" 16 #include "cc/blink/web_layer_impl.h"
17 #include "cc/layers/video_frame_provider_client_impl.h" 17 #include "cc/layers/video_frame_provider_client_impl.h"
18 #include "cc/layers/video_layer.h" 18 #include "cc/layers/video_layer.h"
19 #include "content/public/renderer/media_stream_audio_renderer.h" 19 #include "content/public/renderer/media_stream_audio_renderer.h"
20 #include "content/public/renderer/media_stream_renderer_factory.h" 20 #include "content/public/renderer/media_stream_renderer_factory.h"
21 #include "content/public/renderer/video_frame_provider.h" 21 #include "content/public/renderer/video_frame_provider.h"
22 #include "content/renderer/media/webmediaplayer_ms_compositor.h" 22 #include "content/renderer/media/webmediaplayer_ms_compositor.h"
23 #include "content/renderer/render_frame_impl.h" 23 #include "content/renderer/render_frame_impl.h"
24 #include "content/renderer/render_thread_impl.h" 24 #include "content/renderer/render_thread_impl.h"
25 #include "gpu/blink/webgraphicscontext3d_impl.h"
26 #include "media/base/media_log.h" 25 #include "media/base/media_log.h"
27 #include "media/base/video_frame.h" 26 #include "media/base/video_frame.h"
28 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h" 27 #include "third_party/WebKit/public/platform/WebMediaPlayerClient.h"
29 #include "third_party/WebKit/public/platform/WebRect.h" 28 #include "third_party/WebKit/public/platform/WebRect.h"
30 #include "third_party/WebKit/public/platform/WebSize.h" 29 #include "third_party/WebKit/public/platform/WebSize.h"
31 #include "third_party/WebKit/public/platform/WebURL.h" 30 #include "third_party/WebKit/public/platform/WebURL.h"
32 31
33 namespace content { 32 namespace content {
34 33
35 WebMediaPlayerMS::WebMediaPlayerMS( 34 WebMediaPlayerMS::WebMediaPlayerMS(
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 void WebMediaPlayerMS::OnPause() { 425 void WebMediaPlayerMS::OnPause() {
427 // TODO(perkj, magjed): See TODO in Onplay(). 426 // TODO(perkj, magjed): See TODO in Onplay().
428 } 427 }
429 428
430 void WebMediaPlayerMS::OnVolumeMultiplierUpdate(double multiplier) { 429 void WebMediaPlayerMS::OnVolumeMultiplierUpdate(double multiplier) {
431 volume_multiplier_ = multiplier; 430 volume_multiplier_ = multiplier;
432 setVolume(volume_); 431 setVolume(volume_);
433 } 432 }
434 433
435 bool WebMediaPlayerMS::copyVideoTextureToPlatformTexture( 434 bool WebMediaPlayerMS::copyVideoTextureToPlatformTexture(
436 blink::WebGraphicsContext3D* web_graphics_context, 435 gpu::gles2::GLES2Interface* gl,
437 unsigned int texture, 436 unsigned int texture,
438 unsigned int internal_format, 437 unsigned int internal_format,
439 unsigned int type, 438 unsigned int type,
440 bool premultiply_alpha, 439 bool premultiply_alpha,
441 bool flip_y) { 440 bool flip_y) {
442 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); 441 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture");
443 DCHECK(thread_checker_.CalledOnValidThread()); 442 DCHECK(thread_checker_.CalledOnValidThread());
444 443
445 scoped_refptr<media::VideoFrame> video_frame = compositor_->GetCurrentFrame(); 444 scoped_refptr<media::VideoFrame> video_frame = compositor_->GetCurrentFrame();
446 445
447 if (!video_frame.get() || video_frame->HasTextures() || 446 if (!video_frame.get() || video_frame->HasTextures() ||
448 media::VideoFrame::NumPlanes(video_frame->format()) != 1) { 447 media::VideoFrame::NumPlanes(video_frame->format()) != 1) {
449 return false; 448 return false;
450 } 449 }
451 450
452 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to
453 // GLES2Interface.
454 gpu::gles2::GLES2Interface* const gl =
455 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context)
456 ->GetGLInterface();
457 media::SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( 451 media::SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture(
458 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, 452 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha,
459 flip_y); 453 flip_y);
460 return true; 454 return true;
461 } 455 }
462 456
463 void WebMediaPlayerMS::OnFrameAvailable( 457 void WebMediaPlayerMS::OnFrameAvailable(
464 const scoped_refptr<media::VideoFrame>& frame) { 458 const scoped_refptr<media::VideoFrame>& frame) {
465 DVLOG(3) << __FUNCTION__; 459 DVLOG(3) << __FUNCTION__;
466 DCHECK(thread_checker_.CalledOnValidThread()); 460 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 media::SkCanvasVideoRenderer* WebMediaPlayerMS::GetSkCanvasVideoRenderer() { 525 media::SkCanvasVideoRenderer* WebMediaPlayerMS::GetSkCanvasVideoRenderer() {
532 return &video_renderer_; 526 return &video_renderer_;
533 } 527 }
534 528
535 void WebMediaPlayerMS::ResetCanvasCache() { 529 void WebMediaPlayerMS::ResetCanvasCache() {
536 DCHECK(thread_checker_.CalledOnValidThread()); 530 DCHECK(thread_checker_.CalledOnValidThread());
537 video_renderer_.ResetCache(); 531 video_renderer_.ResetCache();
538 } 532 }
539 533
540 } // namespace content 534 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698