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

Side by Side Diff: content/browser/media/capture/web_contents_video_capture_device_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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/media/capture/web_contents_video_capture_device.h" 5 #include "content/browser/media/capture/web_contents_video_capture_device.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/debug/debugger.h" 8 #include "base/debug/debugger.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 size_t y_stride, 341 size_t y_stride,
342 size_t u_stride, 342 size_t u_stride,
343 size_t v_stride, 343 size_t v_stride,
344 const media::VideoCaptureFormat& frame_format, 344 const media::VideoCaptureFormat& frame_format,
345 int clockwise_rotation, 345 int clockwise_rotation,
346 const base::TimeTicks& timestamp)); 346 const base::TimeTicks& timestamp));
347 347
348 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); 348 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void));
349 349
350 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> ReserveOutputBuffer( 350 scoped_ptr<media::VideoCaptureDevice::Client::Buffer> ReserveOutputBuffer(
351 const gfx::Size& dimensions,
351 media::VideoPixelFormat format, 352 media::VideoPixelFormat format,
352 const gfx::Size& dimensions) override { 353 media::VideoPixelStorage storage) override {
353 CHECK_EQ(format, media::PIXEL_FORMAT_I420); 354 CHECK_EQ(format, media::PIXEL_FORMAT_I420);
354 int buffer_id_to_drop = VideoCaptureBufferPool::kInvalidId; // Ignored. 355 int buffer_id_to_drop = VideoCaptureBufferPool::kInvalidId; // Ignored.
355 int buffer_id = buffer_pool_->ReserveForProducer(format, dimensions, 356 const int buffer_id = buffer_pool_->ReserveForProducer(
356 &buffer_id_to_drop); 357 format, storage, dimensions, &buffer_id_to_drop);
357 if (buffer_id == VideoCaptureBufferPool::kInvalidId) 358 if (buffer_id == VideoCaptureBufferPool::kInvalidId)
358 return NULL; 359 return NULL;
359 360
360 return scoped_ptr<media::VideoCaptureDevice::Client::Buffer>( 361 return scoped_ptr<media::VideoCaptureDevice::Client::Buffer>(
361 new AutoReleaseBuffer( 362 new AutoReleaseBuffer(
362 buffer_pool_, buffer_pool_->GetBufferHandle(buffer_id), buffer_id)); 363 buffer_pool_, buffer_pool_->GetBufferHandle(buffer_id), buffer_id));
363 } 364 }
364 // Trampoline method to workaround GMOCK problems with scoped_ptr<>. 365 // Trampoline method to workaround GMOCK problems with scoped_ptr<>.
365 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer, 366 void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer,
366 const media::VideoCaptureFormat& frame_format, 367 const media::VideoCaptureFormat& frame_format,
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 SK_ColorBLACK, gfx::Size(kTestWidth, 1090 SK_ColorBLACK, gfx::Size(kTestWidth,
1090 kTestWidth * arbitrary_source_size.height() / 1091 kTestWidth * arbitrary_source_size.height() /
1091 arbitrary_source_size.width()))); 1092 arbitrary_source_size.width())));
1092 } 1093 }
1093 1094
1094 device()->StopAndDeAllocate(); 1095 device()->StopAndDeAllocate();
1095 } 1096 }
1096 1097
1097 } // namespace 1098 } // namespace
1098 } // namespace content 1099 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698