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

Unified Diff: content/browser/media/capture/web_contents_video_capture_device_unittest.cc

Issue 1090273006: Revert of VideoCapture: add support for GpuMemoryBuffer allocation and lifetime mgmt in VideoCaptureBufferPool (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/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 14fa1ff55b01cff70f851caf0344bfa3ef4d707b..8b24ed798021ee8e4b6da1059bf0f2d09cd4477e 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,7 +30,6 @@
#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"
@@ -316,26 +315,27 @@
}
~StubClient() override {}
- 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_METHOD0(DoOnIncomingCapturedBuffer, void(void));
-
- scoped_ptr<media::VideoCaptureDevice::Client::Buffer> ReserveOutputBuffer(
+ 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();
+ }
+
+ scoped_refptr<media::VideoCaptureDevice::Client::Buffer> ReserveOutputBuffer(
media::VideoPixelFormat format,
const gfx::Size& dimensions) override {
CHECK_EQ(format, media::PIXEL_FORMAT_I420);
@@ -344,20 +344,15 @@
&buffer_id_to_drop);
if (buffer_id == VideoCaptureBufferPool::kInvalidId)
return NULL;
-
- return scoped_ptr<media::VideoCaptureDevice::Client::Buffer>(
- new AutoReleaseBuffer(
- buffer_pool_, buffer_pool_->GetBufferHandle(buffer_id), buffer_id));
- }
- // Trampoline method to workaround GMOCK problems with scoped_ptr<>.
- void OnIncomingCapturedBuffer(scoped_ptr<Buffer> buffer,
- const media::VideoCaptureFormat& frame_format,
- const base::TimeTicks& timestamp) override {
- DoOnIncomingCapturedBuffer();
+ void* data;
+ size_t size;
+ buffer_pool_->GetBufferInfo(buffer_id, &data, &size);
+ return scoped_refptr<media::VideoCaptureDevice::Client::Buffer>(
+ new AutoReleaseBuffer(buffer_pool_, buffer_id, data, size));
}
void OnIncomingCapturedVideoFrame(
- scoped_ptr<Buffer> buffer,
+ const scoped_refptr<Buffer>& buffer,
const scoped_refptr<media::VideoFrame>& frame,
const base::TimeTicks& timestamp) override {
EXPECT_EQ(gfx::Size(kTestWidth, kTestHeight), frame->visible_rect().size());
@@ -381,26 +376,27 @@
private:
class AutoReleaseBuffer : public media::VideoCaptureDevice::Client::Buffer {
public:
- AutoReleaseBuffer(
- const scoped_refptr<VideoCaptureBufferPool>& pool,
- scoped_ptr<VideoCaptureBufferPool::BufferHandle> buffer_handle,
- int buffer_id)
- : id_(buffer_id),
- pool_(pool),
- buffer_handle_(buffer_handle.Pass()) {
+ AutoReleaseBuffer(const scoped_refptr<VideoCaptureBufferPool>& pool,
+ int buffer_id,
+ void* data,
+ size_t size)
+ : pool_(pool),
+ id_(buffer_id),
+ data_(data),
+ size_(size) {
DCHECK(pool_.get());
}
int id() const override { return id_; }
- size_t size() const override { return buffer_handle_->size(); }
- void* data() override { return buffer_handle_->data(); }
- ClientBuffer AsClientBuffer() override { return nullptr; }
+ void* data() const override { return data_; }
+ size_t size() const override { return size_; }
private:
~AutoReleaseBuffer() override { pool_->RelinquishProducerReservation(id_); }
+ const scoped_refptr<VideoCaptureBufferPool> pool_;
const int id_;
- const scoped_refptr<VideoCaptureBufferPool> pool_;
- const scoped_ptr<VideoCaptureBufferPool::BufferHandle> buffer_handle_;
+ void* const data_;
+ const size_t size_;
};
scoped_refptr<VideoCaptureBufferPool> buffer_pool_;

Powered by Google App Engine
This is Rietveld 408576698