| 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 // Implementation of a fake VideoCaptureDevice class. Used for testing other | 5 // Implementation of a fake VideoCaptureDevice class. Used for testing other |
| 6 // video capture classes when no real hardware is available. | 6 // video capture classes when no real hardware is available. |
| 7 | 7 |
| 8 #ifndef MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ | 8 #ifndef MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ |
| 9 #define MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ | 9 #define MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // VideoCaptureDevice implementation. | 37 // VideoCaptureDevice implementation. |
| 38 void AllocateAndStart(const VideoCaptureParams& params, | 38 void AllocateAndStart(const VideoCaptureParams& params, |
| 39 scoped_ptr<Client> client) override; | 39 scoped_ptr<Client> client) override; |
| 40 void StopAndDeAllocate() override; | 40 void StopAndDeAllocate() override; |
| 41 | 41 |
| 42 private: | 42 private: |
| 43 static const int kFakeCapturePeriodMs = 50; | 43 static const int kFakeCapturePeriodMs = 50; |
| 44 | 44 |
| 45 void CaptureUsingOwnBuffers(base::TimeTicks expected_execution_time); | 45 void CaptureUsingOwnBuffers(base::TimeTicks expected_execution_time); |
| 46 void CaptureUsingClientBuffers(VideoPixelFormat pixel_format, | 46 void CaptureUsingClientBuffers(VideoPixelFormat pixel_format, |
| 47 VideoPixelStorage pixel_storage, |
| 47 base::TimeTicks expected_execution_time); | 48 base::TimeTicks expected_execution_time); |
| 48 void BeepAndScheduleNextCapture( | 49 void BeepAndScheduleNextCapture( |
| 49 base::TimeTicks expected_execution_time, | 50 base::TimeTicks expected_execution_time, |
| 50 const base::Callback<void(base::TimeTicks)>& next_capture); | 51 const base::Callback<void(base::TimeTicks)>& next_capture); |
| 51 | 52 |
| 52 // |thread_checker_| is used to check that all methods are called in the | 53 // |thread_checker_| is used to check that all methods are called in the |
| 53 // correct thread that owns the object. | 54 // correct thread that owns the object. |
| 54 base::ThreadChecker thread_checker_; | 55 base::ThreadChecker thread_checker_; |
| 55 | 56 |
| 56 const FakeVideoCaptureDeviceType device_type_; | 57 const FakeVideoCaptureDeviceType device_type_; |
| 57 | 58 |
| 58 scoped_ptr<VideoCaptureDevice::Client> client_; | 59 scoped_ptr<VideoCaptureDevice::Client> client_; |
| 59 // |fake_frame_| is used for capturing on Own Buffers. | 60 // |fake_frame_| is used for capturing on Own Buffers. |
| 60 scoped_ptr<uint8[]> fake_frame_; | 61 scoped_ptr<uint8[]> fake_frame_; |
| 61 int frame_count_; | 62 int frame_count_; |
| 62 VideoCaptureFormat capture_format_; | 63 VideoCaptureFormat capture_format_; |
| 63 | 64 |
| 64 // FakeVideoCaptureDevice post tasks to itself for frame construction and | 65 // FakeVideoCaptureDevice post tasks to itself for frame construction and |
| 65 // needs to deal with asynchronous StopAndDeallocate(). | 66 // needs to deal with asynchronous StopAndDeallocate(). |
| 66 base::WeakPtrFactory<FakeVideoCaptureDevice> weak_factory_; | 67 base::WeakPtrFactory<FakeVideoCaptureDevice> weak_factory_; |
| 67 | 68 |
| 68 DISALLOW_COPY_AND_ASSIGN(FakeVideoCaptureDevice); | 69 DISALLOW_COPY_AND_ASSIGN(FakeVideoCaptureDevice); |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 } // namespace media | 72 } // namespace media |
| 72 | 73 |
| 73 #endif // MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ | 74 #endif // MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ |
| OLD | NEW |