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

Unified Diff: content/browser/renderer_host/media/video_capture_controller_unittest.cc

Issue 1179323002: Video Capture: extract storage info from pixel format in VideoCaptureFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hubbe@s comments and minor rebase Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_controller_unittest.cc
diff --git a/content/browser/renderer_host/media/video_capture_controller_unittest.cc b/content/browser/renderer_host/media/video_capture_controller_unittest.cc
index 17764b3bce079e9b7fd745c76101115730b6e987..27ea1f299269927299abea3b40379751988c4c52 100644
--- a/content/browser/renderer_host/media/video_capture_controller_unittest.cc
+++ b/content/browser/renderer_host/media/video_capture_controller_unittest.cc
@@ -329,8 +329,8 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
uint8 buffer_no = 1;
ASSERT_EQ(0.0, device_->GetBufferPoolUtilization());
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer(
- device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
- capture_resolution));
+ device_->ReserveOutputBuffer(capture_resolution, media::PIXEL_FORMAT_I420,
+ media::PIXEL_STORAGE_CPU));
ASSERT_TRUE(buffer.get());
ASSERT_EQ(1.0 / kPoolSize, device_->GetBufferPoolUtilization());
memset(buffer->data(), buffer_no++, buffer->size());
@@ -373,8 +373,8 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
// case pretend that the Buffer pointer is held by the device for a long
// delay. This shouldn't affect anything.
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer2 =
- device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
- capture_resolution);
+ device_->ReserveOutputBuffer(capture_resolution, media::PIXEL_FORMAT_I420,
+ media::PIXEL_STORAGE_CPU);
ASSERT_TRUE(buffer2.get());
memset(buffer2->data(), buffer_no++, buffer2->size());
video_frame =
@@ -412,8 +412,9 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
// Third, fourth, and fifth buffers. Pretend they all arrive at the same time.
for (int i = 0; i < kPoolSize; i++) {
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer =
- device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
- capture_resolution);
+ device_->ReserveOutputBuffer(capture_resolution,
+ media::PIXEL_FORMAT_I420,
+ media::PIXEL_STORAGE_CPU);
ASSERT_TRUE(buffer.get());
memset(buffer->data(), buffer_no++, buffer->size());
video_frame =
@@ -422,8 +423,9 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
base::TimeTicks());
}
// ReserveOutputBuffer ought to fail now, because the pool is depleted.
- ASSERT_FALSE(device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
- capture_resolution).get());
+ ASSERT_FALSE(device_->ReserveOutputBuffer(capture_resolution,
+ media::PIXEL_FORMAT_I420,
+ media::PIXEL_STORAGE_CPU).get());
// The new client needs to be told of 3 buffers; the old clients only 2.
EXPECT_CALL(*client_b_, DoBufferCreated(client_b_route_2)).Times(kPoolSize);
@@ -449,8 +451,8 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
controller_->StopSession(300);
// Queue up another buffer.
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer3 =
- device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
- capture_resolution);
+ device_->ReserveOutputBuffer(capture_resolution, media::PIXEL_FORMAT_I420,
+ media::PIXEL_STORAGE_CPU);
ASSERT_TRUE(buffer3.get());
memset(buffer3->data(), buffer_no++, buffer3->size());
video_frame =
@@ -459,8 +461,8 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
base::TimeTicks());
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer4 =
- device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
- capture_resolution);
+ device_->ReserveOutputBuffer(capture_resolution, media::PIXEL_FORMAT_I420,
+ media::PIXEL_STORAGE_CPU);
{
// Kill A2 via session close (posts a task to disconnect, but A2 must not
// be sent either of these two buffers).
@@ -495,8 +497,9 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
for (int i = 0; i < shm_buffers; ++i) {
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer =
- device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
- capture_resolution);
+ device_->ReserveOutputBuffer(capture_resolution,
+ media::PIXEL_FORMAT_I420,
+ media::PIXEL_STORAGE_CPU);
ASSERT_TRUE(buffer.get());
video_frame =
WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer->data()));
@@ -507,8 +510,9 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
std::vector<uint32> release_syncpoints(mailbox_buffers);
for (int i = 0; i < mailbox_buffers; ++i) {
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer =
- device_->ReserveOutputBuffer(media::PIXEL_FORMAT_TEXTURE,
- capture_resolution);
+ device_->ReserveOutputBuffer(capture_resolution,
+ media::PIXEL_FORMAT_ARGB,
+ media::PIXEL_STORAGE_TEXTURE);
ASSERT_TRUE(buffer.get());
#if !defined(OS_ANDROID)
mailbox_syncpoints[i] =
@@ -524,10 +528,13 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
}
// ReserveOutputBuffers ought to fail now regardless of buffer format, because
// the pool is depleted.
- ASSERT_FALSE(device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
- capture_resolution).get());
- ASSERT_FALSE(device_->ReserveOutputBuffer(media::PIXEL_FORMAT_TEXTURE,
- capture_resolution).get());
+ ASSERT_FALSE(device_->ReserveOutputBuffer(capture_resolution,
+ media::PIXEL_FORMAT_I420,
+ media::PIXEL_STORAGE_CPU).get());
+ ASSERT_FALSE(device_->ReserveOutputBuffer(capture_resolution,
+ media::PIXEL_FORMAT_ARGB,
+ media::PIXEL_STORAGE_TEXTURE)
+ .get());
EXPECT_CALL(*client_b_, DoBufferReady(client_b_route_2,_)).Times(shm_buffers);
EXPECT_CALL(*client_b_, DoMailboxBufferReady(client_b_route_2))
.Times(mailbox_buffers);
@@ -579,8 +586,8 @@ TEST_F(VideoCaptureControllerTest, ErrorBeforeDeviceCreation) {
Mock::VerifyAndClearExpectations(client_b_.get());
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer(
- device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
- capture_resolution));
+ device_->ReserveOutputBuffer(capture_resolution, media::PIXEL_FORMAT_I420,
+ media::PIXEL_STORAGE_CPU));
ASSERT_TRUE(buffer.get());
scoped_refptr<media::VideoFrame> video_frame =
WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer->data()));
@@ -615,7 +622,8 @@ TEST_F(VideoCaptureControllerTest, ErrorAfterDeviceCreation) {
const gfx::Size dims(320, 240);
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer(
- device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420, dims));
+ device_->ReserveOutputBuffer(dims, media::PIXEL_FORMAT_I420,
+ media::PIXEL_STORAGE_CPU));
ASSERT_TRUE(buffer.get());
scoped_refptr<media::VideoFrame> video_frame =
@@ -651,8 +659,8 @@ TEST_F(VideoCaptureControllerTest, DataCaptureInEachVideoFormatInSequence) {
<< "Scratchpad is too small to hold the largest pixel format (ARGB).";
const int kSessionId = 100;
- // This Test skips PIXEL_FORMAT_TEXTURE and PIXEL_FORMAT_UNKNOWN.
- for (int format = 0; format < media::PIXEL_FORMAT_TEXTURE; ++format) {
+ // This Test skips PIXEL_FORMAT_UNKNOWN.
+ for (int format = 0; format < media::PIXEL_FORMAT_UNKNOWN; ++format) {
hubbe 2015/06/18 19:23:11 Seems brittle. How about iterate to media::PIXEL_F
mcasas 2015/06/19 02:58:35 Done.
media::VideoCaptureParams params;
params.requested_format = media::VideoCaptureFormat(
capture_resolution, 30, media::VideoPixelFormat(format));

Powered by Google App Engine
This is Rietveld 408576698