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

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

Issue 941833004: VideoCaptureDevice: refactor Client::Buffer into an interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: perkj@ comment Created 5 years, 10 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
« no previous file with comments | « no previous file | content/browser/renderer_host/media/video_capture_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 92ca1a3b39d12dd8e76630106e84a02ec9efcf98..b71d47c5bed0e9c4f256fec6d905de7c0fa5432e 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
@@ -338,7 +338,7 @@ class StubClient : public media::VideoCaptureDevice::Client {
size_t size;
buffer_pool_->GetBufferInfo(buffer_id, &data, &size);
return scoped_refptr<media::VideoCaptureDevice::Client::Buffer>(
- new PoolBuffer(buffer_pool_, buffer_id, data, size));
+ new AutoReleaseBuffer(buffer_pool_, buffer_id, data, size));
}
void OnIncomingCapturedVideoFrame(
@@ -361,17 +361,29 @@ class StubClient : public media::VideoCaptureDevice::Client {
void OnError(const std::string& reason) override { error_callback_.Run(); }
private:
- class PoolBuffer : public media::VideoCaptureDevice::Client::Buffer {
+ class AutoReleaseBuffer : public media::VideoCaptureDevice::Client::Buffer {
public:
- PoolBuffer(const scoped_refptr<VideoCaptureBufferPool>& pool,
+ AutoReleaseBuffer(const scoped_refptr<VideoCaptureBufferPool>& pool,
int buffer_id,
void* data,
size_t size)
- : Buffer(buffer_id, data, size), pool_(pool) {}
+ : pool_(pool),
+ id_(buffer_id),
+ data_(data),
+ size_(size) {
+ DCHECK(pool_.get());
+ }
+ int id() const override { return id_; }
+ void* data() const override { return data_; }
+ size_t size() const override { return size_; }
private:
- ~PoolBuffer() override { pool_->RelinquishProducerReservation(id()); }
+ ~AutoReleaseBuffer() override { pool_->RelinquishProducerReservation(id_); }
+
const scoped_refptr<VideoCaptureBufferPool> pool_;
+ const int id_;
+ void* const data_;
+ const size_t size_;
};
scoped_refptr<VideoCaptureBufferPool> buffer_pool_;
« no previous file with comments | « no previous file | content/browser/renderer_host/media/video_capture_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698