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