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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/renderer_host/media/in_process_video_capture_provider. h"
6
7 #include "content/browser/renderer_host/media/in_process_buildable_video_capture _device.h"
8
9 namespace content {
10
11 InProcessVideoCaptureProvider::InProcessVideoCaptureProvider(
12 std::unique_ptr<media::VideoCaptureSystem> video_capture_system,
13 scoped_refptr<base::SingleThreadTaskRunner> device_task_runner)
14 : video_capture_system_(std::move(video_capture_system)),
15 device_task_runner_(std::move(device_task_runner)) {}
16
17 InProcessVideoCaptureProvider::~InProcessVideoCaptureProvider() = default;
18
19 void InProcessVideoCaptureProvider::GetDeviceInfosAsync(
20 const base::Callback<void(
21 const std::vector<media::VideoCaptureDeviceInfo>&)>& result_callback) {
22 // Using Unretained() is safe because |this| owns |video_capture_system_| and
23 // |result_callback| has ownership of |this|.
24 device_task_runner_->PostTask(
25 FROM_HERE, base::Bind(&media::VideoCaptureSystem::GetDeviceInfosAsync,
26 base::Unretained(video_capture_system_.get()),
27 result_callback));
28 }
29
30 std::unique_ptr<BuildableVideoCaptureDevice>
31 InProcessVideoCaptureProvider::CreateBuildableDevice(
32 const std::string& device_id,
33 MediaStreamType stream_type) {
34 return base::MakeUnique<InProcessBuildableVideoCaptureDevice>(
35 device_task_runner_, video_capture_system_.get());
36 }
37
38 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698