| OLD | NEW |
| 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> |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 return true; | 321 return true; |
| 322 } | 322 } |
| 323 | 323 |
| 324 void WebMediaPlayerMS::paint(blink::WebCanvas* canvas, | 324 void WebMediaPlayerMS::paint(blink::WebCanvas* canvas, |
| 325 const blink::WebRect& rect, | 325 const blink::WebRect& rect, |
| 326 unsigned char alpha, | 326 unsigned char alpha, |
| 327 SkXfermode::Mode mode) { | 327 SkXfermode::Mode mode) { |
| 328 DVLOG(3) << __FUNCTION__; | 328 DVLOG(3) << __FUNCTION__; |
| 329 DCHECK(thread_checker_.CalledOnValidThread()); | 329 DCHECK(thread_checker_.CalledOnValidThread()); |
| 330 | 330 |
| 331 const scoped_refptr<media::VideoFrame> frame = compositor_->GetCurrentFrame(); | 331 const scoped_refptr<media::VideoFrame> frame = |
| 332 compositor_->GetCurrentFrameWithoutUpdatingStatistics(); |
| 332 | 333 |
| 333 media::Context3D context_3d; | 334 media::Context3D context_3d; |
| 334 if (frame && frame->HasTextures()) { | 335 if (frame && frame->HasTextures()) { |
| 335 cc::ContextProvider* provider = | 336 cc::ContextProvider* provider = |
| 336 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 337 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 337 // GPU Process crashed. | 338 // GPU Process crashed. |
| 338 if (!provider) | 339 if (!provider) |
| 339 return; | 340 return; |
| 340 context_3d = media::Context3D(provider->ContextGL(), provider->GrContext()); | 341 context_3d = media::Context3D(provider->ContextGL(), provider->GrContext()); |
| 341 DCHECK(context_3d.gl); | 342 DCHECK(context_3d.gl); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 bool WebMediaPlayerMS::copyVideoTextureToPlatformTexture( | 446 bool WebMediaPlayerMS::copyVideoTextureToPlatformTexture( |
| 446 gpu::gles2::GLES2Interface* gl, | 447 gpu::gles2::GLES2Interface* gl, |
| 447 unsigned int texture, | 448 unsigned int texture, |
| 448 unsigned int internal_format, | 449 unsigned int internal_format, |
| 449 unsigned int type, | 450 unsigned int type, |
| 450 bool premultiply_alpha, | 451 bool premultiply_alpha, |
| 451 bool flip_y) { | 452 bool flip_y) { |
| 452 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); | 453 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); |
| 453 DCHECK(thread_checker_.CalledOnValidThread()); | 454 DCHECK(thread_checker_.CalledOnValidThread()); |
| 454 | 455 |
| 455 scoped_refptr<media::VideoFrame> video_frame = compositor_->GetCurrentFrame(); | 456 scoped_refptr<media::VideoFrame> video_frame = |
| 457 compositor_->GetCurrentFrameWithoutUpdatingStatistics(); |
| 456 | 458 |
| 457 if (!video_frame.get() || !video_frame->HasTextures() || | 459 if (!video_frame.get() || !video_frame->HasTextures() || |
| 458 media::VideoFrame::NumPlanes(video_frame->format()) != 1) { | 460 media::VideoFrame::NumPlanes(video_frame->format()) != 1) { |
| 459 return false; | 461 return false; |
| 460 } | 462 } |
| 461 | 463 |
| 462 media::SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( | 464 media::SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( |
| 463 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, | 465 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, |
| 464 flip_y); | 466 flip_y); |
| 465 return true; | 467 return true; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 void WebMediaPlayerMS::ResetCanvasCache() { | 534 void WebMediaPlayerMS::ResetCanvasCache() { |
| 533 DCHECK(thread_checker_.CalledOnValidThread()); | 535 DCHECK(thread_checker_.CalledOnValidThread()); |
| 534 video_renderer_.ResetCache(); | 536 video_renderer_.ResetCache(); |
| 535 } | 537 } |
| 536 | 538 |
| 537 void WebMediaPlayerMS::TriggerResize() { | 539 void WebMediaPlayerMS::TriggerResize() { |
| 538 get_client()->sizeChanged(); | 540 get_client()->sizeChanged(); |
| 539 } | 541 } |
| 540 | 542 |
| 541 } // namespace content | 543 } // namespace content |
| OLD | NEW |