| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 package org.webrtc; | 11 package org.webrtc; |
| 12 | 12 |
| 13 import static java.lang.Math.abs; | 13 import static java.lang.Math.abs; |
| 14 | 14 |
| 15 import android.graphics.ImageFormat; | 15 import android.graphics.ImageFormat; |
| 16 import java.util.ArrayList; | 16 import java.util.ArrayList; |
| 17 import java.util.Arrays; | 17 import java.util.Arrays; |
| 18 import java.util.Collections; | 18 import java.util.Collections; |
| 19 import java.util.Comparator; | 19 import java.util.Comparator; |
| 20 import java.util.List; | 20 import java.util.List; |
| 21 import org.webrtc.Metrics.Histogram; | |
| 22 | 21 |
| 23 @SuppressWarnings("deprecation") | 22 @SuppressWarnings("deprecation") |
| 24 public class CameraEnumerationAndroid { | 23 public class CameraEnumerationAndroid { |
| 25 private final static String TAG = "CameraEnumerationAndroid"; | 24 private final static String TAG = "CameraEnumerationAndroid"; |
| 26 | 25 |
| 27 static final ArrayList<Size> COMMON_RESOLUTIONS = new ArrayList<Size>(Arrays.a
sList( | 26 static final ArrayList<Size> COMMON_RESOLUTIONS = new ArrayList<Size>(Arrays.a
sList( |
| 28 // 0, Unknown resolution | 27 // 0, Unknown resolution |
| 29 new Size(160, 120), // 1, QQVGA | 28 new Size(160, 120), // 1, QQVGA |
| 30 new Size(240, 160), // 2, HQVGA | 29 new Size(240, 160), // 2, HQVGA |
| 31 new Size(320, 240), // 3, QVGA | 30 new Size(320, 240), // 3, QVGA |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 197 } |
| 199 | 198 |
| 200 // Helper method for camera classes. | 199 // Helper method for camera classes. |
| 201 static void reportCameraResolution(Histogram histogram, Size resolution) { | 200 static void reportCameraResolution(Histogram histogram, Size resolution) { |
| 202 int index = COMMON_RESOLUTIONS.indexOf(resolution); | 201 int index = COMMON_RESOLUTIONS.indexOf(resolution); |
| 203 // 0 is reserved for unknown resolution, so add 1. | 202 // 0 is reserved for unknown resolution, so add 1. |
| 204 // indexOf returns -1 for unknown resolutions so it becomes 0 automatically. | 203 // indexOf returns -1 for unknown resolutions so it becomes 0 automatically. |
| 205 histogram.addSample(index + 1); | 204 histogram.addSample(index + 1); |
| 206 } | 205 } |
| 207 } | 206 } |
| OLD | NEW |