summaryrefslogtreecommitdiffstats
path: root/content/browser/renderer_host/media/video_capture_device_client.cc
diff options
context:
space:
mode:
Diffstat (limited to 'content/browser/renderer_host/media/video_capture_device_client.cc')
-rw-r--r--content/browser/renderer_host/media/video_capture_device_client.cc27
1 files changed, 18 insertions, 9 deletions
diff --git a/content/browser/renderer_host/media/video_capture_device_client.cc b/content/browser/renderer_host/media/video_capture_device_client.cc
index d5cb149..4d508c4 100644
--- a/content/browser/renderer_host/media/video_capture_device_client.cc
+++ b/content/browser/renderer_host/media/video_capture_device_client.cc
@@ -270,21 +270,17 @@ VideoCaptureDeviceClient::ReserveOutputBuffer(
// it's a ShMem GMB or a DmaBuf GMB.
int buffer_id_to_drop = VideoCaptureBufferPool::kInvalidId;
const int buffer_id = buffer_pool_->ReserveForProducer(
- pixel_format, pixel_storage, frame_size, &buffer_id_to_drop);
- if (buffer_id == VideoCaptureBufferPool::kInvalidId)
- return NULL;
-
- scoped_ptr<media::VideoCaptureDevice::Client::Buffer> output_buffer(
- new AutoReleaseBuffer(buffer_pool_, buffer_id));
-
+ frame_size, pixel_format, pixel_storage, &buffer_id_to_drop);
if (buffer_id_to_drop != VideoCaptureBufferPool::kInvalidId) {
BrowserThread::PostTask(BrowserThread::IO,
FROM_HERE,
base::Bind(&VideoCaptureController::DoBufferDestroyedOnIOThread,
controller_, buffer_id_to_drop));
}
-
- return output_buffer;
+ if (buffer_id == VideoCaptureBufferPool::kInvalidId)
+ return nullptr;
+ return make_scoped_ptr<Buffer>(
+ new AutoReleaseBuffer(buffer_pool_, buffer_id));
}
void VideoCaptureDeviceClient::OnIncomingCapturedBuffer(
@@ -340,6 +336,19 @@ void VideoCaptureDeviceClient::OnIncomingCapturedVideoFrame(
timestamp));
}
+scoped_ptr<media::VideoCaptureDevice::Client::Buffer>
+VideoCaptureDeviceClient::ResurrectLastOutputBuffer(
+ const gfx::Size& dimensions,
+ media::VideoPixelFormat format,
+ media::VideoPixelStorage storage) {
+ const int buffer_id =
+ buffer_pool_->ResurrectLastForProducer(dimensions, format, storage);
+ if (buffer_id == VideoCaptureBufferPool::kInvalidId)
+ return nullptr;
+ return make_scoped_ptr<Buffer>(
+ new AutoReleaseBuffer(buffer_pool_, buffer_id));
+}
+
void VideoCaptureDeviceClient::OnError(
const tracked_objects::Location& from_here,
const std::string& reason) {