| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 int length, | 91 int length, |
| 92 const VideoCaptureFormat& format, | 92 const VideoCaptureFormat& format, |
| 93 int rotation, | 93 int rotation, |
| 94 const base::TimeTicks& timestamp) override { | 94 const base::TimeTicks& timestamp) override { |
| 95 ASSERT_GT(length, 0); | 95 ASSERT_GT(length, 0); |
| 96 ASSERT_TRUE(data != NULL); | 96 ASSERT_TRUE(data != NULL); |
| 97 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); | 97 main_thread_->PostTask(FROM_HERE, base::Bind(frame_cb_, format)); |
| 98 } | 98 } |
| 99 | 99 |
| 100 // Trampoline methods to workaround GMOCK problems with scoped_ptr<>. | 100 // Trampoline methods to workaround GMOCK problems with scoped_ptr<>. |
| 101 scoped_ptr<Buffer> ReserveOutputBuffer(VideoPixelFormat format, | 101 scoped_ptr<Buffer> ReserveOutputBuffer( |
| 102 const gfx::Size& dimensions) override { | 102 const media::VideoCaptureFormat& frame_format) override { |
| 103 DoReserveOutputBuffer(); | 103 DoReserveOutputBuffer(); |
| 104 return scoped_ptr<Buffer>(); | 104 return scoped_ptr<Buffer>(); |
| 105 } | 105 } |
| 106 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, | 106 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, |
| 107 const VideoCaptureFormat& frame_format, | 107 const VideoCaptureFormat& frame_format, |
| 108 const base::TimeTicks& timestamp) override { | 108 const base::TimeTicks& timestamp) override { |
| 109 DoOnIncomingCapturedBuffer(); | 109 DoOnIncomingCapturedBuffer(); |
| 110 } | 110 } |
| 111 void OnIncomingCapturedVideoFrame(scoped_ptr<Buffer> buffer, | 111 void OnIncomingCapturedVideoFrame(scoped_ptr<Buffer> buffer, |
| 112 const scoped_refptr<VideoFrame>& frame, | 112 const scoped_refptr<VideoFrame>& frame, |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 // Use PIXEL_FORMAT_MAX to iterate all device names for testing | 467 // Use PIXEL_FORMAT_MAX to iterate all device names for testing |
| 468 // GetDeviceSupportedFormats(). | 468 // GetDeviceSupportedFormats(). |
| 469 scoped_ptr<VideoCaptureDevice::Name> name = | 469 scoped_ptr<VideoCaptureDevice::Name> name = |
| 470 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); | 470 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); |
| 471 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here | 471 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here |
| 472 // since we cannot forecast the hardware capabilities. | 472 // since we cannot forecast the hardware capabilities. |
| 473 ASSERT_FALSE(name); | 473 ASSERT_FALSE(name); |
| 474 } | 474 } |
| 475 | 475 |
| 476 }; // namespace media | 476 }; // namespace media |
| OLD | NEW |