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 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 int rotation, | 114 int rotation, |
115 base::TimeTicks reference_time, | 115 base::TimeTicks reference_time, |
116 base::TimeDelta timestamp, | 116 base::TimeDelta timestamp, |
117 int frame_feedback_id) override { | 117 int frame_feedback_id) override { |
118 ASSERT_GT(length, 0); | 118 ASSERT_GT(length, 0); |
119 ASSERT_TRUE(data); | 119 ASSERT_TRUE(data); |
120 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); | 120 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); |
121 } | 121 } |
122 | 122 |
123 // Trampoline methods to workaround GMOCK problems with std::unique_ptr<>. | 123 // Trampoline methods to workaround GMOCK problems with std::unique_ptr<>. |
124 Buffer ReserveOutputBuffer(const gfx::Size& dimensions, | 124 std::unique_ptr<Buffer> ReserveOutputBuffer(const gfx::Size& dimensions, |
125 media::VideoPixelFormat format, | 125 media::VideoPixelFormat format, |
126 media::VideoPixelStorage storage, | 126 media::VideoPixelStorage storage, |
127 int frame_feedback_id) override { | 127 int frame_feedback_id) override { |
128 DoReserveOutputBuffer(); | 128 DoReserveOutputBuffer(); |
129 NOTREACHED() << "This should never be called"; | 129 NOTREACHED() << "This should never be called"; |
130 return Buffer(); | 130 return std::unique_ptr<Buffer>(); |
131 } | 131 } |
132 void OnIncomingCapturedBuffer(Buffer buffer, | 132 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, |
133 const VideoCaptureFormat& format, | 133 const VideoCaptureFormat& format, |
134 base::TimeTicks reference_time, | 134 base::TimeTicks reference_time, |
135 base::TimeDelta timestamp) override { | 135 base::TimeDelta timestamp) override { |
136 DoOnIncomingCapturedBuffer(); | 136 DoOnIncomingCapturedBuffer(); |
137 } | 137 } |
138 void OnIncomingCapturedBufferExt( | 138 void OnIncomingCapturedBufferExt( |
139 Buffer buffer, | 139 std::unique_ptr<Buffer> buffer, |
140 const VideoCaptureFormat& format, | 140 const VideoCaptureFormat& format, |
141 base::TimeTicks reference_time, | 141 base::TimeTicks reference_time, |
142 base::TimeDelta timestamp, | 142 base::TimeDelta timestamp, |
143 gfx::Rect visible_rect, | 143 gfx::Rect visible_rect, |
144 const VideoFrameMetadata& additional_metadata) override { | 144 const VideoFrameMetadata& additional_metadata) override { |
145 DoOnIncomingCapturedVideoFrame(); | 145 DoOnIncomingCapturedVideoFrame(); |
146 } | 146 } |
147 Buffer ResurrectLastOutputBuffer(const gfx::Size& dimensions, | 147 std::unique_ptr<Buffer> ResurrectLastOutputBuffer( |
148 media::VideoPixelFormat format, | 148 const gfx::Size& dimensions, |
149 media::VideoPixelStorage storage, | 149 media::VideoPixelFormat format, |
150 int frame_feedback_id) { | 150 media::VideoPixelStorage storage, |
| 151 int frame_feedback_id) { |
151 DoResurrectLastOutputBuffer(); | 152 DoResurrectLastOutputBuffer(); |
152 NOTREACHED() << "This should never be called"; | 153 NOTREACHED() << "This should never be called"; |
153 return Buffer(); | 154 return std::unique_ptr<Buffer>(); |
154 } | 155 } |
155 | 156 |
156 private: | 157 private: |
157 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; | 158 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; |
158 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; | 159 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; |
159 }; | 160 }; |
160 | 161 |
161 class MockImageCaptureClient : public base::RefCounted<MockImageCaptureClient> { | 162 class MockImageCaptureClient : public base::RefCounted<MockImageCaptureClient> { |
162 public: | 163 public: |
163 // GMock doesn't support move-only arguments, so we use this forward method. | 164 // GMock doesn't support move-only arguments, so we use this forward method. |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 | 632 |
632 device->GetPhotoCapabilities(std::move(scoped_get_callback)); | 633 device->GetPhotoCapabilities(std::move(scoped_get_callback)); |
633 run_loop.Run(); | 634 run_loop.Run(); |
634 | 635 |
635 ASSERT_TRUE(image_capture_client_->capabilities()); | 636 ASSERT_TRUE(image_capture_client_->capabilities()); |
636 | 637 |
637 device->StopAndDeAllocate(); | 638 device->StopAndDeAllocate(); |
638 } | 639 } |
639 | 640 |
640 }; // namespace media | 641 }; // namespace media |
OLD | NEW |