| Index: content/browser/media/capture/web_contents_video_capture_device_unittest.cc
|
| diff --git a/content/browser/media/capture/web_contents_video_capture_device_unittest.cc b/content/browser/media/capture/web_contents_video_capture_device_unittest.cc
|
| index 8b24ed798021ee8e4b6da1059bf0f2d09cd4477e..be58629fe2174320bd98a8d0df2bf51b5c012afe 100644
|
| --- a/content/browser/media/capture/web_contents_video_capture_device_unittest.cc
|
| +++ b/content/browser/media/capture/web_contents_video_capture_device_unittest.cc
|
| @@ -30,6 +30,7 @@
|
| #include "media/base/video_util.h"
|
| #include "media/base/yuv_convert.h"
|
| #include "skia/ext/platform_canvas.h"
|
| +#include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "third_party/skia/include/core/SkColor.h"
|
| #include "ui/gfx/display.h"
|
| @@ -315,25 +316,27 @@ class StubClient : public media::VideoCaptureDevice::Client {
|
| }
|
| ~StubClient() override {}
|
|
|
| - void OnIncomingCapturedData(const uint8* data,
|
| - int length,
|
| - const media::VideoCaptureFormat& frame_format,
|
| - int rotation,
|
| - const base::TimeTicks& timestamp) override {
|
| - FAIL();
|
| - }
|
| -
|
| - void OnIncomingCapturedYuvData(const uint8* y_data,
|
| - const uint8* u_data,
|
| - const uint8* v_data,
|
| - size_t y_stride,
|
| - size_t u_stride,
|
| - size_t v_stride,
|
| - const media::VideoCaptureFormat& frame_format,
|
| - int clockwise_rotation,
|
| - const base::TimeTicks& timestamp) override {
|
| - FAIL();
|
| - }
|
| + MOCK_METHOD5(OnIncomingCapturedData,
|
| + void(const uint8* data,
|
| + int length,
|
| + const media::VideoCaptureFormat& frame_format,
|
| + int rotation,
|
| + const base::TimeTicks& timestamp));
|
| + MOCK_METHOD9(OnIncomingCapturedYuvData,
|
| + void (const uint8* y_data,
|
| + const uint8* u_data,
|
| + const uint8* v_data,
|
| + size_t y_stride,
|
| + size_t u_stride,
|
| + size_t v_stride,
|
| + const media::VideoCaptureFormat& frame_format,
|
| + int clockwise_rotation,
|
| + const base::TimeTicks& timestamp));
|
| +
|
| + MOCK_METHOD3(OnIncomingCapturedBuffer,
|
| + void(const scoped_refptr<Buffer>& buffer,
|
| + const media::VideoCaptureFormat& frame_format,
|
| + const base::TimeTicks& timestamp));
|
|
|
| scoped_refptr<media::VideoCaptureDevice::Client::Buffer> ReserveOutputBuffer(
|
| media::VideoPixelFormat format,
|
| @@ -344,11 +347,11 @@ class StubClient : public media::VideoCaptureDevice::Client {
|
| &buffer_id_to_drop);
|
| if (buffer_id == VideoCaptureBufferPool::kInvalidId)
|
| return NULL;
|
| - void* data;
|
| - size_t size;
|
| - buffer_pool_->GetBufferInfo(buffer_id, &data, &size);
|
| +
|
| + scoped_ptr<VideoCaptureBufferPool::BufferHandle> buffer_handle =
|
| + buffer_pool_->GetBufferHandle(buffer_id);
|
| return scoped_refptr<media::VideoCaptureDevice::Client::Buffer>(
|
| - new AutoReleaseBuffer(buffer_pool_, buffer_id, data, size));
|
| + new AutoReleaseBuffer(buffer_pool_, buffer_handle.Pass(), buffer_id));
|
| }
|
|
|
| void OnIncomingCapturedVideoFrame(
|
| @@ -376,27 +379,28 @@ class StubClient : public media::VideoCaptureDevice::Client {
|
| private:
|
| class AutoReleaseBuffer : public media::VideoCaptureDevice::Client::Buffer {
|
| public:
|
| - AutoReleaseBuffer(const scoped_refptr<VideoCaptureBufferPool>& pool,
|
| - int buffer_id,
|
| - void* data,
|
| - size_t size)
|
| + AutoReleaseBuffer(
|
| + const scoped_refptr<VideoCaptureBufferPool>& pool,
|
| + scoped_ptr<VideoCaptureBufferPool::BufferHandle> buffer_handle,
|
| + int buffer_id)
|
| : pool_(pool),
|
| id_(buffer_id),
|
| - data_(data),
|
| - size_(size) {
|
| + buffer_handle_(buffer_handle.Pass()) {
|
| DCHECK(pool_.get());
|
| }
|
| int id() const override { return id_; }
|
| - void* data() const override { return data_; }
|
| - size_t size() const override { return size_; }
|
| + size_t size() const override { return buffer_handle_->size(); }
|
| + scoped_ptr<media::DataHandle> GetDataHandle() override {
|
| + return buffer_handle_->GetDataHandle().Pass();
|
| + }
|
| + ClientBuffer AsClientBuffer() override { return nullptr; }
|
|
|
| private:
|
| ~AutoReleaseBuffer() override { pool_->RelinquishProducerReservation(id_); }
|
|
|
| const scoped_refptr<VideoCaptureBufferPool> pool_;
|
| const int id_;
|
| - void* const data_;
|
| - const size_t size_;
|
| + const scoped_ptr<VideoCaptureBufferPool::BufferHandle> buffer_handle_;
|
| };
|
|
|
| scoped_refptr<VideoCaptureBufferPool> buffer_pool_;
|
|
|