| 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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 gpu::gles2::GLES2Interface* gl, | 812 gpu::gles2::GLES2Interface* gl, |
| 813 unsigned int texture, | 813 unsigned int texture, |
| 814 unsigned int internal_format, | 814 unsigned int internal_format, |
| 815 unsigned int type, | 815 unsigned int type, |
| 816 bool premultiply_alpha, | 816 bool premultiply_alpha, |
| 817 bool flip_y) { | 817 bool flip_y) { |
| 818 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); | 818 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); |
| 819 | 819 |
| 820 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); | 820 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); |
| 821 | 821 |
| 822 if (!video_frame.get() || !video_frame->HasTextures() || | 822 if (!video_frame.get() || !video_frame->HasTextures()) { |
| 823 media::VideoFrame::NumPlanes(video_frame->format()) != 1) { | |
| 824 return false; | 823 return false; |
| 825 } | 824 } |
| 826 | 825 |
| 827 SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( | 826 Context3D context_3d; |
| 828 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, | 827 if (!context_3d_cb_.is_null()) |
| 829 flip_y); | 828 context_3d = context_3d_cb_.Run(); |
| 830 return true; | 829 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture( |
| 830 context_3d, gl, video_frame.get(), texture, internal_format, type, |
| 831 premultiply_alpha, flip_y); |
| 831 } | 832 } |
| 832 | 833 |
| 833 void WebMediaPlayerImpl::setContentDecryptionModule( | 834 void WebMediaPlayerImpl::setContentDecryptionModule( |
| 834 blink::WebContentDecryptionModule* cdm, | 835 blink::WebContentDecryptionModule* cdm, |
| 835 blink::WebContentDecryptionModuleResult result) { | 836 blink::WebContentDecryptionModuleResult result) { |
| 836 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 837 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 837 | 838 |
| 838 // Once the CDM is set it can't be cleared as there may be frames being | 839 // Once the CDM is set it can't be cleared as there may be frames being |
| 839 // decrypted on other threads. So fail this request. | 840 // decrypted on other threads. So fail this request. |
| 840 // http://crbug.com/462365#c7. | 841 // http://crbug.com/462365#c7. |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1719 if (isRemote()) | 1720 if (isRemote()) |
| 1720 return; | 1721 return; |
| 1721 #endif | 1722 #endif |
| 1722 | 1723 |
| 1723 // Idle timeout chosen arbitrarily. | 1724 // Idle timeout chosen arbitrarily. |
| 1724 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), | 1725 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), |
| 1725 this, &WebMediaPlayerImpl::OnPause); | 1726 this, &WebMediaPlayerImpl::OnPause); |
| 1726 } | 1727 } |
| 1727 | 1728 |
| 1728 } // namespace media | 1729 } // namespace media |
| OLD | NEW |