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 23 matching lines...) Expand all Loading... | |
34 ~FakeVideoCaptureDevice() override; | 34 ~FakeVideoCaptureDevice() override; |
35 | 35 |
36 // VideoCaptureDevice implementation. | 36 // VideoCaptureDevice implementation. |
37 void AllocateAndStart(const VideoCaptureParams& params, | 37 void AllocateAndStart(const VideoCaptureParams& params, |
38 scoped_ptr<Client> client) override; | 38 scoped_ptr<Client> client) override; |
39 void StopAndDeAllocate() override; | 39 void StopAndDeAllocate() override; |
40 | 40 |
41 private: | 41 private: |
42 static const int kFakeCapturePeriodMs = 50; | 42 static const int kFakeCapturePeriodMs = 50; |
43 | 43 |
44 void CaptureUsingOwnBuffers(); | 44 void CaptureUsingOwnBuffers(const base::TimeTicks& expected_execution_time); |
mcasas
2015/06/09 19:41:16
Please read [1] l.24-26, IOW in this case don't pa
magjed_chromium
2015/06/10 11:19:55
Done.
| |
45 void CaptureUsingClientBuffers(VideoPixelFormat pixel_format); | 45 void CaptureUsingClientBuffers( |
46 void BeepAndScheduleNextCapture(const base::Closure& next_capture); | 46 VideoPixelFormat pixel_format, |
47 const base::TimeTicks& expected_execution_time); | |
48 void BeepAndScheduleNextCapture( | |
49 const base::TimeTicks& expected_execution_time, | |
50 const base::Callback<void(const base::TimeTicks&)>& next_capture); | |
47 | 51 |
48 // |thread_checker_| is used to check that all methods are called in the | 52 // |thread_checker_| is used to check that all methods are called in the |
49 // correct thread that owns the object. | 53 // correct thread that owns the object. |
50 base::ThreadChecker thread_checker_; | 54 base::ThreadChecker thread_checker_; |
51 | 55 |
52 const FakeVideoCaptureDeviceType device_type_; | 56 const FakeVideoCaptureDeviceType device_type_; |
53 | 57 |
54 scoped_ptr<VideoCaptureDevice::Client> client_; | 58 scoped_ptr<VideoCaptureDevice::Client> client_; |
55 // |fake_frame_| is used for capturing on Own Buffers. | 59 // |fake_frame_| is used for capturing on Own Buffers. |
56 scoped_ptr<uint8[]> fake_frame_; | 60 scoped_ptr<uint8[]> fake_frame_; |
57 int frame_count_; | 61 int frame_count_; |
58 VideoCaptureFormat capture_format_; | 62 VideoCaptureFormat capture_format_; |
59 | 63 |
60 // FakeVideoCaptureDevice post tasks to itself for frame construction and | 64 // FakeVideoCaptureDevice post tasks to itself for frame construction and |
61 // needs to deal with asynchronous StopAndDeallocate(). | 65 // needs to deal with asynchronous StopAndDeallocate(). |
62 base::WeakPtrFactory<FakeVideoCaptureDevice> weak_factory_; | 66 base::WeakPtrFactory<FakeVideoCaptureDevice> weak_factory_; |
63 | 67 |
64 DISALLOW_COPY_AND_ASSIGN(FakeVideoCaptureDevice); | 68 DISALLOW_COPY_AND_ASSIGN(FakeVideoCaptureDevice); |
65 }; | 69 }; |
66 | 70 |
67 } // namespace media | 71 } // namespace media |
68 | 72 |
69 #endif // MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ | 73 #endif // MEDIA_VIDEO_CAPTURE_FAKE_VIDEO_CAPTURE_DEVICE_H_ |
OLD | NEW |