| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/media/capture/web_contents_video_capture_device.h" | 5 #include "content/browser/media/capture/web_contents_video_capture_device.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/debug/debugger.h" | 8 #include "base/debug/debugger.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 virtual void EndFrameSubscription() OVERRIDE { | 190 virtual void EndFrameSubscription() OVERRIDE { |
| 191 subscriber_.reset(); | 191 subscriber_.reset(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 // Simulate a compositor paint event for our subscriber. | 194 // Simulate a compositor paint event for our subscriber. |
| 195 void SimulateUpdate() { | 195 void SimulateUpdate() { |
| 196 const base::TimeTicks present_time = base::TimeTicks::Now(); | 196 const base::TimeTicks present_time = base::TimeTicks::Now(); |
| 197 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; | 197 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; |
| 198 scoped_refptr<media::VideoFrame> target; | 198 scoped_refptr<media::VideoFrame> target; |
| 199 if (subscriber_ && subscriber_->ShouldCaptureFrame(present_time, | 199 if (subscriber_ && subscriber_->ShouldCaptureFrame( |
| 200 &target, &callback)) { | 200 gfx::Rect(), present_time, &target, &callback)) { |
| 201 SkColor c = ConvertRgbToYuv(controller_->GetSolidColor()); | 201 SkColor c = ConvertRgbToYuv(controller_->GetSolidColor()); |
| 202 media::FillYUV( | 202 media::FillYUV( |
| 203 target.get(), SkColorGetR(c), SkColorGetG(c), SkColorGetB(c)); | 203 target.get(), SkColorGetR(c), SkColorGetG(c), SkColorGetB(c)); |
| 204 BrowserThread::PostTask(BrowserThread::UI, | 204 BrowserThread::PostTask(BrowserThread::UI, |
| 205 FROM_HERE, | 205 FROM_HERE, |
| 206 base::Bind(callback, present_time, true)); | 206 base::Bind(callback, present_time, true)); |
| 207 controller_->SignalCopy(); | 207 controller_->SignalCopy(); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 source()->SetSolidColor(SK_ColorGREEN); | 800 source()->SetSolidColor(SK_ColorGREEN); |
| 801 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); | 801 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); |
| 802 source()->SetSolidColor(SK_ColorRED); | 802 source()->SetSolidColor(SK_ColorRED); |
| 803 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED)); | 803 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED)); |
| 804 | 804 |
| 805 device()->StopAndDeAllocate(); | 805 device()->StopAndDeAllocate(); |
| 806 } | 806 } |
| 807 | 807 |
| 808 } // namespace | 808 } // namespace |
| 809 } // namespace content | 809 } // namespace content |
| OLD | NEW |