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

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

Issue 667433003: Fix a crash when cameraInfo is NULL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « media/base/android/java/src/org/chromium/media/VideoCaptureFactory.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/capture/android/video_capture_device_factory_android.cc
diff --git a/media/video/capture/android/video_capture_device_factory_android.cc b/media/video/capture/android/video_capture_device_factory_android.cc
index 38a72c894c5de5005ad46bb90aeab1717d44cd76..c5439d66ffeab395aaa5e48199479df68beb2991 100644
--- a/media/video/capture/android/video_capture_device_factory_android.cc
+++ b/media/video/capture/android/video_capture_device_factory_android.cc
@@ -65,11 +65,14 @@ void VideoCaptureDeviceFactoryAndroid::GetDeviceNames(
return;
for (int camera_id = num_cameras - 1; camera_id >= 0; --camera_id) {
+ base::android::ScopedJavaLocalRef<jstring> device_name =
+ Java_VideoCaptureFactory_getDeviceName(env, camera_id);
+ if (device_name.obj() == NULL)
+ continue;
+ std::string device_id = base::IntToString(camera_id);
+
VideoCaptureDevice::Name name(
- base::android::ConvertJavaStringToUTF8(
- Java_VideoCaptureFactory_getDeviceName(env, camera_id)),
- base::android::ConvertJavaStringToUTF8(
- Java_VideoCaptureFactory_getDeviceId(env, camera_id)));
+ base::android::ConvertJavaStringToUTF8(device_name), device_id);
mcasas 2014/10/20 11:33:42 nit: I would use here base::IntToString(camera_id)
qinmin 2014/10/20 17:46:23 Done.
device_names->push_back(name);
DVLOG(1) << "VideoCaptureDeviceFactoryAndroid::GetDeviceNames: camera "
« no previous file with comments | « media/base/android/java/src/org/chromium/media/VideoCaptureFactory.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698