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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 int length, | 92 int length, |
93 const VideoCaptureFormat& format, | 93 const VideoCaptureFormat& format, |
94 int rotation, | 94 int rotation, |
95 const base::TimeTicks& timestamp) override { | 95 const base::TimeTicks& timestamp) override { |
96 ASSERT_GT(length, 0); | 96 ASSERT_GT(length, 0); |
97 ASSERT_TRUE(data != NULL); | 97 ASSERT_TRUE(data != NULL); |
98 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); | 98 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); |
99 } | 99 } |
100 | 100 |
101 // Trampoline methods to workaround GMOCK problems with scoped_ptr<>. | 101 // Trampoline methods to workaround GMOCK problems with scoped_ptr<>. |
102 scoped_ptr<Buffer> ReserveOutputBuffer( | 102 scoped_ptr<Buffer> ReserveOutputBuffer(VideoPixelFormat format, |
103 const gfx::Size& dimensions, | 103 const gfx::Size& dimensions) override { |
104 media::VideoPixelFormat format, | |
105 media::VideoPixelStorage storage) override { | |
106 DoReserveOutputBuffer(); | 104 DoReserveOutputBuffer(); |
107 NOTREACHED() << "This should never be called"; | |
108 return scoped_ptr<Buffer>(); | 105 return scoped_ptr<Buffer>(); |
109 } | 106 } |
110 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, | 107 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, |
111 const VideoCaptureFormat& frame_format, | 108 const VideoCaptureFormat& frame_format, |
112 const base::TimeTicks& timestamp) override { | 109 const base::TimeTicks& timestamp) override { |
113 DoOnIncomingCapturedBuffer(); | 110 DoOnIncomingCapturedBuffer(); |
114 } | 111 } |
115 void OnIncomingCapturedVideoFrame(scoped_ptr<Buffer> buffer, | 112 void OnIncomingCapturedVideoFrame(scoped_ptr<Buffer> buffer, |
116 const scoped_refptr<VideoFrame>& frame, | 113 const scoped_refptr<VideoFrame>& frame, |
117 const base::TimeTicks& timestamp) override { | 114 const base::TimeTicks& timestamp) override { |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 // Use PIXEL_FORMAT_MAX to iterate all device names for testing | 468 // Use PIXEL_FORMAT_MAX to iterate all device names for testing |
472 // GetDeviceSupportedFormats(). | 469 // GetDeviceSupportedFormats(). |
473 scoped_ptr<VideoCaptureDevice::Name> name = | 470 scoped_ptr<VideoCaptureDevice::Name> name = |
474 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); | 471 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); |
475 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here | 472 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here |
476 // since we cannot forecast the hardware capabilities. | 473 // since we cannot forecast the hardware capabilities. |
477 ASSERT_FALSE(name); | 474 ASSERT_FALSE(name); |
478 } | 475 } |
479 | 476 |
480 }; // namespace media | 477 }; // namespace media |
OLD | NEW |