| 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(VideoPixelFormat format, | 102 scoped_ptr<Buffer> ReserveOutputBuffer( |
| 103 const gfx::Size& dimensions) override { | 103 const gfx::Size& dimensions, |
| 104 media::VideoPixelFormat format, |
| 105 media::VideoPixelStorage storage) override { |
| 104 DoReserveOutputBuffer(); | 106 DoReserveOutputBuffer(); |
| 107 NOTREACHED() << "This should never be called"; |
| 105 return scoped_ptr<Buffer>(); | 108 return scoped_ptr<Buffer>(); |
| 106 } | 109 } |
| 107 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, | 110 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, |
| 108 const VideoCaptureFormat& frame_format, | 111 const VideoCaptureFormat& frame_format, |
| 109 const base::TimeTicks& timestamp) override { | 112 const base::TimeTicks& timestamp) override { |
| 110 DoOnIncomingCapturedBuffer(); | 113 DoOnIncomingCapturedBuffer(); |
| 111 } | 114 } |
| 112 void OnIncomingCapturedVideoFrame(scoped_ptr<Buffer> buffer, | 115 void OnIncomingCapturedVideoFrame(scoped_ptr<Buffer> buffer, |
| 113 const scoped_refptr<VideoFrame>& frame, | 116 const scoped_refptr<VideoFrame>& frame, |
| 114 const base::TimeTicks& timestamp) override { | 117 const base::TimeTicks& timestamp) override { |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 // Use PIXEL_FORMAT_MAX to iterate all device names for testing | 471 // Use PIXEL_FORMAT_MAX to iterate all device names for testing |
| 469 // GetDeviceSupportedFormats(). | 472 // GetDeviceSupportedFormats(). |
| 470 scoped_ptr<VideoCaptureDevice::Name> name = | 473 scoped_ptr<VideoCaptureDevice::Name> name = |
| 471 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); | 474 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MAX); |
| 472 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here | 475 // Verify no camera returned for PIXEL_FORMAT_MAX. Nothing else to test here |
| 473 // since we cannot forecast the hardware capabilities. | 476 // since we cannot forecast the hardware capabilities. |
| 474 ASSERT_FALSE(name); | 477 ASSERT_FALSE(name); |
| 475 } | 478 } |
| 476 | 479 |
| 477 }; // namespace media | 480 }; // namespace media |
| OLD | NEW |