| 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/renderer_host/media/web_contents_video_capture_device.
h" | 5 #include "content/browser/renderer_host/media/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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 yuv[plane] = reinterpret_cast<uint8*>(buffer->data())[offset]; | 354 yuv[plane] = reinterpret_cast<uint8*>(buffer->data())[offset]; |
| 355 offset += media::VideoFrame::PlaneAllocationSize( | 355 offset += media::VideoFrame::PlaneAllocationSize( |
| 356 media::VideoFrame::I420, plane, dimensions); | 356 media::VideoFrame::I420, plane, dimensions); |
| 357 } | 357 } |
| 358 // TODO(nick): We just look at the first pixel presently, because if | 358 // TODO(nick): We just look at the first pixel presently, because if |
| 359 // the analysis is too slow, the backlog of frames will grow without bound | 359 // the analysis is too slow, the backlog of frames will grow without bound |
| 360 // and trouble erupts. http://crbug.com/174519 | 360 // and trouble erupts. http://crbug.com/174519 |
| 361 color_callback_.Run((SkColorSetRGB(yuv[0], yuv[1], yuv[2]))); | 361 color_callback_.Run((SkColorSetRGB(yuv[0], yuv[1], yuv[2]))); |
| 362 } | 362 } |
| 363 | 363 |
| 364 virtual void OnError() OVERRIDE { | 364 virtual void OnError(const std::string& reason) OVERRIDE { |
| 365 error_callback_.Run(); | 365 error_callback_.Run(); |
| 366 } | 366 } |
| 367 | 367 |
| 368 private: | 368 private: |
| 369 class PoolBuffer : public media::VideoCaptureDevice::Client::Buffer { | 369 class PoolBuffer : public media::VideoCaptureDevice::Client::Buffer { |
| 370 public: | 370 public: |
| 371 PoolBuffer(const scoped_refptr<VideoCaptureBufferPool>& pool, | 371 PoolBuffer(const scoped_refptr<VideoCaptureBufferPool>& pool, |
| 372 int buffer_id, | 372 int buffer_id, |
| 373 void* data, | 373 void* data, |
| 374 size_t size) | 374 size_t size) |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 source()->SetSolidColor(SK_ColorGREEN); | 806 source()->SetSolidColor(SK_ColorGREEN); |
| 807 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); | 807 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); |
| 808 source()->SetSolidColor(SK_ColorRED); | 808 source()->SetSolidColor(SK_ColorRED); |
| 809 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED)); | 809 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED)); |
| 810 | 810 |
| 811 device()->StopAndDeAllocate(); | 811 device()->StopAndDeAllocate(); |
| 812 } | 812 } |
| 813 | 813 |
| 814 } // namespace | 814 } // namespace |
| 815 } // namespace content | 815 } // namespace content |
| OLD | NEW |