| 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 "media/capture/video/video_capture_device.h" | 5 #include "media/capture/video/video_capture_device.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 const uint8_t* v_data, | 78 const uint8_t* v_data, |
| 79 size_t y_stride, | 79 size_t y_stride, |
| 80 size_t u_stride, | 80 size_t u_stride, |
| 81 size_t v_stride, | 81 size_t v_stride, |
| 82 const VideoCaptureFormat& frame_format, | 82 const VideoCaptureFormat& frame_format, |
| 83 int clockwise_rotation, | 83 int clockwise_rotation, |
| 84 const base::TimeTicks& timestamp)); | 84 const base::TimeTicks& timestamp)); |
| 85 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); | 85 MOCK_METHOD0(DoReserveOutputBuffer, void(void)); |
| 86 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); | 86 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); |
| 87 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); | 87 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); |
| 88 MOCK_METHOD0(DoResurrectLastOutputBuffer, void(void)); |
| 88 MOCK_METHOD2(OnError, | 89 MOCK_METHOD2(OnError, |
| 89 void(const tracked_objects::Location& from_here, | 90 void(const tracked_objects::Location& from_here, |
| 90 const std::string& reason)); | 91 const std::string& reason)); |
| 91 MOCK_CONST_METHOD0(GetBufferPoolUtilization, double(void)); | 92 MOCK_CONST_METHOD0(GetBufferPoolUtilization, double(void)); |
| 92 | 93 |
| 93 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb) | 94 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb) |
| 94 : main_thread_(base::ThreadTaskRunnerHandle::Get()), | 95 : main_thread_(base::ThreadTaskRunnerHandle::Get()), |
| 95 frame_cb_(frame_cb) {} | 96 frame_cb_(frame_cb) {} |
| 96 | 97 |
| 97 void OnIncomingCapturedData(const uint8_t* data, | 98 void OnIncomingCapturedData(const uint8_t* data, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 116 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, | 117 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, |
| 117 const VideoCaptureFormat& frame_format, | 118 const VideoCaptureFormat& frame_format, |
| 118 const base::TimeTicks& timestamp) override { | 119 const base::TimeTicks& timestamp) override { |
| 119 DoOnIncomingCapturedBuffer(); | 120 DoOnIncomingCapturedBuffer(); |
| 120 } | 121 } |
| 121 void OnIncomingCapturedVideoFrame(scoped_ptr<Buffer> buffer, | 122 void OnIncomingCapturedVideoFrame(scoped_ptr<Buffer> buffer, |
| 122 const scoped_refptr<VideoFrame>& frame, | 123 const scoped_refptr<VideoFrame>& frame, |
| 123 const base::TimeTicks& timestamp) override { | 124 const base::TimeTicks& timestamp) override { |
| 124 DoOnIncomingCapturedVideoFrame(); | 125 DoOnIncomingCapturedVideoFrame(); |
| 125 } | 126 } |
| 127 scoped_ptr<Buffer> ResurrectLastOutputBuffer( |
| 128 const gfx::Size& dimensions, |
| 129 media::VideoPixelFormat format, |
| 130 media::VideoPixelStorage storage) { |
| 131 DoResurrectLastOutputBuffer(); |
| 132 NOTREACHED() << "This should never be called"; |
| 133 return scoped_ptr<Buffer>(); |
| 134 } |
| 126 | 135 |
| 127 private: | 136 private: |
| 128 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; | 137 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; |
| 129 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; | 138 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; |
| 130 }; | 139 }; |
| 131 | 140 |
| 132 class DeviceEnumerationListener | 141 class DeviceEnumerationListener |
| 133 : public base::RefCounted<DeviceEnumerationListener> { | 142 : public base::RefCounted<DeviceEnumerationListener> { |
| 134 public: | 143 public: |
| 135 MOCK_METHOD1(OnEnumeratedDevicesCallbackPtr, | 144 MOCK_METHOD1(OnEnumeratedDevicesCallbackPtr, |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 // GetDeviceSupportedFormats(). | 489 // GetDeviceSupportedFormats(). |
| 481 scoped_ptr<VideoCaptureDevice::Name> name = | 490 scoped_ptr<VideoCaptureDevice::Name> name = |
| 482 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); | 491 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); |
| 483 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else | 492 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else |
| 484 // to test here | 493 // to test here |
| 485 // since we cannot forecast the hardware capabilities. | 494 // since we cannot forecast the hardware capabilities. |
| 486 ASSERT_FALSE(name); | 495 ASSERT_FALSE(name); |
| 487 } | 496 } |
| 488 | 497 |
| 489 }; // namespace media | 498 }; // namespace media |
| OLD | NEW |