summaryrefslogtreecommitdiffstats
path: root/media/video/capture
diff options
context:
space:
mode:
authordcheng <dcheng@chromium.org>2015-06-24 12:07:25 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-24 19:08:05 +0000
commit07cf16152edf2771e8788c1c3745bc287b8206cf (patch)
tree755cbe5f82136127bac4ed91818765972e48f9a7 /media/video/capture
parentc1cab0163fca4dad68c05c7f14567051730f27da (diff)
downloadchromium_src-07cf16152edf2771e8788c1c3745bc287b8206cf.zip
chromium_src-07cf16152edf2771e8788c1c3745bc287b8206cf.tar.gz
chromium_src-07cf16152edf2771e8788c1c3745bc287b8206cf.tar.bz2
Revert of Video Capture: extract storage info from pixel format in VideoCaptureFormat. (patchset #7 id:290001 of https://codereview.chromium.org/1179323002/)
Reason for revert: The IPC changes in this patch were not reviewed. Original issue's description: > Video Capture: extract storage info from pixel format in VideoCaptureFormat. > > Video Capture Devices treat both Texture and GpuMemoryBuffer > as a VideoPixelFormat, but they are storage types. Moreover, > this merging prevents capture devices from indicating a > combination of Storage and Capture formats, i.e. > Texture + ARGB, or GpuMemoryBuffer+YUY2. > > This CL separates both concepts and updates necessary > call points. It also extends the translation > VideoCaptureFormat --> VideoFrame in > VideoCaptureDeviceClient and in VideoCaptureBufferPool. > VideoCaptureBufferPool::ReserveOutputBuffer() > also gets a param to specify the StorageType. > > This separation also allows for VideoCaptureBufferPool > to operate using VideoPixel{Format, Storage} ISO > VideoFrame types, which spares the constant conversion > between ones and others. > > Test: All video captures working exactly as before. > BUG=440843 > > TBR=dcheng@chromium.org for media_param_traits.cc > (Rationale: the change is small and I'm still going to be > actively working in this area so we can follow up in > other reviews). > > Committed: https://crrev.com/957fb245c45052e2c4b2bb0f59e165ba05096904 > Cr-Commit-Position: refs/heads/master@{#335872} TBR=dalecurtis@chromium.org,hubbe@chromium.org,miu@chromium.org,mcasas@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=440843 Review URL: https://codereview.chromium.org/1204843004 Cr-Commit-Position: refs/heads/master@{#335968}
Diffstat (limited to 'media/video/capture')
-rw-r--r--media/video/capture/fake_video_capture_device.cc26
-rw-r--r--media/video/capture/fake_video_capture_device.h1
-rw-r--r--media/video/capture/fake_video_capture_device_unittest.cc11
-rw-r--r--media/video/capture/video_capture_device.h5
-rw-r--r--media/video/capture/video_capture_device_unittest.cc7
5 files changed, 18 insertions, 32 deletions
diff --git a/media/video/capture/fake_video_capture_device.cc b/media/video/capture/fake_video_capture_device.cc
index c483136..e7b90ad 100644
--- a/media/video/capture/fake_video_capture_device.cc
+++ b/media/video/capture/fake_video_capture_device.cc
@@ -102,7 +102,6 @@ void FakeVideoCaptureDevice::AllocateAndStart(
if (device_type_ == USING_OWN_BUFFERS ||
device_type_ == USING_OWN_BUFFERS_TRIPLANAR) {
- capture_format_.pixel_storage = PIXEL_STORAGE_CPU;
fake_frame_.reset(new uint8[VideoFrame::AllocationSize(
VideoFrame::I420, capture_format_.frame_size)]);
BeepAndScheduleNextCapture(
@@ -120,10 +119,7 @@ void FakeVideoCaptureDevice::AllocateAndStart(
weak_factory_.GetWeakPtr(),
(device_type_ == USING_CLIENT_BUFFERS_I420
? PIXEL_FORMAT_I420
- : PIXEL_FORMAT_ARGB),
- (device_type_ == USING_CLIENT_BUFFERS_GPU
- ? PIXEL_STORAGE_GPUMEMORYBUFFER
- : PIXEL_STORAGE_CPU)));
+ : PIXEL_FORMAT_GPUMEMORYBUFFER)));
} else {
client_->OnError("Unknown Fake Video Capture Device type.");
}
@@ -173,13 +169,11 @@ void FakeVideoCaptureDevice::CaptureUsingOwnBuffers(
void FakeVideoCaptureDevice::CaptureUsingClientBuffers(
VideoPixelFormat pixel_format,
- VideoPixelStorage pixel_storage,
base::TimeTicks expected_execution_time) {
DCHECK(thread_checker_.CalledOnValidThread());
scoped_ptr<VideoCaptureDevice::Client::Buffer> capture_buffer(
- client_->ReserveOutputBuffer(capture_format_.frame_size, pixel_format,
- pixel_storage));
+ client_->ReserveOutputBuffer(pixel_format, capture_format_.frame_size));
DLOG_IF(ERROR, !capture_buffer) << "Couldn't allocate Capture Buffer";
if (capture_buffer.get()) {
@@ -187,17 +181,17 @@ void FakeVideoCaptureDevice::CaptureUsingClientBuffers(
DCHECK(data_ptr) << "Buffer has NO backing memory";
memset(data_ptr, 0, capture_buffer->size());
- DrawPacman((pixel_format == media::PIXEL_FORMAT_ARGB), /* use_argb */
- data_ptr,
- frame_count_,
- kFakeCapturePeriodMs,
- capture_format_.frame_size);
+ DrawPacman(
+ (pixel_format == media::PIXEL_FORMAT_GPUMEMORYBUFFER), /* use_argb */
+ data_ptr,
+ frame_count_,
+ kFakeCapturePeriodMs,
+ capture_format_.frame_size);
// Give the captured frame to the client.
const VideoCaptureFormat format(capture_format_.frame_size,
capture_format_.frame_rate,
- pixel_format,
- pixel_storage);
+ pixel_format);
client_->OnIncomingCapturedBuffer(capture_buffer.Pass(), format,
base::TimeTicks::Now());
}
@@ -205,7 +199,7 @@ void FakeVideoCaptureDevice::CaptureUsingClientBuffers(
BeepAndScheduleNextCapture(
expected_execution_time,
base::Bind(&FakeVideoCaptureDevice::CaptureUsingClientBuffers,
- weak_factory_.GetWeakPtr(), pixel_format, pixel_storage));
+ weak_factory_.GetWeakPtr(), pixel_format));
}
void FakeVideoCaptureDevice::BeepAndScheduleNextCapture(
diff --git a/media/video/capture/fake_video_capture_device.h b/media/video/capture/fake_video_capture_device.h
index a045ca5..3cf45a8 100644
--- a/media/video/capture/fake_video_capture_device.h
+++ b/media/video/capture/fake_video_capture_device.h
@@ -44,7 +44,6 @@ class MEDIA_EXPORT FakeVideoCaptureDevice : public VideoCaptureDevice {
void CaptureUsingOwnBuffers(base::TimeTicks expected_execution_time);
void CaptureUsingClientBuffers(VideoPixelFormat pixel_format,
- VideoPixelStorage pixel_storage,
base::TimeTicks expected_execution_time);
void BeepAndScheduleNextCapture(
base::TimeTicks expected_execution_time,
diff --git a/media/video/capture/fake_video_capture_device_unittest.cc b/media/video/capture/fake_video_capture_device_unittest.cc
index e19e466..ab2e7d2 100644
--- a/media/video/capture/fake_video_capture_device_unittest.cc
+++ b/media/video/capture/fake_video_capture_device_unittest.cc
@@ -80,13 +80,10 @@ class MockClient : public VideoCaptureDevice::Client {
}
// Virtual methods for capturing using Client's Buffers.
- scoped_ptr<Buffer> ReserveOutputBuffer(const gfx::Size& dimensions,
- media::VideoPixelFormat format,
- media::VideoPixelStorage storage) {
- EXPECT_TRUE((format == media::PIXEL_FORMAT_I420 &&
- storage == media::PIXEL_STORAGE_CPU) ||
- (format == media::PIXEL_FORMAT_ARGB &&
- storage == media::PIXEL_STORAGE_GPUMEMORYBUFFER));
+ scoped_ptr<Buffer> ReserveOutputBuffer(media::VideoPixelFormat format,
+ const gfx::Size& dimensions) {
+ EXPECT_TRUE(format == PIXEL_FORMAT_I420 ||
+ format == PIXEL_FORMAT_GPUMEMORYBUFFER);
EXPECT_GT(dimensions.GetArea(), 0);
const VideoCaptureFormat frame_format(dimensions, 0.0, format);
return make_scoped_ptr(
diff --git a/media/video/capture/video_capture_device.h b/media/video/capture/video_capture_device.h
index 7398316..59d91cf 100644
--- a/media/video/capture/video_capture_device.h
+++ b/media/video/capture/video_capture_device.h
@@ -247,9 +247,8 @@ class MEDIA_EXPORT VideoCaptureDevice {
// The output buffer stays reserved and mapped for use until the Buffer
// object is destroyed or returned.
virtual scoped_ptr<Buffer> ReserveOutputBuffer(
- const gfx::Size& dimensions,
- VideoPixelFormat format,
- VideoPixelStorage storage) = 0;
+ media::VideoPixelFormat format,
+ const gfx::Size& dimensions) = 0;
// Captured new video data, held in |frame| or |buffer|, respectively for
// OnIncomingCapturedVideoFrame() and OnIncomingCapturedBuffer().
diff --git a/media/video/capture/video_capture_device_unittest.cc b/media/video/capture/video_capture_device_unittest.cc
index 0002929..610be86 100644
--- a/media/video/capture/video_capture_device_unittest.cc
+++ b/media/video/capture/video_capture_device_unittest.cc
@@ -99,12 +99,9 @@ class MockClient : public VideoCaptureDevice::Client {
}
// Trampoline methods to workaround GMOCK problems with scoped_ptr<>.
- scoped_ptr<Buffer> ReserveOutputBuffer(
- const gfx::Size& dimensions,
- media::VideoPixelFormat format,
- media::VideoPixelStorage storage) override {
+ scoped_ptr<Buffer> ReserveOutputBuffer(VideoPixelFormat format,
+ const gfx::Size& dimensions) override {
DoReserveOutputBuffer();
- NOTREACHED() << "This should never be called";
return scoped_ptr<Buffer>();
}
void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer,