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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 | 941 |
942 size_t WebMediaPlayerImpl::VideoDecodedByteCount() const { | 942 size_t WebMediaPlayerImpl::VideoDecodedByteCount() const { |
943 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 943 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
944 | 944 |
945 PipelineStatistics stats = GetPipelineStatistics(); | 945 PipelineStatistics stats = GetPipelineStatistics(); |
946 return stats.video_bytes_decoded; | 946 return stats.video_bytes_decoded; |
947 } | 947 } |
948 | 948 |
949 bool WebMediaPlayerImpl::CopyVideoTextureToPlatformTexture( | 949 bool WebMediaPlayerImpl::CopyVideoTextureToPlatformTexture( |
950 gpu::gles2::GLES2Interface* gl, | 950 gpu::gles2::GLES2Interface* gl, |
| 951 unsigned int target, |
951 unsigned int texture, | 952 unsigned int texture, |
952 unsigned internal_format, | 953 unsigned internal_format, |
953 unsigned format, | 954 unsigned format, |
954 unsigned type, | 955 unsigned type, |
| 956 int level, |
955 bool premultiply_alpha, | 957 bool premultiply_alpha, |
956 bool flip_y) { | 958 bool flip_y) { |
957 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 959 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
958 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); | 960 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); |
959 | 961 |
960 // We can't copy from protected frames. | 962 // We can't copy from protected frames. |
961 if (cdm_) | 963 if (cdm_) |
962 return false; | 964 return false; |
963 | 965 |
964 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); | 966 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); |
965 if (!video_frame.get() || !video_frame->HasTextures()) { | 967 if (!video_frame.get() || !video_frame->HasTextures()) { |
966 return false; | 968 return false; |
967 } | 969 } |
968 | 970 |
969 Context3D context_3d; | 971 Context3D context_3d; |
970 if (!context_3d_cb_.is_null()) | 972 if (!context_3d_cb_.is_null()) |
971 context_3d = context_3d_cb_.Run(); | 973 context_3d = context_3d_cb_.Run(); |
972 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture( | 974 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture( |
973 context_3d, gl, video_frame.get(), texture, internal_format, format, type, | 975 context_3d, gl, video_frame.get(), target, texture, internal_format, |
974 premultiply_alpha, flip_y); | 976 format, type, level, premultiply_alpha, flip_y); |
975 } | 977 } |
976 | 978 |
977 void WebMediaPlayerImpl::SetContentDecryptionModule( | 979 void WebMediaPlayerImpl::SetContentDecryptionModule( |
978 blink::WebContentDecryptionModule* cdm, | 980 blink::WebContentDecryptionModule* cdm, |
979 blink::WebContentDecryptionModuleResult result) { | 981 blink::WebContentDecryptionModuleResult result) { |
980 DVLOG(1) << __func__ << ": cdm = " << cdm; | 982 DVLOG(1) << __func__ << ": cdm = " << cdm; |
981 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 983 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
982 | 984 |
983 // Once the CDM is set it can't be cleared as there may be frames being | 985 // Once the CDM is set it can't be cleared as there may be frames being |
984 // decrypted on other threads. So fail this request. | 986 // decrypted on other threads. So fail this request. |
(...skipping 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2395 | 2397 |
2396 if (is_encrypted_) | 2398 if (is_encrypted_) |
2397 UMA_HISTOGRAM_VIDEO_HEIGHT("Media.VideoHeight.Initial.EME", height); | 2399 UMA_HISTOGRAM_VIDEO_HEIGHT("Media.VideoHeight.Initial.EME", height); |
2398 | 2400 |
2399 UMA_HISTOGRAM_VIDEO_HEIGHT("Media.VideoHeight.Initial.All", height); | 2401 UMA_HISTOGRAM_VIDEO_HEIGHT("Media.VideoHeight.Initial.All", height); |
2400 } | 2402 } |
2401 | 2403 |
2402 #undef UMA_HISTOGRAM_VIDEO_HEIGHT | 2404 #undef UMA_HISTOGRAM_VIDEO_HEIGHT |
2403 | 2405 |
2404 } // namespace media | 2406 } // namespace media |
OLD | NEW |