Bug 932295 - Android video capture should autofocus. r=gcp
authorRandall Barker <rbarker@mozilla.com>
Sun, 08 Dec 2013 21:42:06 -0500
changeset 175176 fb7bdd450ebd688b497dec8f4e56cac2ff481154
parent 175175 1b6e515ec0b17e9a0c7fc000e8ff7106e76ee003
child 175177 26aa24dc95819e24da70e778c4d9fc0848926cc5
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgcp
bugs932295
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 932295 - Android video capture should autofocus. r=gcp
media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
--- a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
@@ -7,16 +7,17 @@
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
 package org.webrtc.videoengine;
 
 import java.io.IOException;
 import java.util.Locale;
+import java.util.List;
 import java.util.concurrent.locks.ReentrantLock;
 
 import org.webrtc.videoengine.CaptureCapabilityAndroid;
 import org.webrtc.videoengine.VideoCaptureDeviceInfoAndroid.AndroidVideoCaptureDevice;
 
 import android.graphics.ImageFormat;
 import android.graphics.PixelFormat;
 import android.graphics.Rect;
@@ -280,16 +281,22 @@ public class VideoCaptureAndroid impleme
                     new CaptureCapabilityAndroid();
             currentCapability.width = width;
             currentCapability.height = height;
             currentCapability.maxFPS = frameRate;
             PixelFormat.getPixelFormatInfo(PIXEL_FORMAT, pixelFormat);
 
 
             Camera.Parameters parameters = camera.getParameters();
+
+            List<String> focusModeList = parameters.getSupportedFocusModes();
+            if (focusModeList.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) {
+                parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
+            }
+
             parameters.setPreviewSize(currentCapability.width,
                     currentCapability.height);
             parameters.setPreviewFormat(PIXEL_FORMAT);
             parameters.setPreviewFrameRate(currentCapability.maxFPS);
             camera.setParameters(parameters);
 
             int bufSize = width * height * pixelFormat.bitsPerPixel / 8;
             byte[] buffer = null;