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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 size_t y_stride, | 73 size_t y_stride, |
74 size_t u_stride, | 74 size_t u_stride, |
75 size_t v_stride, | 75 size_t v_stride, |
76 const VideoCaptureFormat& frame_format, | 76 const VideoCaptureFormat& frame_format, |
77 int clockwise_rotation, | 77 int clockwise_rotation, |
78 const base::TimeTicks& timestamp) { | 78 const base::TimeTicks& timestamp) { |
79 frame_cb_.Run(frame_format); | 79 frame_cb_.Run(frame_format); |
80 } | 80 } |
81 | 81 |
82 // Virtual methods for capturing using Client's Buffers. | 82 // Virtual methods for capturing using Client's Buffers. |
83 scoped_ptr<Buffer> ReserveOutputBuffer(const gfx::Size& dimensions, | 83 scoped_ptr<Buffer> ReserveOutputBuffer(media::VideoPixelFormat format, |
84 media::VideoPixelFormat format, | 84 const gfx::Size& dimensions) { |
85 media::VideoPixelStorage storage) { | 85 EXPECT_TRUE(format == PIXEL_FORMAT_I420 || |
86 EXPECT_TRUE((format == media::PIXEL_FORMAT_I420 && | 86 format == PIXEL_FORMAT_GPUMEMORYBUFFER); |
87 storage == media::PIXEL_STORAGE_CPU) || | |
88 (format == media::PIXEL_FORMAT_ARGB && | |
89 storage == media::PIXEL_STORAGE_GPUMEMORYBUFFER)); | |
90 EXPECT_GT(dimensions.GetArea(), 0); | 87 EXPECT_GT(dimensions.GetArea(), 0); |
91 const VideoCaptureFormat frame_format(dimensions, 0.0, format); | 88 const VideoCaptureFormat frame_format(dimensions, 0.0, format); |
92 return make_scoped_ptr( | 89 return make_scoped_ptr( |
93 new MockBuffer(0, frame_format.ImageAllocationSize())); | 90 new MockBuffer(0, frame_format.ImageAllocationSize())); |
94 } | 91 } |
95 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, | 92 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, |
96 const VideoCaptureFormat& frame_format, | 93 const VideoCaptureFormat& frame_format, |
97 const base::TimeTicks& timestamp) { | 94 const base::TimeTicks& timestamp) { |
98 frame_cb_.Run(frame_format); | 95 frame_cb_.Run(frame_format); |
99 } | 96 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 EXPECT_EQ(supported_formats[2].pixel_format, PIXEL_FORMAT_I420); | 222 EXPECT_EQ(supported_formats[2].pixel_format, PIXEL_FORMAT_I420); |
226 EXPECT_GE(supported_formats[2].frame_rate, 20.0); | 223 EXPECT_GE(supported_formats[2].frame_rate, 20.0); |
227 EXPECT_EQ(supported_formats[3].frame_size.width(), 1920); | 224 EXPECT_EQ(supported_formats[3].frame_size.width(), 1920); |
228 EXPECT_EQ(supported_formats[3].frame_size.height(), 1080); | 225 EXPECT_EQ(supported_formats[3].frame_size.height(), 1080); |
229 EXPECT_EQ(supported_formats[3].pixel_format, PIXEL_FORMAT_I420); | 226 EXPECT_EQ(supported_formats[3].pixel_format, PIXEL_FORMAT_I420); |
230 EXPECT_GE(supported_formats[3].frame_rate, 20.0); | 227 EXPECT_GE(supported_formats[3].frame_rate, 20.0); |
231 } | 228 } |
232 } | 229 } |
233 | 230 |
234 }; // namespace media | 231 }; // namespace media |
OLD | NEW |