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

Unified Diff: media/video/capture/video_capture_device_factory.cc

Issue 294893006: VideoCaptureDeviceFactory: Change device enumeration to callback + QTKit enumerates in UI thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: perkj@s comments Created 6 years, 7 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: media/video/capture/video_capture_device_factory.cc
diff --git a/media/video/capture/video_capture_device_factory.cc b/media/video/capture/video_capture_device_factory.cc
index 7c39152b0f27531819b6aa768b647f96eaecd174..2b9715ac053fe0e24dd7ba35ae76c4758b5931ea 100644
--- a/media/video/capture/video_capture_device_factory.cc
+++ b/media/video/capture/video_capture_device_factory.cc
@@ -22,8 +22,8 @@
namespace media {
// static
-scoped_ptr<VideoCaptureDeviceFactory>
- VideoCaptureDeviceFactory::CreateFactory() {
+scoped_ptr<VideoCaptureDeviceFactory> VideoCaptureDeviceFactory::CreateFactory(
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
const CommandLine* command_line = CommandLine::ForCurrentProcess();
// Use a Fake or File Video Device Factory if the command line flags are
// present, otherwise use the normal, platform-dependent, device factory.
@@ -36,15 +36,14 @@ scoped_ptr<VideoCaptureDeviceFactory>
media::FakeVideoCaptureDeviceFactory());
}
} else {
+ // |ui_task_runner| is needed for the Linux ChromeOS factory to retrieve
+ // screen rotations and for the Mac factory to run QTKit device enumeration.
#if defined(OS_MACOSX)
return scoped_ptr<VideoCaptureDeviceFactory>(new
- VideoCaptureDeviceFactoryMac());
+ VideoCaptureDeviceFactoryMac(ui_task_runner));
#elif defined(OS_LINUX)
return scoped_ptr<VideoCaptureDeviceFactory>(new
- VideoCaptureDeviceFactoryLinux());
-#elif defined(OS_LINUX)
- return scoped_ptr<VideoCaptureDeviceFactory>(new
- VideoCaptureDeviceFactoryLinux());
+ VideoCaptureDeviceFactoryLinux(ui_task_runner));
#elif defined(OS_ANDROID)
return scoped_ptr<VideoCaptureDeviceFactory>(new
VideoCaptureDeviceFactoryAndroid());
@@ -64,25 +63,13 @@ VideoCaptureDeviceFactory::VideoCaptureDeviceFactory() {
VideoCaptureDeviceFactory::~VideoCaptureDeviceFactory() {}
-scoped_ptr<VideoCaptureDevice> VideoCaptureDeviceFactory::Create(
- scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
- const VideoCaptureDevice::Name& device_name) {
- DCHECK(thread_checker_.CalledOnValidThread());
- return scoped_ptr<VideoCaptureDevice>(
- VideoCaptureDevice::Create(ui_task_runner, device_name));
-}
-
-void VideoCaptureDeviceFactory::GetDeviceNames(
- VideoCaptureDevice::Names* device_names) {
- DCHECK(thread_checker_.CalledOnValidThread());
- VideoCaptureDevice::GetDeviceNames(device_names);
-}
-
-void VideoCaptureDeviceFactory::GetDeviceSupportedFormats(
- const VideoCaptureDevice::Name& device,
- VideoCaptureFormats* supported_formats) {
+void VideoCaptureDeviceFactory::EnumerateDeviceNames(
+ const base::Callback<void(media::VideoCaptureDevice::Names&)>& callback) {
DCHECK(thread_checker_.CalledOnValidThread());
- VideoCaptureDevice::GetDeviceSupportedFormats(device, supported_formats);
+ DCHECK(!callback.is_null());
+ VideoCaptureDevice::Names device_names;
+ GetDeviceNames(&device_names);
+ callback.Run(device_names);
}
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698