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

Unified Diff: content/browser/renderer_host/media/in_process_video_capture_provider.cc

Issue 2800493002: [Mojo Video Capture] Create abstraction VideoCaptureProvider (Closed)
Patch Set: Incorporated suggestions from PatchSet 2 Created 3 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/renderer_host/media/in_process_video_capture_provider.cc
diff --git a/content/browser/renderer_host/media/in_process_video_capture_provider.cc b/content/browser/renderer_host/media/in_process_video_capture_provider.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4c60e6314a0225bd7e5d7f3f726d6c05c280af5a
--- /dev/null
+++ b/content/browser/renderer_host/media/in_process_video_capture_provider.cc
@@ -0,0 +1,38 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/renderer_host/media/in_process_video_capture_provider.h"
+
+#include "content/browser/renderer_host/media/in_process_buildable_video_capture_device.h"
+
+namespace content {
+
+InProcessVideoCaptureProvider::InProcessVideoCaptureProvider(
+ std::unique_ptr<media::VideoCaptureSystem> video_capture_system,
+ scoped_refptr<base::SingleThreadTaskRunner> device_task_runner)
+ : video_capture_system_(std::move(video_capture_system)),
+ device_task_runner_(std::move(device_task_runner)) {}
+
+InProcessVideoCaptureProvider::~InProcessVideoCaptureProvider() = default;
+
+void InProcessVideoCaptureProvider::GetDeviceInfosAsync(
+ const base::Callback<void(
+ const std::vector<media::VideoCaptureDeviceInfo>&)>& result_callback) {
+ // Using Unretained() is safe because |this| owns |video_capture_system_| and
+ // |result_callback| has ownership of |this|.
+ device_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&media::VideoCaptureSystem::GetDeviceInfosAsync,
+ base::Unretained(video_capture_system_.get()),
+ result_callback));
+}
+
+std::unique_ptr<BuildableVideoCaptureDevice>
+InProcessVideoCaptureProvider::CreateBuildableDevice(
+ const std::string& device_id,
+ MediaStreamType stream_type) {
+ return base::MakeUnique<InProcessBuildableVideoCaptureDevice>(
+ device_task_runner_, video_capture_system_.get());
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698