Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 2127053004: Optimize webgl texImage2D from YUV video textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@skianocopy
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 gpu::gles2::GLES2Interface* gl, 797 gpu::gles2::GLES2Interface* gl,
798 unsigned int texture, 798 unsigned int texture,
799 unsigned int internal_format, 799 unsigned int internal_format,
800 unsigned int type, 800 unsigned int type,
801 bool premultiply_alpha, 801 bool premultiply_alpha,
802 bool flip_y) { 802 bool flip_y) {
803 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); 803 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture");
804 804
805 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); 805 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor();
806 806
807 if (!video_frame.get() || !video_frame->HasTextures() || 807 if (!video_frame.get() || !video_frame->HasTextures()) {
808 media::VideoFrame::NumPlanes(video_frame->format()) != 1) {
809 return false; 808 return false;
810 } 809 }
811 810
812 SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( 811 Context3D context_3d;
813 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, 812 if (!context_3d_cb_.is_null())
814 flip_y); 813 context_3d = context_3d_cb_.Run();
815 return true; 814 return SkCanvasVideoRenderer::CopyVideoFrameTexturesToGLTexture(
815 context_3d, gl, video_frame.get(), texture, internal_format, type,
816 premultiply_alpha, flip_y);
816 } 817 }
817 818
818 void WebMediaPlayerImpl::setContentDecryptionModule( 819 void WebMediaPlayerImpl::setContentDecryptionModule(
819 blink::WebContentDecryptionModule* cdm, 820 blink::WebContentDecryptionModule* cdm,
820 blink::WebContentDecryptionModuleResult result) { 821 blink::WebContentDecryptionModuleResult result) {
821 DCHECK(main_task_runner_->BelongsToCurrentThread()); 822 DCHECK(main_task_runner_->BelongsToCurrentThread());
822 823
823 // Once the CDM is set it can't be cleared as there may be frames being 824 // Once the CDM is set it can't be cleared as there may be frames being
824 // decrypted on other threads. So fail this request. 825 // decrypted on other threads. So fail this request.
825 // http://crbug.com/462365#c7. 826 // http://crbug.com/462365#c7.
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 if (isRemote()) 1691 if (isRemote())
1691 return; 1692 return;
1692 #endif 1693 #endif
1693 1694
1694 // Idle timeout chosen arbitrarily. 1695 // Idle timeout chosen arbitrarily.
1695 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), 1696 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5),
1696 this, &WebMediaPlayerImpl::OnPause); 1697 this, &WebMediaPlayerImpl::OnPause);
1697 } 1698 }
1698 1699
1699 } // namespace media 1700 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698