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

Unified Diff: media/capture/video/android/video_capture_device_factory_android.cc

Issue 2286303003: Video capture Android: enable unittests for Camera2 API (Closed)
Patch Set: jbudorick@s comments Created 4 years, 3 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/capture/video/android/video_capture_device_factory_android.cc
diff --git a/media/capture/video/android/video_capture_device_factory_android.cc b/media/capture/video/android/video_capture_device_factory_android.cc
index 5fb751680683a3c58a1914c72f1a687b13b6a4bd..b632a49bfe5872c0994e913cc4a19e5b1271938a 100644
--- a/media/capture/video/android/video_capture_device_factory_android.cc
+++ b/media/capture/video/android/video_capture_device_factory_android.cc
@@ -41,11 +41,14 @@ VideoCaptureDeviceFactoryAndroid::CreateDevice(
std::unique_ptr<VideoCaptureDeviceAndroid> video_capture_device(
new VideoCaptureDeviceAndroid(device_descriptor));
- if (video_capture_device->Init())
+ if (video_capture_device->Init()) {
+ if (test_mode_)
+ video_capture_device->ConfigureForTesting();
return std::move(video_capture_device);
+ }
DLOG(ERROR) << "Error creating Video Capture Device.";
- return std::unique_ptr<VideoCaptureDevice>();
+ return nullptr;
}
void VideoCaptureDeviceFactoryAndroid::GetDeviceDescriptors(
@@ -105,8 +108,7 @@ void VideoCaptureDeviceFactoryAndroid::GetSupportedFormats(
base::android::ScopedJavaLocalRef<jobject> format(
env, env->GetObjectArrayElement(collected_formats.obj(), i));
- VideoPixelFormat pixel_format =
- media::PIXEL_FORMAT_UNKNOWN;
+ VideoPixelFormat pixel_format = media::PIXEL_FORMAT_UNKNOWN;
switch (media::Java_VideoCaptureFactory_getCaptureFormatPixelFormat(
env, format)) {
case VideoCaptureDeviceAndroid::ANDROID_IMAGE_FORMAT_YV12:
@@ -116,7 +118,8 @@ void VideoCaptureDeviceFactoryAndroid::GetSupportedFormats(
pixel_format = media::PIXEL_FORMAT_NV21;
break;
default:
- continue;
+ // VideoCaptureCamera2 doesn't know the provided format until capture.
+ break;
emircan 2016/09/02 22:00:23 Why is this change? This would push_back the forma
mcasas 2016/09/02 22:27:07 Camera2 does not know the Pixel format at this sta
}
VideoCaptureFormat capture_format(
gfx::Size(
@@ -131,6 +134,15 @@ void VideoCaptureDeviceFactoryAndroid::GetSupportedFormats(
}
}
+bool VideoCaptureDeviceFactoryAndroid::IsLegacyOrDeprecatedDevice(
+ const std::string& device_id) {
+ int id;
+ if (!base::StringToInt(device_id, &id))
+ return true;
+ return (Java_VideoCaptureFactory_isLegacyOrDeprecatedDevice(
+ AttachCurrentThread(), base::android::GetApplicationContext(), id));
+}
+
// static
VideoCaptureDeviceFactory*
VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory(

Powered by Google App Engine
This is Rietveld 408576698