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

Unified Diff: webrtc/api/android/java/src/org/webrtc/CameraEnumerationAndroid.java

Issue 2476313002: Add UMA stats for the resolution camera is started in. (Closed)
Patch Set: Rebase. Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/api/android/java/src/org/webrtc/CameraEnumerationAndroid.java
diff --git a/webrtc/api/android/java/src/org/webrtc/CameraEnumerationAndroid.java b/webrtc/api/android/java/src/org/webrtc/CameraEnumerationAndroid.java
index 48ee1a373170fc945b403bd8d07b0918a1c356ce..c5cdcf7d56efd62a5d2ffe5d43dc7e24620d488b 100644
--- a/webrtc/api/android/java/src/org/webrtc/CameraEnumerationAndroid.java
+++ b/webrtc/api/android/java/src/org/webrtc/CameraEnumerationAndroid.java
@@ -13,14 +13,41 @@ package org.webrtc;
import static java.lang.Math.abs;
import android.graphics.ImageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import org.webrtc.Metrics.Histogram;
@SuppressWarnings("deprecation")
public class CameraEnumerationAndroid {
private final static String TAG = "CameraEnumerationAndroid";
+ static final ArrayList<Size> COMMON_RESOLUTIONS = new ArrayList<Size>(Arrays.asList(
+ // 0, Unknown resolution
+ new Size(160, 120), // 1, QQVGA
+ new Size(240, 160), // 2, HQVGA
+ new Size(320, 240), // 3, QVGA
+ new Size(400, 240), // 4, WQVGA
+ new Size(480, 320), // 5, HVGA
+ new Size(640, 360), // 6, nHD
+ new Size(640, 480), // 7, VGA
+ new Size(768, 480), // 8, WVGA
+ new Size(854, 480), // 9, FWVGA
+ new Size(800, 600), // 10, SVGA
+ new Size(960, 540), // 11, qHD
+ new Size(960, 640), // 12, DVGA
+ new Size(1024, 576), // 13, WSVGA
+ new Size(1024, 600), // 14, WVSGA
+ new Size(1280, 720), // 15, HD
+ new Size(1280, 1024), // 16, SXGA
+ new Size(1920, 1080), // 17, Full HD
+ new Size(1920, 1440), // 18, Full HD 4:3
+ new Size(2560, 1440), // 19, QHD
+ new Size(3840, 2160) // 20, UHD
+ ));
+
public static class CaptureFormat {
// Class to represent a framerate range. The framerate varies because of lightning conditions.
// The values are multiplied by 1000, so 1000 represents one frame per second.
@@ -169,4 +196,12 @@ public class CameraEnumerationAndroid {
}
});
}
+
+ // Helper method for camera classes.
+ static void reportCameraResolution(Histogram histogram, Size resolution) {
+ int index = COMMON_RESOLUTIONS.indexOf(resolution);
+ // 0 is reserved for unknown resolution, so add 1.
+ // indexOf returns -1 for unknown resolutions so it becomes 0 automatically.
+ histogram.addSample(index + 1);
+ }
}
« no previous file with comments | « webrtc/api/android/java/src/org/webrtc/Camera2Session.java ('k') | webrtc/api/android/java/src/org/webrtc/Metrics.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698