Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Side by Side Diff: media/video/capture/fake_video_capture_device_unittest.cc

Issue 1204063005: Reland: Video Capture: extract storage info from pixel format in VideoCaptureFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dcheng@ nit on DCHECK_EQ(expected, actual) Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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(media::VideoPixelFormat format, 83 scoped_ptr<Buffer> ReserveOutputBuffer(const gfx::Size& dimensions,
84 const gfx::Size& dimensions) { 84 media::VideoPixelFormat format,
85 EXPECT_TRUE(format == PIXEL_FORMAT_I420 || 85 media::VideoPixelStorage storage) {
86 format == PIXEL_FORMAT_GPUMEMORYBUFFER); 86 EXPECT_TRUE((format == media::PIXEL_FORMAT_I420 &&
87 storage == media::PIXEL_STORAGE_CPU) ||
88 (format == media::PIXEL_FORMAT_ARGB &&
89 storage == media::PIXEL_STORAGE_GPUMEMORYBUFFER));
87 EXPECT_GT(dimensions.GetArea(), 0); 90 EXPECT_GT(dimensions.GetArea(), 0);
88 const VideoCaptureFormat frame_format(dimensions, 0.0, format); 91 const VideoCaptureFormat frame_format(dimensions, 0.0, format);
89 return make_scoped_ptr( 92 return make_scoped_ptr(
90 new MockBuffer(0, frame_format.ImageAllocationSize())); 93 new MockBuffer(0, frame_format.ImageAllocationSize()));
91 } 94 }
92 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, 95 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer,
93 const VideoCaptureFormat& frame_format, 96 const VideoCaptureFormat& frame_format,
94 const base::TimeTicks& timestamp) { 97 const base::TimeTicks& timestamp) {
95 frame_cb_.Run(frame_format); 98 frame_cb_.Run(frame_format);
96 } 99 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 EXPECT_EQ(supported_formats[2].pixel_format, PIXEL_FORMAT_I420); 225 EXPECT_EQ(supported_formats[2].pixel_format, PIXEL_FORMAT_I420);
223 EXPECT_GE(supported_formats[2].frame_rate, 20.0); 226 EXPECT_GE(supported_formats[2].frame_rate, 20.0);
224 EXPECT_EQ(supported_formats[3].frame_size.width(), 1920); 227 EXPECT_EQ(supported_formats[3].frame_size.width(), 1920);
225 EXPECT_EQ(supported_formats[3].frame_size.height(), 1080); 228 EXPECT_EQ(supported_formats[3].frame_size.height(), 1080);
226 EXPECT_EQ(supported_formats[3].pixel_format, PIXEL_FORMAT_I420); 229 EXPECT_EQ(supported_formats[3].pixel_format, PIXEL_FORMAT_I420);
227 EXPECT_GE(supported_formats[3].frame_rate, 20.0); 230 EXPECT_GE(supported_formats[3].frame_rate, 20.0);
228 } 231 }
229 } 232 }
230 233
231 }; // namespace media 234 }; // namespace media
OLDNEW
« no previous file with comments | « media/video/capture/fake_video_capture_device.cc ('k') | media/video/capture/video_capture_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698