| 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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 size_t WebMediaPlayerImpl::videoDecodedByteCount() const { | 951 size_t WebMediaPlayerImpl::videoDecodedByteCount() const { |
| 952 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 952 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 953 | 953 |
| 954 PipelineStatistics stats = GetPipelineStatistics(); | 954 PipelineStatistics stats = GetPipelineStatistics(); |
| 955 return stats.video_bytes_decoded; | 955 return stats.video_bytes_decoded; |
| 956 } | 956 } |
| 957 | 957 |
| 958 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( | 958 bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture( |
| 959 gpu::gles2::GLES2Interface* gl, | 959 gpu::gles2::GLES2Interface* gl, |
| 960 unsigned int texture, | 960 unsigned int texture, |
| 961 unsigned int internal_format, |
| 962 unsigned int type, |
| 961 bool premultiply_alpha, | 963 bool premultiply_alpha, |
| 962 bool flip_y) { | 964 bool flip_y) { |
| 963 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 965 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 964 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); | 966 TRACE_EVENT0("media", "WebMediaPlayerImpl:copyVideoTextureToPlatformTexture"); |
| 965 | 967 |
| 966 // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when | 968 // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when |
| 967 // we have other ways to check if decoder owns video frame. | 969 // we have other ways to check if decoder owns video frame. |
| 968 // See http://crbug.com/595716 and http://crbug.com/602708 | 970 // See http://crbug.com/595716 and http://crbug.com/602708 |
| 969 if (cdm_) | 971 if (cdm_) |
| 970 return false; | 972 return false; |
| 971 | 973 |
| 972 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); | 974 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); |
| 973 if (!video_frame.get() || !video_frame->HasTextures()) { | 975 if (!video_frame.get() || !video_frame->HasTextures()) { |
| 974 return false; | 976 return false; |
| 975 } | 977 } |
| 976 | 978 |
| 977 Context3D context_3d; | 979 Context3D context_3d; |
| 978 if (!context_3d_cb_.is_null()) | 980 if (!context_3d_cb_.is_null()) |
| 979 context_3d = context_3d_cb_.Run(); | 981 context_3d = context_3d_cb_.Run(); |
| 980 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture( | 982 return skcanvas_video_renderer_.CopyVideoFrameTexturesToGLTexture( |
| 981 context_3d, gl, video_frame.get(), texture, premultiply_alpha, flip_y); | 983 context_3d, gl, video_frame.get(), texture, internal_format, type, |
| 984 premultiply_alpha, flip_y); |
| 982 } | 985 } |
| 983 | 986 |
| 984 void WebMediaPlayerImpl::setContentDecryptionModule( | 987 void WebMediaPlayerImpl::setContentDecryptionModule( |
| 985 blink::WebContentDecryptionModule* cdm, | 988 blink::WebContentDecryptionModule* cdm, |
| 986 blink::WebContentDecryptionModuleResult result) { | 989 blink::WebContentDecryptionModuleResult result) { |
| 987 DVLOG(1) << __func__ << ": cdm = " << cdm; | 990 DVLOG(1) << __func__ << ": cdm = " << cdm; |
| 988 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 991 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 989 | 992 |
| 990 // Once the CDM is set it can't be cleared as there may be frames being | 993 // Once the CDM is set it can't be cleared as there may be frames being |
| 991 // decrypted on other threads. So fail this request. | 994 // decrypted on other threads. So fail this request. |
| (...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2346 | 2349 |
| 2347 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { | 2350 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { |
| 2348 DCHECK(data_source_ || chunk_demuxer_); | 2351 DCHECK(data_source_ || chunk_demuxer_); |
| 2349 if (data_source_) | 2352 if (data_source_) |
| 2350 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); | 2353 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); |
| 2351 else | 2354 else |
| 2352 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); | 2355 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); |
| 2353 } | 2356 } |
| 2354 | 2357 |
| 2355 } // namespace media | 2358 } // namespace media |
| OLD | NEW |