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

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

Issue 2791813003: Fix broken draw/upload paths from videos to 2D canvas and WebGL. (Closed)
Patch Set: Disable GPU-GPU copies to floating-point textures on Android. Created 3 years, 8 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
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/renderers/skcanvas_video_renderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 size_t WebMediaPlayerImpl::VideoDecodedByteCount() const { 936 size_t WebMediaPlayerImpl::VideoDecodedByteCount() const {
937 DCHECK(main_task_runner_->BelongsToCurrentThread()); 937 DCHECK(main_task_runner_->BelongsToCurrentThread());
938 938
939 PipelineStatistics stats = GetPipelineStatistics(); 939 PipelineStatistics stats = GetPipelineStatistics();
940 return stats.video_bytes_decoded; 940 return stats.video_bytes_decoded;
941 } 941 }
942 942
943 bool WebMediaPlayerImpl::CopyVideoTextureToPlatformTexture( 943 bool WebMediaPlayerImpl::CopyVideoTextureToPlatformTexture(
944 gpu::gles2::GLES2Interface* gl, 944 gpu::gles2::GLES2Interface* gl,
945 unsigned int texture, 945 unsigned int texture,
946 unsigned internal_format,
947 unsigned format,
948 unsigned type,
946 bool premultiply_alpha, 949 bool premultiply_alpha,
947 bool flip_y) { 950 bool flip_y) {
948 DCHECK(main_task_runner_->BelongsToCurrentThread()); 951 DCHECK(main_task_runner_->BelongsToCurrentThread());
949 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); 952 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture");
950 953
951 // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when 954 // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when
952 // we have other ways to check if decoder owns video frame. 955 // we have other ways to check if decoder owns video frame.
953 // See http://crbug.com/595716 and http://crbug.com/602708 956 // See http://crbug.com/595716 and http://crbug.com/602708
954 if (cdm_) 957 if (cdm_)
955 return false; 958 return false;
956 959
957 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); 960 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor();
958 if (!video_frame.get() || !video_frame->HasTextures()) { 961 if (!video_frame.get() || !video_frame->HasTextures()) {
959 return false; 962 return false;
960 } 963 }
961 964
962 Context3D context_3d; 965 Context3D context_3d;
963 if (!context_3d_cb_.is_null()) 966 if (!context_3d_cb_.is_null())
964 context_3d = context_3d_cb_.Run(); 967 context_3d = context_3d_cb_.Run();
965 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture( 968 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture(
966 context_3d, gl, video_frame.get(), texture, premultiply_alpha, flip_y); 969 context_3d, gl, video_frame.get(), texture, internal_format, format, type,
970 premultiply_alpha, flip_y);
967 } 971 }
968 972
969 void WebMediaPlayerImpl::SetContentDecryptionModule( 973 void WebMediaPlayerImpl::SetContentDecryptionModule(
970 blink::WebContentDecryptionModule* cdm, 974 blink::WebContentDecryptionModule* cdm,
971 blink::WebContentDecryptionModuleResult result) { 975 blink::WebContentDecryptionModuleResult result) {
972 DVLOG(1) << __func__ << ": cdm = " << cdm; 976 DVLOG(1) << __func__ << ": cdm = " << cdm;
973 DCHECK(main_task_runner_->BelongsToCurrentThread()); 977 DCHECK(main_task_runner_->BelongsToCurrentThread());
974 978
975 // Once the CDM is set it can't be cleared as there may be frames being 979 // Once the CDM is set it can't be cleared as there may be frames being
976 // decrypted on other threads. So fail this request. 980 // decrypted on other threads. So fail this request.
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
2338 2342
2339 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { 2343 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) {
2340 DCHECK(data_source_ || chunk_demuxer_); 2344 DCHECK(data_source_ || chunk_demuxer_);
2341 if (data_source_) 2345 if (data_source_)
2342 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); 2346 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration);
2343 else 2347 else
2344 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); 2348 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration);
2345 } 2349 }
2346 2350
2347 } // namespace media 2351 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/renderers/skcanvas_video_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698