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 "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <string> | 10 #include <string> |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 } | 749 } |
750 | 750 |
751 size_t WebMediaPlayerImpl::videoDecodedByteCount() const { | 751 size_t WebMediaPlayerImpl::videoDecodedByteCount() const { |
752 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 752 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
753 | 753 |
754 PipelineStatistics stats = pipeline_.GetStatistics(); | 754 PipelineStatistics stats = pipeline_.GetStatistics(); |
755 return stats.video_bytes_decoded; | 755 return stats.video_bytes_decoded; |
756 } | 756 } |
757 | 757 |
758 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( | 758 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( |
759 blink::WebGraphicsContext3D* web_graphics_context, | 759 gpu::gles2::GLES2Interface* gl, |
760 unsigned int texture, | 760 unsigned int texture, |
761 unsigned int internal_format, | 761 unsigned int internal_format, |
762 unsigned int type, | 762 unsigned int type, |
763 bool premultiply_alpha, | 763 bool premultiply_alpha, |
764 bool flip_y) { | 764 bool flip_y) { |
765 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); | 765 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); |
766 | 766 |
767 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); | 767 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); |
768 | 768 |
769 if (!video_frame.get() || !video_frame->HasTextures() || | 769 if (!video_frame.get() || !video_frame->HasTextures() || |
770 media::VideoFrame::NumPlanes(video_frame->format()) != 1) { | 770 media::VideoFrame::NumPlanes(video_frame->format()) != 1) { |
771 return false; | 771 return false; |
772 } | 772 } |
773 | 773 |
774 // TODO(dshwang): need more elegant way to convert WebGraphicsContext3D to | |
775 // GLES2Interface. | |
776 gpu::gles2::GLES2Interface* gl = | |
777 static_cast<gpu_blink::WebGraphicsContext3DImpl*>(web_graphics_context) | |
778 ->GetGLInterface(); | |
779 SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( | 774 SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( |
780 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, | 775 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, |
781 flip_y); | 776 flip_y); |
782 return true; | 777 return true; |
783 } | 778 } |
784 | 779 |
785 void WebMediaPlayerImpl::setContentDecryptionModule( | 780 void WebMediaPlayerImpl::setContentDecryptionModule( |
786 blink::WebContentDecryptionModule* cdm, | 781 blink::WebContentDecryptionModule* cdm, |
787 blink::WebContentDecryptionModuleResult result) { | 782 blink::WebContentDecryptionModuleResult result) { |
788 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 783 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() { | 1552 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() { |
1558 #if defined(OS_ANDROID) | 1553 #if defined(OS_ANDROID) |
1559 return !hasVideo() || (delegate_ && !delegate_->IsHidden()); | 1554 return !hasVideo() || (delegate_ && !delegate_->IsHidden()); |
1560 #else | 1555 #else |
1561 // On non-Android platforms Resume() is always allowed. | 1556 // On non-Android platforms Resume() is always allowed. |
1562 return true; | 1557 return true; |
1563 #endif | 1558 #endif |
1564 } | 1559 } |
1565 | 1560 |
1566 } // namespace media | 1561 } // namespace media |
OLD | NEW |