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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // Client virtual method for capturing using Device Buffers. | 68 // Client virtual method for capturing using Device Buffers. |
69 void OnIncomingCapturedData(const uint8* data, | 69 void OnIncomingCapturedData(const uint8* data, |
70 int length, | 70 int length, |
71 const VideoCaptureFormat& format, | 71 const VideoCaptureFormat& format, |
72 int rotation, | 72 int rotation, |
73 const base::TimeTicks& timestamp) { | 73 const base::TimeTicks& timestamp) { |
74 frame_cb_.Run(format); | 74 frame_cb_.Run(format); |
75 } | 75 } |
76 | 76 |
77 // Virtual methods for capturing using Client's Buffers. | 77 // Virtual methods for capturing using Client's Buffers. |
78 scoped_refptr<Buffer> ReserveOutputBuffer(VideoFrame::Format format, | 78 scoped_refptr<Buffer> ReserveOutputBuffer(media::VideoPixelFormat format, |
79 const gfx::Size& dimensions) { | 79 const gfx::Size& dimensions) { |
80 EXPECT_EQ(format, VideoFrame::I420); | 80 EXPECT_EQ(format, PIXEL_FORMAT_I420); |
81 EXPECT_GT(dimensions.GetArea(), 0); | 81 EXPECT_GT(dimensions.GetArea(), 0); |
82 return make_scoped_refptr( | 82 return make_scoped_refptr(new MockBuffer(0, dimensions.GetArea() * 3 / 2)); |
83 new MockBuffer(0, VideoFrame::AllocationSize(format, dimensions))); | |
84 } | 83 } |
85 void OnIncomingCapturedVideoFrame( | 84 void OnIncomingCapturedVideoFrame( |
86 const scoped_refptr<Buffer>& buffer, | 85 const scoped_refptr<Buffer>& buffer, |
87 const scoped_refptr<media::VideoFrame>& frame, | 86 const scoped_refptr<media::VideoFrame>& frame, |
88 const base::TimeTicks& timestamp) { | 87 const base::TimeTicks& timestamp) { |
89 VideoCaptureFormat format(frame->natural_size(), 30.0, PIXEL_FORMAT_I420); | 88 VideoCaptureFormat format(frame->natural_size(), 30.0, PIXEL_FORMAT_I420); |
90 frame_cb_.Run(format); | 89 frame_cb_.Run(format); |
91 } | 90 } |
92 | 91 |
93 private: | 92 private: |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 EXPECT_EQ(supported_formats[2].pixel_format, PIXEL_FORMAT_I420); | 209 EXPECT_EQ(supported_formats[2].pixel_format, PIXEL_FORMAT_I420); |
211 EXPECT_GE(supported_formats[2].frame_rate, 20.0); | 210 EXPECT_GE(supported_formats[2].frame_rate, 20.0); |
212 EXPECT_EQ(supported_formats[3].frame_size.width(), 1920); | 211 EXPECT_EQ(supported_formats[3].frame_size.width(), 1920); |
213 EXPECT_EQ(supported_formats[3].frame_size.height(), 1080); | 212 EXPECT_EQ(supported_formats[3].frame_size.height(), 1080); |
214 EXPECT_EQ(supported_formats[3].pixel_format, PIXEL_FORMAT_I420); | 213 EXPECT_EQ(supported_formats[3].pixel_format, PIXEL_FORMAT_I420); |
215 EXPECT_GE(supported_formats[3].frame_rate, 20.0); | 214 EXPECT_GE(supported_formats[3].frame_rate, 20.0); |
216 } | 215 } |
217 } | 216 } |
218 | 217 |
219 }; // namespace media | 218 }; // namespace media |
OLD | NEW |