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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 // that didLoadingProgress() can synchronously change state. | 870 // that didLoadingProgress() can synchronously change state. |
871 delegate_->ClearStaleFlag(delegate_id_); | 871 delegate_->ClearStaleFlag(delegate_id_); |
872 UpdatePlayState(); | 872 UpdatePlayState(); |
873 } | 873 } |
874 | 874 |
875 return did_loading_progress; | 875 return did_loading_progress; |
876 } | 876 } |
877 | 877 |
878 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, | 878 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, |
879 const blink::WebRect& rect, | 879 const blink::WebRect& rect, |
880 SkPaint& paint) { | 880 cc::PaintFlags& flags) { |
881 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 881 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
882 TRACE_EVENT0("media", "WebMediaPlayerImpl:paint"); | 882 TRACE_EVENT0("media", "WebMediaPlayerImpl:paint"); |
883 | 883 |
884 // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when | 884 // TODO(sandersd): Move this check into GetCurrentFrameFromCompositor() when |
885 // we have other ways to check if decoder owns video frame. | 885 // we have other ways to check if decoder owns video frame. |
886 // See http://crbug.com/595716 and http://crbug.com/602708 | 886 // See http://crbug.com/595716 and http://crbug.com/602708 |
887 if (cdm_) | 887 if (cdm_) |
888 return; | 888 return; |
889 | 889 |
890 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); | 890 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); |
891 | 891 |
892 gfx::Rect gfx_rect(rect); | 892 gfx::Rect gfx_rect(rect); |
893 Context3D context_3d; | 893 Context3D context_3d; |
894 if (video_frame.get() && video_frame->HasTextures()) { | 894 if (video_frame.get() && video_frame->HasTextures()) { |
895 if (!context_3d_cb_.is_null()) | 895 if (!context_3d_cb_.is_null()) |
896 context_3d = context_3d_cb_.Run(); | 896 context_3d = context_3d_cb_.Run(); |
897 if (!context_3d.gl) | 897 if (!context_3d.gl) |
898 return; // Unable to get/create a shared main thread context. | 898 return; // Unable to get/create a shared main thread context. |
899 if (!context_3d.gr_context) | 899 if (!context_3d.gr_context) |
900 return; // The context has been lost since and can't setup a GrContext. | 900 return; // The context has been lost since and can't setup a GrContext. |
901 } | 901 } |
902 skcanvas_video_renderer_.Paint(video_frame, canvas, gfx::RectF(gfx_rect), | 902 skcanvas_video_renderer_.Paint(video_frame, canvas, gfx::RectF(gfx_rect), |
903 paint, pipeline_metadata_.video_rotation, | 903 flags, pipeline_metadata_.video_rotation, |
904 context_3d); | 904 context_3d); |
905 } | 905 } |
906 | 906 |
907 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { | 907 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { |
908 if (data_source_) | 908 if (data_source_) |
909 return data_source_->HasSingleOrigin(); | 909 return data_source_->HasSingleOrigin(); |
910 return true; | 910 return true; |
911 } | 911 } |
912 | 912 |
913 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const { | 913 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const { |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 | 2312 |
2313 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { | 2313 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { |
2314 DCHECK(data_source_ || chunk_demuxer_); | 2314 DCHECK(data_source_ || chunk_demuxer_); |
2315 if (data_source_) | 2315 if (data_source_) |
2316 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); | 2316 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); |
2317 else | 2317 else |
2318 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); | 2318 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); |
2319 } | 2319 } |
2320 | 2320 |
2321 } // namespace media | 2321 } // namespace media |
OLD | NEW |