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