| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/capture/video/android/video_capture_device_factory_android.h" | 5 #include "media/capture/video/android/video_capture_device_factory_android.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/android/context_utils.h" | 9 #include "base/android/context_utils.h" |
| 8 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 9 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 11 #include "jni/VideoCaptureFactory_jni.h" | 13 #include "jni/VideoCaptureFactory_jni.h" |
| 12 #include "media/capture/video/android/video_capture_device_android.h" | 14 #include "media/capture/video/android/video_capture_device_android.h" |
| 13 | 15 |
| 14 using base::android::AttachCurrentThread; | 16 using base::android::AttachCurrentThread; |
| 15 using base::android::ScopedJavaLocalRef; | 17 using base::android::ScopedJavaLocalRef; |
| 16 | 18 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 36 const VideoCaptureDevice::Name& device_name) { | 38 const VideoCaptureDevice::Name& device_name) { |
| 37 DCHECK(thread_checker_.CalledOnValidThread()); | 39 DCHECK(thread_checker_.CalledOnValidThread()); |
| 38 int id; | 40 int id; |
| 39 if (!base::StringToInt(device_name.id(), &id)) | 41 if (!base::StringToInt(device_name.id(), &id)) |
| 40 return scoped_ptr<VideoCaptureDevice>(); | 42 return scoped_ptr<VideoCaptureDevice>(); |
| 41 | 43 |
| 42 scoped_ptr<VideoCaptureDeviceAndroid> video_capture_device( | 44 scoped_ptr<VideoCaptureDeviceAndroid> video_capture_device( |
| 43 new VideoCaptureDeviceAndroid(device_name)); | 45 new VideoCaptureDeviceAndroid(device_name)); |
| 44 | 46 |
| 45 if (video_capture_device->Init()) | 47 if (video_capture_device->Init()) |
| 46 return video_capture_device.Pass(); | 48 return std::move(video_capture_device); |
| 47 | 49 |
| 48 DLOG(ERROR) << "Error creating Video Capture Device."; | 50 DLOG(ERROR) << "Error creating Video Capture Device."; |
| 49 return scoped_ptr<VideoCaptureDevice>(); | 51 return scoped_ptr<VideoCaptureDevice>(); |
| 50 } | 52 } |
| 51 | 53 |
| 52 void VideoCaptureDeviceFactoryAndroid::GetDeviceNames( | 54 void VideoCaptureDeviceFactoryAndroid::GetDeviceNames( |
| 53 VideoCaptureDevice::Names* device_names) { | 55 VideoCaptureDevice::Names* device_names) { |
| 54 DCHECK(thread_checker_.CalledOnValidThread()); | 56 DCHECK(thread_checker_.CalledOnValidThread()); |
| 55 device_names->clear(); | 57 device_names->clear(); |
| 56 | 58 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 133 } |
| 132 | 134 |
| 133 // static | 135 // static |
| 134 VideoCaptureDeviceFactory* | 136 VideoCaptureDeviceFactory* |
| 135 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( | 137 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory( |
| 136 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 138 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
| 137 return new VideoCaptureDeviceFactoryAndroid(); | 139 return new VideoCaptureDeviceFactoryAndroid(); |
| 138 } | 140 } |
| 139 | 141 |
| 140 } // namespace media | 142 } // namespace media |
| OLD | NEW |