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(); |
Daniele Castagna
2016/07/11 18:23:35
Isn't there a way to get a context provider withou
| |
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 media::SkCanvasVideoRenderer::CopyVideoFrameTexturesToGLTexture( | |
Daniele Castagna
2016/07/11 18:23:35
When is gl different than context_3d.gl?
| |
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
538 void WebMediaPlayerMS::ResetCanvasCache() { | 543 void WebMediaPlayerMS::ResetCanvasCache() { |
539 DCHECK(thread_checker_.CalledOnValidThread()); | 544 DCHECK(thread_checker_.CalledOnValidThread()); |
540 video_renderer_.ResetCache(); | 545 video_renderer_.ResetCache(); |
541 } | 546 } |
542 | 547 |
543 void WebMediaPlayerMS::TriggerResize() { | 548 void WebMediaPlayerMS::TriggerResize() { |
544 get_client()->sizeChanged(); | 549 get_client()->sizeChanged(); |
545 } | 550 } |
546 | 551 |
547 } // namespace content | 552 } // namespace content |
OLD | NEW |