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

Side by Side Diff: webrtc/api/android/java/src/org/webrtc/CameraEnumerationAndroid.java

Issue 2403463002: Allow custom metrics implementations on Android. (Closed)
Patch Set: Rebase. Created 4 years 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 unified diff | Download patch
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « webrtc/api/android/java/src/org/webrtc/Camera2Session.java ('k') | webrtc/api/android/java/src/org/webrtc/Histogram.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698