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

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

Issue 2562003003: Fix the size of video textures uploaded to WebGL. (Closed)
Patch Set: Created 4 years 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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 size_t WebMediaPlayerImpl::videoDecodedByteCount() const { 874 size_t WebMediaPlayerImpl::videoDecodedByteCount() const {
875 DCHECK(main_task_runner_->BelongsToCurrentThread()); 875 DCHECK(main_task_runner_->BelongsToCurrentThread());
876 876
877 PipelineStatistics stats = pipeline_.GetStatistics(); 877 PipelineStatistics stats = pipeline_.GetStatistics();
878 return stats.video_bytes_decoded; 878 return stats.video_bytes_decoded;
879 } 879 }
880 880
881 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( 881 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture(
882 gpu::gles2::GLES2Interface* gl, 882 gpu::gles2::GLES2Interface* gl,
883 unsigned int texture, 883 unsigned int texture,
884 unsigned int internal_format,
885 unsigned int type,
886 bool premultiply_alpha, 884 bool premultiply_alpha,
887 bool flip_y) { 885 bool flip_y) {
888 DCHECK(main_task_runner_->BelongsToCurrentThread()); 886 DCHECK(main_task_runner_->BelongsToCurrentThread());
889 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); 887 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture");
890 888
891 // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when 889 // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when
892 // we have other ways to check if decoder owns video frame. 890 // we have other ways to check if decoder owns video frame.
893 // See http://crbug.com/595716 and http://crbug.com/602708 891 // See http://crbug.com/595716 and http://crbug.com/602708
894 if (cdm_) 892 if (cdm_)
895 return false; 893 return false;
896 894
897 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); 895 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor();
898 if (!video_frame.get() || !video_frame->HasTextures()) { 896 if (!video_frame.get() || !video_frame->HasTextures()) {
899 return false; 897 return false;
900 } 898 }
901 899
902 Context3D context_3d; 900 Context3D context_3d;
903 if (!context_3d_cb_.is_null()) 901 if (!context_3d_cb_.is_null())
904 context_3d = context_3d_cb_.Run(); 902 context_3d = context_3d_cb_.Run();
905 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture( 903 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture(
906 context_3d, gl, video_frame.get(), texture, internal_format, type, 904 context_3d, gl, video_frame.get(), texture, premultiply_alpha, flip_y);
907 premultiply_alpha, flip_y);
908 } 905 }
909 906
910 void WebMediaPlayerImpl::setContentDecryptionModule( 907 void WebMediaPlayerImpl::setContentDecryptionModule(
911 blink::WebContentDecryptionModule* cdm, 908 blink::WebContentDecryptionModule* cdm,
912 blink::WebContentDecryptionModuleResult result) { 909 blink::WebContentDecryptionModuleResult result) {
913 DCHECK(main_task_runner_->BelongsToCurrentThread()); 910 DCHECK(main_task_runner_->BelongsToCurrentThread());
914 911
915 // Once the CDM is set it can't be cleared as there may be frames being 912 // Once the CDM is set it can't be cleared as there may be frames being
916 // decrypted on other threads. So fail this request. 913 // decrypted on other threads. So fail this request.
917 // http://crbug.com/462365#c7. 914 // http://crbug.com/462365#c7.
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 watch_time_reporter_->OnShown(); 1976 watch_time_reporter_->OnShown();
1980 } 1977 }
1981 1978
1982 bool WebMediaPlayerImpl::IsHidden() const { 1979 bool WebMediaPlayerImpl::IsHidden() const {
1983 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1980 DCHECK(main_task_runner_->BelongsToCurrentThread());
1984 1981
1985 return delegate_ && delegate_->IsHidden(); 1982 return delegate_ && delegate_->IsHidden();
1986 } 1983 }
1987 1984
1988 } // namespace media 1985 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698