| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "media/base/video_capture_types.h" | 10 #include "media/base/video_capture_types.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 size_t y_stride, | 74 size_t y_stride, |
| 75 size_t u_stride, | 75 size_t u_stride, |
| 76 size_t v_stride, | 76 size_t v_stride, |
| 77 const VideoCaptureFormat& frame_format, | 77 const VideoCaptureFormat& frame_format, |
| 78 int clockwise_rotation, | 78 int clockwise_rotation, |
| 79 const base::TimeTicks& timestamp) { | 79 const base::TimeTicks& timestamp) { |
| 80 frame_cb_.Run(frame_format); | 80 frame_cb_.Run(frame_format); |
| 81 } | 81 } |
| 82 | 82 |
| 83 // Virtual methods for capturing using Client's Buffers. | 83 // Virtual methods for capturing using Client's Buffers. |
| 84 scoped_ptr<Buffer> ReserveOutputBuffer(media::VideoPixelFormat format, | 84 scoped_ptr<Buffer> ReserveOutputBuffer( |
| 85 const gfx::Size& dimensions) { | 85 const media::VideoCaptureFormat& frame_format) { |
| 86 EXPECT_TRUE(format == PIXEL_FORMAT_I420 || | 86 EXPECT_TRUE(frame_format.pixel_format == PIXEL_FORMAT_I420 || |
| 87 format == PIXEL_FORMAT_GPUMEMORYBUFFER); | 87 frame_format.pixel_format == PIXEL_FORMAT_ARGB); |
| 88 EXPECT_GT(dimensions.GetArea(), 0); | 88 EXPECT_GT(frame_format.frame_size.GetArea(), 0); |
| 89 const VideoCaptureFormat frame_format(dimensions, 0.0, format); | |
| 90 return make_scoped_ptr( | 89 return make_scoped_ptr( |
| 91 new MockBuffer(0, frame_format.ImageAllocationSize())); | 90 new MockBuffer(0, frame_format.ImageAllocationSize())); |
| 92 } | 91 } |
| 93 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, | 92 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, |
| 94 const VideoCaptureFormat& frame_format, | 93 const VideoCaptureFormat& frame_format, |
| 95 const base::TimeTicks& timestamp) { | 94 const base::TimeTicks& timestamp) { |
| 96 frame_cb_.Run(frame_format); | 95 frame_cb_.Run(frame_format); |
| 97 } | 96 } |
| 98 void OnIncomingCapturedVideoFrame( | 97 void OnIncomingCapturedVideoFrame( |
| 99 scoped_ptr<Buffer> buffer, | 98 scoped_ptr<Buffer> buffer, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 EXPECT_EQ(supported_formats[2].pixel_format, PIXEL_FORMAT_I420); | 220 EXPECT_EQ(supported_formats[2].pixel_format, PIXEL_FORMAT_I420); |
| 222 EXPECT_GE(supported_formats[2].frame_rate, 20.0); | 221 EXPECT_GE(supported_formats[2].frame_rate, 20.0); |
| 223 EXPECT_EQ(supported_formats[3].frame_size.width(), 1920); | 222 EXPECT_EQ(supported_formats[3].frame_size.width(), 1920); |
| 224 EXPECT_EQ(supported_formats[3].frame_size.height(), 1080); | 223 EXPECT_EQ(supported_formats[3].frame_size.height(), 1080); |
| 225 EXPECT_EQ(supported_formats[3].pixel_format, PIXEL_FORMAT_I420); | 224 EXPECT_EQ(supported_formats[3].pixel_format, PIXEL_FORMAT_I420); |
| 226 EXPECT_GE(supported_formats[3].frame_rate, 20.0); | 225 EXPECT_GE(supported_formats[3].frame_rate, 20.0); |
| 227 } | 226 } |
| 228 } | 227 } |
| 229 | 228 |
| 230 }; // namespace media | 229 }; // namespace media |
| OLD | NEW |