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 010c1949eb65338e83dd56249138f869aba5987f..befa57686c345a61df9eb7179aab82f3f5166678 100644 |
--- a/media/video/capture/android/video_capture_device_factory_android.cc |
+++ b/media/video/capture/android/video_capture_device_factory_android.cc |
@@ -58,15 +58,16 @@ void VideoCaptureDeviceFactoryAndroid::GetDeviceNames( |
JNIEnv* env = AttachCurrentThread(); |
- int num_cameras = Java_VideoCaptureFactory_getNumberOfCameras( |
- env, base::android::GetApplicationContext()); |
+ const jobject context = base::android::GetApplicationContext(); |
+ const int num_cameras = Java_VideoCaptureFactory_getNumberOfCameras(env, |
+ context); |
DVLOG(1) << "VideoCaptureDevice::GetDeviceNames: num_cameras=" << num_cameras; |
if (num_cameras <= 0) |
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); |
+ Java_VideoCaptureFactory_getDeviceName(env, camera_id, context); |
if (device_name.obj() == NULL) |
continue; |
@@ -89,7 +90,8 @@ void VideoCaptureDeviceFactoryAndroid::GetDeviceSupportedFormats( |
return; |
JNIEnv* env = AttachCurrentThread(); |
base::android::ScopedJavaLocalRef<jobjectArray> collected_formats = |
- Java_VideoCaptureFactory_getDeviceSupportedFormats(env, id); |
+ Java_VideoCaptureFactory_getDeviceSupportedFormats(env, |
+ base::android::GetApplicationContext(), id); |
if (collected_formats.is_null()) |
return; |