| 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 unsigned int internal_format, | 451 unsigned int internal_format, |
| 452 unsigned int type, | 452 unsigned int type, |
| 453 bool premultiply_alpha, | 453 bool premultiply_alpha, |
| 454 bool flip_y) { | 454 bool flip_y) { |
| 455 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); | 455 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); |
| 456 DCHECK(thread_checker_.CalledOnValidThread()); | 456 DCHECK(thread_checker_.CalledOnValidThread()); |
| 457 | 457 |
| 458 scoped_refptr<media::VideoFrame> video_frame = | 458 scoped_refptr<media::VideoFrame> video_frame = |
| 459 compositor_->GetCurrentFrameWithoutUpdatingStatistics(); | 459 compositor_->GetCurrentFrameWithoutUpdatingStatistics(); |
| 460 | 460 |
| 461 if (!video_frame.get() || !video_frame->HasTextures() || | 461 if (!video_frame.get() || !video_frame->HasTextures()) |
| 462 media::VideoFrame::NumPlanes(video_frame->format()) != 1) { | |
| 463 return false; | 462 return false; |
| 464 } | |
| 465 | 463 |
| 466 media::SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( | 464 media::Context3D context_3d; |
| 467 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, | 465 auto* provider = |
| 468 flip_y); | 466 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
| 469 return true; | 467 // GPU Process crashed. |
| 468 if (!provider) |
| 469 return false; |
| 470 context_3d = media::Context3D(provider->ContextGL(), provider->GrContext()); |
| 471 DCHECK(context_3d.gl); |
| 472 return video_renderer_.CopyVideoFrameTexturesToGLTexture( |
| 473 context_3d, gl, video_frame.get(), texture, internal_format, type, |
| 474 premultiply_alpha, flip_y); |
| 470 } | 475 } |
| 471 | 476 |
| 472 void WebMediaPlayerMS::OnFrameAvailable( | 477 void WebMediaPlayerMS::OnFrameAvailable( |
| 473 const scoped_refptr<media::VideoFrame>& frame) { | 478 const scoped_refptr<media::VideoFrame>& frame) { |
| 474 DVLOG(3) << __FUNCTION__; | 479 DVLOG(3) << __FUNCTION__; |
| 475 DCHECK(thread_checker_.CalledOnValidThread()); | 480 DCHECK(thread_checker_.CalledOnValidThread()); |
| 476 | 481 |
| 477 if (render_frame_suspended_) | 482 if (render_frame_suspended_) |
| 478 return; | 483 return; |
| 479 | 484 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 void WebMediaPlayerMS::ResetCanvasCache() { | 541 void WebMediaPlayerMS::ResetCanvasCache() { |
| 537 DCHECK(thread_checker_.CalledOnValidThread()); | 542 DCHECK(thread_checker_.CalledOnValidThread()); |
| 538 video_renderer_.ResetCache(); | 543 video_renderer_.ResetCache(); |
| 539 } | 544 } |
| 540 | 545 |
| 541 void WebMediaPlayerMS::TriggerResize() { | 546 void WebMediaPlayerMS::TriggerResize() { |
| 542 get_client()->sizeChanged(); | 547 get_client()->sizeChanged(); |
| 543 } | 548 } |
| 544 | 549 |
| 545 } // namespace content | 550 } // namespace content |
| OLD | NEW |