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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 base::Callback<void(const VideoCaptureFormat&)> frame_cb) | 106 base::Callback<void(const VideoCaptureFormat&)> frame_cb) |
107 : main_thread_(base::ThreadTaskRunnerHandle::Get()), frame_cb_(frame_cb) { | 107 : main_thread_(base::ThreadTaskRunnerHandle::Get()), frame_cb_(frame_cb) { |
108 ON_CALL(*this, OnError(_, _)).WillByDefault(Invoke(DumpError)); | 108 ON_CALL(*this, OnError(_, _)).WillByDefault(Invoke(DumpError)); |
109 } | 109 } |
110 | 110 |
111 void OnIncomingCapturedData(const uint8_t* data, | 111 void OnIncomingCapturedData(const uint8_t* data, |
112 int length, | 112 int length, |
113 const VideoCaptureFormat& format, | 113 const VideoCaptureFormat& format, |
114 int rotation, | 114 int rotation, |
115 base::TimeTicks reference_time, | 115 base::TimeTicks reference_time, |
116 base::TimeDelta timestamp) override { | 116 base::TimeDelta timestamp, |
| 117 int frame_feedback_id) override { |
117 ASSERT_GT(length, 0); | 118 ASSERT_GT(length, 0); |
118 ASSERT_TRUE(data); | 119 ASSERT_TRUE(data); |
119 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); | 120 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); |
120 } | 121 } |
121 | 122 |
122 // Trampoline methods to workaround GMOCK problems with std::unique_ptr<>. | 123 // Trampoline methods to workaround GMOCK problems with std::unique_ptr<>. |
123 std::unique_ptr<Buffer> ReserveOutputBuffer( | 124 std::unique_ptr<Buffer> ReserveOutputBuffer(const gfx::Size& dimensions, |
124 const gfx::Size& dimensions, | 125 media::VideoPixelFormat format, |
125 media::VideoPixelFormat format, | 126 media::VideoPixelStorage storage, |
126 media::VideoPixelStorage storage) override { | 127 int frame_feedback_id) override { |
127 DoReserveOutputBuffer(); | 128 DoReserveOutputBuffer(); |
128 NOTREACHED() << "This should never be called"; | 129 NOTREACHED() << "This should never be called"; |
129 return std::unique_ptr<Buffer>(); | 130 return std::unique_ptr<Buffer>(); |
130 } | 131 } |
131 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, | 132 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, |
132 const VideoCaptureFormat& frame_format, | 133 const VideoCaptureFormat& format, |
133 base::TimeTicks reference_time, | 134 base::TimeTicks reference_time, |
134 base::TimeDelta timestamp) override { | 135 base::TimeDelta timestamp) override { |
135 DoOnIncomingCapturedBuffer(); | 136 DoOnIncomingCapturedBuffer(); |
136 } | 137 } |
137 void OnIncomingCapturedVideoFrame(std::unique_ptr<Buffer> buffer, | 138 void OnIncomingCapturedVideoFrame(std::unique_ptr<Buffer> buffer, |
138 scoped_refptr<VideoFrame> frame) override { | 139 scoped_refptr<VideoFrame> frame) override { |
139 DoOnIncomingCapturedVideoFrame(); | 140 DoOnIncomingCapturedVideoFrame(); |
140 } | 141 } |
141 std::unique_ptr<Buffer> ResurrectLastOutputBuffer( | 142 std::unique_ptr<Buffer> ResurrectLastOutputBuffer( |
142 const gfx::Size& dimensions, | 143 const gfx::Size& dimensions, |
143 media::VideoPixelFormat format, | 144 media::VideoPixelFormat format, |
144 media::VideoPixelStorage storage) { | 145 media::VideoPixelStorage storage, |
| 146 int frame_feedback_id) { |
145 DoResurrectLastOutputBuffer(); | 147 DoResurrectLastOutputBuffer(); |
146 NOTREACHED() << "This should never be called"; | 148 NOTREACHED() << "This should never be called"; |
147 return std::unique_ptr<Buffer>(); | 149 return std::unique_ptr<Buffer>(); |
148 } | 150 } |
149 | 151 |
150 private: | 152 private: |
151 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; | 153 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; |
152 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; | 154 base::Callback<void(const VideoCaptureFormat&)> frame_cb_; |
153 }; | 155 }; |
154 | 156 |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 | 627 |
626 device->GetPhotoCapabilities(std::move(scoped_get_callback)); | 628 device->GetPhotoCapabilities(std::move(scoped_get_callback)); |
627 run_loop.Run(); | 629 run_loop.Run(); |
628 | 630 |
629 ASSERT_TRUE(image_capture_client_->capabilities()); | 631 ASSERT_TRUE(image_capture_client_->capabilities()); |
630 | 632 |
631 device->StopAndDeAllocate(); | 633 device->StopAndDeAllocate(); |
632 } | 634 } |
633 | 635 |
634 }; // namespace media | 636 }; // namespace media |
OLD | NEW |