| 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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 pipeline_controller_.IsSuspended() && did_loading_progress && is_idle_) { | 768 pipeline_controller_.IsSuspended() && did_loading_progress && is_idle_) { |
| 769 is_idle_ = false; | 769 is_idle_ = false; |
| 770 UpdatePlayState(); | 770 UpdatePlayState(); |
| 771 } | 771 } |
| 772 | 772 |
| 773 return did_loading_progress; | 773 return did_loading_progress; |
| 774 } | 774 } |
| 775 | 775 |
| 776 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, | 776 void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas, |
| 777 const blink::WebRect& rect, | 777 const blink::WebRect& rect, |
| 778 unsigned char alpha, | 778 SkPaint& paint) { |
| 779 SkXfermode::Mode mode) { | |
| 780 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 779 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 781 TRACE_EVENT0("media", "WebMediaPlayerImpl:paint"); | 780 TRACE_EVENT0("media", "WebMediaPlayerImpl:paint"); |
| 782 | 781 |
| 783 if (is_cdm_attached_) | 782 if (is_cdm_attached_) |
| 784 return; | 783 return; |
| 785 | 784 |
| 786 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); | 785 scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor(); |
| 787 | 786 |
| 788 gfx::Rect gfx_rect(rect); | 787 gfx::Rect gfx_rect(rect); |
| 789 Context3D context_3d; | 788 Context3D context_3d; |
| 790 if (video_frame.get() && video_frame->HasTextures()) { | 789 if (video_frame.get() && video_frame->HasTextures()) { |
| 791 if (!context_3d_cb_.is_null()) | 790 if (!context_3d_cb_.is_null()) |
| 792 context_3d = context_3d_cb_.Run(); | 791 context_3d = context_3d_cb_.Run(); |
| 793 if (!context_3d.gl) | 792 if (!context_3d.gl) |
| 794 return; // Unable to get/create a shared main thread context. | 793 return; // Unable to get/create a shared main thread context. |
| 795 if (!context_3d.gr_context) | 794 if (!context_3d.gr_context) |
| 796 return; // The context has been lost since and can't setup a GrContext. | 795 return; // The context has been lost since and can't setup a GrContext. |
| 797 } | 796 } |
| 798 skcanvas_video_renderer_.Paint(video_frame, canvas, gfx::RectF(gfx_rect), | 797 skcanvas_video_renderer_.Paint(video_frame, canvas, gfx::RectF(gfx_rect), |
| 799 alpha, mode, pipeline_metadata_.video_rotation, | 798 paint, pipeline_metadata_.video_rotation, |
| 800 context_3d); | 799 context_3d); |
| 801 } | 800 } |
| 802 | 801 |
| 803 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { | 802 bool WebMediaPlayerImpl::hasSingleSecurityOrigin() const { |
| 804 if (data_source_) | 803 if (data_source_) |
| 805 return data_source_->HasSingleOrigin(); | 804 return data_source_->HasSingleOrigin(); |
| 806 return true; | 805 return true; |
| 807 } | 806 } |
| 808 | 807 |
| 809 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const { | 808 bool WebMediaPlayerImpl::didPassCORSAccessCheck() const { |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1814 pipeline_metadata_.natural_size, | 1813 pipeline_metadata_.natural_size, |
| 1815 base::Bind(&GetCurrentTimeInternal, this))); | 1814 base::Bind(&GetCurrentTimeInternal, this))); |
| 1816 watch_time_reporter_->OnVolumeChange(volume_); | 1815 watch_time_reporter_->OnVolumeChange(volume_); |
| 1817 if (delegate_ && delegate_->IsHidden()) | 1816 if (delegate_ && delegate_->IsHidden()) |
| 1818 watch_time_reporter_->OnHidden(); | 1817 watch_time_reporter_->OnHidden(); |
| 1819 else | 1818 else |
| 1820 watch_time_reporter_->OnShown(); | 1819 watch_time_reporter_->OnShown(); |
| 1821 } | 1820 } |
| 1822 | 1821 |
| 1823 } // namespace media | 1822 } // namespace media |
| OLD | NEW |