| 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 "media/capture/video/fake_video_capture_device.h" | 5 #include "media/capture/video/fake_video_capture_device.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 base::TimeTicks reference_time, | 77 base::TimeTicks reference_time, |
| 78 base::TimeDelta timestamp) override { | 78 base::TimeDelta timestamp) override { |
| 79 frame_cb_.Run(format); | 79 frame_cb_.Run(format); |
| 80 } | 80 } |
| 81 // Virtual methods for capturing using Client's Buffers. | 81 // Virtual methods for capturing using Client's Buffers. |
| 82 std::unique_ptr<Buffer> ReserveOutputBuffer( | 82 std::unique_ptr<Buffer> ReserveOutputBuffer( |
| 83 const gfx::Size& dimensions, | 83 const gfx::Size& dimensions, |
| 84 media::VideoPixelFormat format, | 84 media::VideoPixelFormat format, |
| 85 media::VideoPixelStorage storage) { | 85 media::VideoPixelStorage storage) { |
| 86 EXPECT_TRUE((format == media::PIXEL_FORMAT_ARGB && | 86 EXPECT_TRUE((format == media::PIXEL_FORMAT_ARGB && |
| 87 storage == media::PIXEL_STORAGE_CPU) || | 87 storage == media::PIXEL_STORAGE_CPU)); |
| 88 (format == media::PIXEL_FORMAT_I420 && | |
| 89 storage == media::PIXEL_STORAGE_GPUMEMORYBUFFER)); | |
| 90 EXPECT_GT(dimensions.GetArea(), 0); | 88 EXPECT_GT(dimensions.GetArea(), 0); |
| 91 const VideoCaptureFormat frame_format(dimensions, 0.0, format); | 89 const VideoCaptureFormat frame_format(dimensions, 0.0, format); |
| 92 return base::MakeUnique<MockBuffer>(0, frame_format.ImageAllocationSize()); | 90 return base::MakeUnique<MockBuffer>(0, frame_format.ImageAllocationSize()); |
| 93 } | 91 } |
| 94 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, | 92 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, |
| 95 const VideoCaptureFormat& frame_format, | 93 const VideoCaptureFormat& frame_format, |
| 96 base::TimeTicks reference_time, | 94 base::TimeTicks reference_time, |
| 97 base::TimeDelta timestamp) { | 95 base::TimeDelta timestamp) { |
| 98 frame_cb_.Run(frame_format); | 96 frame_cb_.Run(frame_format); |
| 99 } | 97 } |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 } | 440 } |
| 443 } | 441 } |
| 444 | 442 |
| 445 INSTANTIATE_TEST_CASE_P(, | 443 INSTANTIATE_TEST_CASE_P(, |
| 446 FakeVideoCaptureDeviceCommandLineTest, | 444 FakeVideoCaptureDeviceCommandLineTest, |
| 447 Values(CommandLineTestData{"fps=-1", 5}, | 445 Values(CommandLineTestData{"fps=-1", 5}, |
| 448 CommandLineTestData{"fps=29.97", 29.97f}, | 446 CommandLineTestData{"fps=29.97", 29.97f}, |
| 449 CommandLineTestData{"fps=60", 60}, | 447 CommandLineTestData{"fps=60", 60}, |
| 450 CommandLineTestData{"fps=1000", 60})); | 448 CommandLineTestData{"fps=1000", 60})); |
| 451 }; // namespace media | 449 }; // namespace media |
| OLD | NEW |