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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 // TODO(perkj, magjed): See TODO in OnPlay(). | 571 // TODO(perkj, magjed): See TODO in OnPlay(). |
572 } | 572 } |
573 | 573 |
574 void WebMediaPlayerMS::OnBecamePersistentVideo(bool value) { | 574 void WebMediaPlayerMS::OnBecamePersistentVideo(bool value) { |
575 get_client()->OnBecamePersistentVideo(value); | 575 get_client()->OnBecamePersistentVideo(value); |
576 } | 576 } |
577 | 577 |
578 bool WebMediaPlayerMS::CopyVideoTextureToPlatformTexture( | 578 bool WebMediaPlayerMS::CopyVideoTextureToPlatformTexture( |
579 gpu::gles2::GLES2Interface* gl, | 579 gpu::gles2::GLES2Interface* gl, |
580 unsigned int texture, | 580 unsigned int texture, |
581 unsigned internal_format, | |
582 unsigned format, | |
583 unsigned type, | |
584 bool premultiply_alpha, | 581 bool premultiply_alpha, |
585 bool flip_y) { | 582 bool flip_y) { |
586 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); | 583 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); |
587 DCHECK(thread_checker_.CalledOnValidThread()); | 584 DCHECK(thread_checker_.CalledOnValidThread()); |
588 | 585 |
589 scoped_refptr<media::VideoFrame> video_frame = | 586 scoped_refptr<media::VideoFrame> video_frame = |
590 compositor_->GetCurrentFrameWithoutUpdatingStatistics(); | 587 compositor_->GetCurrentFrameWithoutUpdatingStatistics(); |
591 | 588 |
592 if (!video_frame.get() || !video_frame->HasTextures()) | 589 if (!video_frame.get() || !video_frame->HasTextures()) |
593 return false; | 590 return false; |
594 | 591 |
595 media::Context3D context_3d; | 592 media::Context3D context_3d; |
596 auto* provider = | 593 auto* provider = |
597 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 594 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
598 // GPU Process crashed. | 595 // GPU Process crashed. |
599 if (!provider) | 596 if (!provider) |
600 return false; | 597 return false; |
601 context_3d = media::Context3D(provider->ContextGL(), provider->GrContext()); | 598 context_3d = media::Context3D(provider->ContextGL(), provider->GrContext()); |
602 DCHECK(context_3d.gl); | 599 DCHECK(context_3d.gl); |
603 return video_renderer_.CopyVideoFrameTexturesToGLTexture( | 600 return video_renderer_.CopyVideoFrameTexturesToGLTexture( |
604 context_3d, gl, video_frame.get(), texture, internal_format, format, type, | 601 context_3d, gl, video_frame.get(), texture, premultiply_alpha, flip_y); |
605 premultiply_alpha, flip_y); | |
606 } | 602 } |
607 | 603 |
608 bool WebMediaPlayerMS::TexImageImpl(TexImageFunctionID functionID, | 604 bool WebMediaPlayerMS::TexImageImpl(TexImageFunctionID functionID, |
609 unsigned target, | 605 unsigned target, |
610 gpu::gles2::GLES2Interface* gl, | 606 gpu::gles2::GLES2Interface* gl, |
611 int level, | 607 int level, |
612 int internalformat, | 608 int internalformat, |
613 unsigned format, | 609 unsigned format, |
614 unsigned type, | 610 unsigned type, |
615 int xoffset, | 611 int xoffset, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 void WebMediaPlayerMS::ResetCanvasCache() { | 703 void WebMediaPlayerMS::ResetCanvasCache() { |
708 DCHECK(thread_checker_.CalledOnValidThread()); | 704 DCHECK(thread_checker_.CalledOnValidThread()); |
709 video_renderer_.ResetCache(); | 705 video_renderer_.ResetCache(); |
710 } | 706 } |
711 | 707 |
712 void WebMediaPlayerMS::TriggerResize() { | 708 void WebMediaPlayerMS::TriggerResize() { |
713 get_client()->SizeChanged(); | 709 get_client()->SizeChanged(); |
714 } | 710 } |
715 | 711 |
716 } // namespace content | 712 } // namespace content |
OLD | NEW |