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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | |
949 bool premultiply_alpha, | 946 bool premultiply_alpha, |
950 bool flip_y) { | 947 bool flip_y) { |
951 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 948 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
952 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); | 949 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); |
953 | 950 |
954 // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when | 951 // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when |
955 // we have other ways to check if decoder owns video frame. | 952 // we have other ways to check if decoder owns video frame. |
956 // See http://crbug.com/595716 and http://crbug.com/602708 | 953 // See http://crbug.com/595716 and http://crbug.com/602708 |
957 if (cdm_) | 954 if (cdm_) |
958 return false; | 955 return false; |
959 | 956 |
960 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); | 957 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); |
961 if (!video_frame.get() || !video_frame->HasTextures()) { | 958 if (!video_frame.get() || !video_frame->HasTextures()) { |
962 return false; | 959 return false; |
963 } | 960 } |
964 | 961 |
965 Context3D context_3d; | 962 Context3D context_3d; |
966 if (!context_3d_cb_.is_null()) | 963 if (!context_3d_cb_.is_null()) |
967 context_3d = context_3d_cb_.Run(); | 964 context_3d = context_3d_cb_.Run(); |
968 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture( | 965 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture( |
969 context_3d, gl, video_frame.get(), texture, internal_format, format, type, | 966 context_3d, gl, video_frame.get(), texture, premultiply_alpha, flip_y); |
970 premultiply_alpha, flip_y); | |
971 } | 967 } |
972 | 968 |
973 void WebMediaPlayerImpl::SetContentDecryptionModule( | 969 void WebMediaPlayerImpl::SetContentDecryptionModule( |
974 blink::WebContentDecryptionModule* cdm, | 970 blink::WebContentDecryptionModule* cdm, |
975 blink::WebContentDecryptionModuleResult result) { | 971 blink::WebContentDecryptionModuleResult result) { |
976 DVLOG(1) << __func__ << ": cdm = " << cdm; | 972 DVLOG(1) << __func__ << ": cdm = " << cdm; |
977 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 973 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
978 | 974 |
979 // Once the CDM is set it can't be cleared as there may be frames being | 975 // Once the CDM is set it can't be cleared as there may be frames being |
980 // decrypted on other threads. So fail this request. | 976 // decrypted on other threads. So fail this request. |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 | 2338 |
2343 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { | 2339 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { |
2344 DCHECK(data_source_ || chunk_demuxer_); | 2340 DCHECK(data_source_ || chunk_demuxer_); |
2345 if (data_source_) | 2341 if (data_source_) |
2346 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); | 2342 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); |
2347 else | 2343 else |
2348 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); | 2344 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); |
2349 } | 2345 } |
2350 | 2346 |
2351 } // namespace media | 2347 } // namespace media |
OLD | NEW |