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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 unsigned int internal_format, | 458 unsigned int internal_format, |
459 unsigned int type, | 459 unsigned int type, |
460 bool premultiply_alpha, | 460 bool premultiply_alpha, |
461 bool flip_y) { | 461 bool flip_y) { |
462 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); | 462 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); |
463 DCHECK(thread_checker_.CalledOnValidThread()); | 463 DCHECK(thread_checker_.CalledOnValidThread()); |
464 | 464 |
465 scoped_refptr<media::VideoFrame> video_frame = | 465 scoped_refptr<media::VideoFrame> video_frame = |
466 compositor_->GetCurrentFrameWithoutUpdatingStatistics(); | 466 compositor_->GetCurrentFrameWithoutUpdatingStatistics(); |
467 | 467 |
468 if (!video_frame.get() || !video_frame->HasTextures() || | 468 if (!video_frame.get() || !video_frame->HasTextures()) |
469 media::VideoFrame::NumPlanes(video_frame->format()) != 1) { | |
470 return false; | 469 return false; |
471 } | |
472 | 470 |
473 media::SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( | 471 media::Context3D context_3d; |
474 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, | 472 auto* provider = |
475 flip_y); | 473 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
476 return true; | 474 // GPU Process crashed. |
| 475 if (!provider) |
| 476 return false; |
| 477 context_3d = media::Context3D(provider->ContextGL(), provider->GrContext()); |
| 478 DCHECK(context_3d.gl); |
| 479 return video_renderer_.CopyVideoFrameTexturesToGLTexture( |
| 480 context_3d, gl, video_frame.get(), texture, internal_format, type, |
| 481 premultiply_alpha, flip_y); |
477 } | 482 } |
478 | 483 |
479 void WebMediaPlayerMS::OnFrameAvailable( | 484 void WebMediaPlayerMS::OnFrameAvailable( |
480 const scoped_refptr<media::VideoFrame>& frame) { | 485 const scoped_refptr<media::VideoFrame>& frame) { |
481 DVLOG(3) << __FUNCTION__; | 486 DVLOG(3) << __FUNCTION__; |
482 DCHECK(thread_checker_.CalledOnValidThread()); | 487 DCHECK(thread_checker_.CalledOnValidThread()); |
483 | 488 |
484 if (render_frame_suspended_) | 489 if (render_frame_suspended_) |
485 return; | 490 return; |
486 | 491 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 void WebMediaPlayerMS::ResetCanvasCache() { | 551 void WebMediaPlayerMS::ResetCanvasCache() { |
547 DCHECK(thread_checker_.CalledOnValidThread()); | 552 DCHECK(thread_checker_.CalledOnValidThread()); |
548 video_renderer_.ResetCache(); | 553 video_renderer_.ResetCache(); |
549 } | 554 } |
550 | 555 |
551 void WebMediaPlayerMS::TriggerResize() { | 556 void WebMediaPlayerMS::TriggerResize() { |
552 get_client()->sizeChanged(); | 557 get_client()->sizeChanged(); |
553 } | 558 } |
554 | 559 |
555 } // namespace content | 560 } // namespace content |
OLD | NEW |