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

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

Issue 1204843004: Revert of Video Capture: extract storage info from pixel format in VideoCaptureFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 a1d4c36ce6b7eb3f50673213c51870faae00c202..873e92cc6d770685dc279f177b4c9dea076532a4 100644
--- a/content/browser/renderer_host/media/video_capture_controller_unittest.cc
+++ b/content/browser/renderer_host/media/video_capture_controller_unittest.cc
@@ -316,8 +316,8 @@
uint8 buffer_no = 1;
ASSERT_EQ(0.0, device_->GetBufferPoolUtilization());
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer(
- device_->ReserveOutputBuffer(capture_resolution, media::PIXEL_FORMAT_I420,
- media::PIXEL_STORAGE_CPU));
+ device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
+ capture_resolution));
ASSERT_TRUE(buffer.get());
ASSERT_EQ(1.0 / kPoolSize, device_->GetBufferPoolUtilization());
memset(buffer->data(), buffer_no++, buffer->size());
@@ -366,8 +366,8 @@
// 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(capture_resolution, media::PIXEL_FORMAT_I420,
- media::PIXEL_STORAGE_CPU);
+ device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
+ capture_resolution);
ASSERT_TRUE(buffer2.get());
memset(buffer2->data(), buffer_no++, buffer2->size());
video_frame =
@@ -411,9 +411,8 @@
// 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(capture_resolution,
- media::PIXEL_FORMAT_I420,
- media::PIXEL_STORAGE_CPU);
+ device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
+ capture_resolution);
ASSERT_TRUE(buffer.get());
memset(buffer->data(), buffer_no++, buffer->size());
video_frame =
@@ -422,9 +421,8 @@
base::TimeTicks());
}
// ReserveOutputBuffer ought to fail now, because the pool is depleted.
- ASSERT_FALSE(device_->ReserveOutputBuffer(capture_resolution,
- media::PIXEL_FORMAT_I420,
- media::PIXEL_STORAGE_CPU).get());
+ ASSERT_FALSE(device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
+ capture_resolution).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);
@@ -458,8 +456,8 @@
controller_->StopSession(300);
// Queue up another buffer.
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer3 =
- device_->ReserveOutputBuffer(capture_resolution, media::PIXEL_FORMAT_I420,
- media::PIXEL_STORAGE_CPU);
+ device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
+ capture_resolution);
ASSERT_TRUE(buffer3.get());
memset(buffer3->data(), buffer_no++, buffer3->size());
video_frame =
@@ -468,8 +466,8 @@
base::TimeTicks());
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer4 =
- device_->ReserveOutputBuffer(capture_resolution, media::PIXEL_FORMAT_I420,
- media::PIXEL_STORAGE_CPU);
+ device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
+ capture_resolution);
{
// Kill A2 via session close (posts a task to disconnect, but A2 must not
// be sent either of these two buffers).
@@ -506,9 +504,8 @@
for (int i = 0; i < shm_buffers; ++i) {
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer =
- device_->ReserveOutputBuffer(capture_resolution,
- media::PIXEL_FORMAT_I420,
- media::PIXEL_STORAGE_CPU);
+ device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
+ capture_resolution);
ASSERT_TRUE(buffer.get());
video_frame =
WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer->data()));
@@ -519,9 +516,8 @@
std::vector<uint32> release_syncpoints(mailbox_buffers);
for (int i = 0; i < mailbox_buffers; ++i) {
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer =
- device_->ReserveOutputBuffer(capture_resolution,
- media::PIXEL_FORMAT_ARGB,
- media::PIXEL_STORAGE_TEXTURE);
+ device_->ReserveOutputBuffer(media::PIXEL_FORMAT_TEXTURE,
+ capture_resolution);
ASSERT_TRUE(buffer.get());
#if !defined(OS_ANDROID)
mailbox_syncpoints[i] =
@@ -537,13 +533,10 @@
}
// ReserveOutputBuffers ought to fail now regardless of buffer format, because
// the pool is depleted.
- 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());
+ ASSERT_FALSE(device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
+ capture_resolution).get());
+ ASSERT_FALSE(device_->ReserveOutputBuffer(media::PIXEL_FORMAT_TEXTURE,
+ capture_resolution).get());
EXPECT_CALL(*client_b_,
DoI420BufferReady(client_b_route_2, capture_resolution))
.Times(shm_buffers);
@@ -598,8 +591,8 @@
Mock::VerifyAndClearExpectations(client_b_.get());
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer(
- device_->ReserveOutputBuffer(capture_resolution, media::PIXEL_FORMAT_I420,
- media::PIXEL_STORAGE_CPU));
+ device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420,
+ capture_resolution));
ASSERT_TRUE(buffer.get());
scoped_refptr<media::VideoFrame> video_frame =
WrapI420Buffer(capture_resolution, static_cast<uint8*>(buffer->data()));
@@ -634,8 +627,7 @@
const gfx::Size dims(320, 240);
scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer(
- device_->ReserveOutputBuffer(dims, media::PIXEL_FORMAT_I420,
- media::PIXEL_STORAGE_CPU));
+ device_->ReserveOutputBuffer(media::PIXEL_FORMAT_I420, dims));
ASSERT_TRUE(buffer.get());
scoped_refptr<media::VideoFrame> video_frame =
@@ -671,9 +663,8 @@
<< "Scratchpad is too small to hold the largest pixel format (ARGB).";
const int kSessionId = 100;
- for (int format = 0; format < media::PIXEL_FORMAT_MAX; ++format) {
- if (format == media::PIXEL_FORMAT_UNKNOWN)
- continue;
+ // This Test skips PIXEL_FORMAT_TEXTURE and PIXEL_FORMAT_UNKNOWN.
+ for (int format = 0; format < media::PIXEL_FORMAT_TEXTURE; ++format) {
media::VideoCaptureParams params;
params.requested_format = media::VideoCaptureFormat(
capture_resolution, 30, media::VideoPixelFormat(format));

Powered by Google App Engine
This is Rietveld 408576698