| Index: webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java
|
| diff --git a/webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java b/webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java
|
| index f40f7e672863010e872481371dbfb2ca2f53c3c5..d54758b513501c12636f0ee3f50fcb4f80bbdb8d 100644
|
| --- a/webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java
|
| +++ b/webrtc/api/java/android/org/webrtc/VideoCapturerAndroid.java
|
| @@ -178,6 +178,7 @@ public class VideoCapturerAndroid implements
|
| // It does not matter if width and height are flipped. I.E, |width| = 640, |height| = 480 produce
|
| // the same result as |width| = 480, |height| = 640.
|
| // TODO(magjed/perkj): Document what this function does. Change name?
|
| + @Override
|
| public void onOutputFormatRequest(final int width, final int height, final int framerate) {
|
| maybePostOnCameraThread(new Runnable() {
|
| @Override public void run() {
|
| @@ -188,6 +189,7 @@ public class VideoCapturerAndroid implements
|
|
|
| // Reconfigure the camera to capture in a new format. This should only be called while the camera
|
| // is running.
|
| + @Override
|
| public void changeCaptureFormat(final int width, final int height, final int framerate) {
|
| maybePostOnCameraThread(new Runnable() {
|
| @Override public void run() {
|
| @@ -392,23 +394,17 @@ public class VideoCapturerAndroid implements
|
| CameraEnumerator.convertFramerates(parameters.getSupportedPreviewFpsRange());
|
| Logging.d(TAG, "Available fps ranges: " + supportedFramerates);
|
|
|
| - final CaptureFormat.FramerateRange bestFpsRange;
|
| - if (supportedFramerates.isEmpty()) {
|
| - Logging.w(TAG, "No supported preview fps range");
|
| - bestFpsRange = new CaptureFormat.FramerateRange(0, 0);
|
| - } else {
|
| - bestFpsRange = CameraEnumerationAndroid.getClosestSupportedFramerateRange(
|
| - supportedFramerates, framerate);
|
| - }
|
| + final CaptureFormat.FramerateRange fpsRange =
|
| + CameraEnumerationAndroid.getClosestSupportedFramerateRange(supportedFramerates, framerate);
|
| +
|
| + final Size previewSize = CameraEnumerationAndroid.getClosestSupportedSize(
|
| + CameraEnumerator.convertSizes(parameters.getSupportedPreviewSizes()), width, height);
|
|
|
| - final android.hardware.Camera.Size previewSize =
|
| - CameraEnumerationAndroid.getClosestSupportedSize(
|
| - parameters.getSupportedPreviewSizes(), width, height);
|
| - final CaptureFormat captureFormat = new CaptureFormat(
|
| - previewSize.width, previewSize.height, bestFpsRange);
|
| + final CaptureFormat captureFormat =
|
| + new CaptureFormat(previewSize.width, previewSize.height, fpsRange);
|
|
|
| // Check if we are already using this capture format, then we don't need to do anything.
|
| - if (captureFormat.isSameFormat(this.captureFormat)) {
|
| + if (captureFormat.equals(this.captureFormat)) {
|
| return;
|
| }
|
|
|
| @@ -423,16 +419,15 @@ public class VideoCapturerAndroid implements
|
| if (captureFormat.framerate.max > 0) {
|
| parameters.setPreviewFpsRange(captureFormat.framerate.min, captureFormat.framerate.max);
|
| }
|
| - parameters.setPreviewSize(captureFormat.width, captureFormat.height);
|
| + parameters.setPreviewSize(previewSize.width, previewSize.height);
|
|
|
| if (!isCapturingToTexture) {
|
| parameters.setPreviewFormat(captureFormat.imageFormat);
|
| }
|
| // Picture size is for taking pictures and not for preview/video, but we need to set it anyway
|
| // as a workaround for an aspect ratio problem on Nexus 7.
|
| - final android.hardware.Camera.Size pictureSize =
|
| - CameraEnumerationAndroid.getClosestSupportedSize(
|
| - parameters.getSupportedPictureSizes(), width, height);
|
| + final Size pictureSize = CameraEnumerationAndroid.getClosestSupportedSize(
|
| + CameraEnumerator.convertSizes(parameters.getSupportedPictureSizes()), width, height);
|
| parameters.setPictureSize(pictureSize.width, pictureSize.height);
|
|
|
| // Temporarily stop preview if it's already running.
|
|
|