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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 size_t WebMediaPlayerImpl::videoDecodedByteCount() const { | 932 size_t WebMediaPlayerImpl::videoDecodedByteCount() const { |
933 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 933 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
934 | 934 |
935 PipelineStatistics stats = GetPipelineStatistics(); | 935 PipelineStatistics stats = GetPipelineStatistics(); |
936 return stats.video_bytes_decoded; | 936 return stats.video_bytes_decoded; |
937 } | 937 } |
938 | 938 |
939 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( | 939 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( |
940 gpu::gles2::GLES2Interface* gl, | 940 gpu::gles2::GLES2Interface* gl, |
941 unsigned int texture, | 941 unsigned int texture, |
| 942 unsigned internal_format, |
| 943 unsigned type, |
942 bool premultiply_alpha, | 944 bool premultiply_alpha, |
943 bool flip_y) { | 945 bool flip_y) { |
944 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 946 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
945 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); | 947 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); |
946 | 948 |
947 // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when | 949 // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when |
948 // we have other ways to check if decoder owns video frame. | 950 // we have other ways to check if decoder owns video frame. |
949 // See http://crbug.com/595716 and http://crbug.com/602708 | 951 // See http://crbug.com/595716 and http://crbug.com/602708 |
950 if (cdm_) | 952 if (cdm_) |
951 return false; | 953 return false; |
952 | 954 |
953 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); | 955 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); |
954 if (!video_frame.get() || !video_frame->HasTextures()) { | 956 if (!video_frame.get() || !video_frame->HasTextures()) { |
955 return false; | 957 return false; |
956 } | 958 } |
957 | 959 |
958 Context3D context_3d; | 960 Context3D context_3d; |
959 if (!context_3d_cb_.is_null()) | 961 if (!context_3d_cb_.is_null()) |
960 context_3d = context_3d_cb_.Run(); | 962 context_3d = context_3d_cb_.Run(); |
961 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture( | 963 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture( |
962 context_3d, gl, video_frame.get(), texture, premultiply_alpha, flip_y); | 964 context_3d, gl, video_frame.get(), texture, internal_format, type, |
| 965 premultiply_alpha, flip_y); |
963 } | 966 } |
964 | 967 |
965 void WebMediaPlayerImpl::setContentDecryptionModule( | 968 void WebMediaPlayerImpl::setContentDecryptionModule( |
966 blink::WebContentDecryptionModule* cdm, | 969 blink::WebContentDecryptionModule* cdm, |
967 blink::WebContentDecryptionModuleResult result) { | 970 blink::WebContentDecryptionModuleResult result) { |
968 DVLOG(1) << __func__ << ": cdm = " << cdm; | 971 DVLOG(1) << __func__ << ": cdm = " << cdm; |
969 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 972 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
970 | 973 |
971 // Once the CDM is set it can't be cleared as there may be frames being | 974 // Once the CDM is set it can't be cleared as there may be frames being |
972 // decrypted on other threads. So fail this request. | 975 // decrypted on other threads. So fail this request. |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2325 | 2328 |
2326 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { | 2329 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { |
2327 DCHECK(data_source_ || chunk_demuxer_); | 2330 DCHECK(data_source_ || chunk_demuxer_); |
2328 if (data_source_) | 2331 if (data_source_) |
2329 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); | 2332 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); |
2330 else | 2333 else |
2331 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); | 2334 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); |
2332 } | 2335 } |
2333 | 2336 |
2334 } // namespace media | 2337 } // namespace media |
OLD | NEW |