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

Unified Diff: webrtc/examples/androidapp/src/org/appspot/apprtc/CaptureQualityController.java

Issue 2013433003: WIP: Android Camera2 capture implementation (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix CaptureFormat jni parsing Created 4 years, 7 months 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/examples/androidapp/src/org/appspot/apprtc/CaptureQualityController.java
diff --git a/webrtc/examples/androidapp/src/org/appspot/apprtc/CaptureQualityController.java b/webrtc/examples/androidapp/src/org/appspot/apprtc/CaptureQualityController.java
index dfd95588965bf06b111feff8e92fe7d5f9091530..2804f0328d6d0ce439f807adefda8aa4cfa8b351 100644
--- a/webrtc/examples/androidapp/src/org/appspot/apprtc/CaptureQualityController.java
+++ b/webrtc/examples/androidapp/src/org/appspot/apprtc/CaptureQualityController.java
@@ -55,7 +55,7 @@ public class CaptureQualityController implements SeekBar.OnSeekBarChangeListener
if (firstFps >= FRAMERATE_THRESHOLD && secondFps >= FRAMERATE_THRESHOLD
|| firstFps == secondFps) {
// Compare resolution.
- return first.width * first.height - second.width * second.height;
+ return first.size.width * first.size.height - second.size.width * second.size.height;
} else {
// Compare fps.
return firstFps - secondFps;
@@ -77,7 +77,7 @@ public class CaptureQualityController implements SeekBar.OnSeekBarChangeListener
long maxCaptureBandwidth = java.lang.Long.MIN_VALUE;
for (CaptureFormat format : formats) {
maxCaptureBandwidth = Math.max(maxCaptureBandwidth,
- (long) format.width * format.height * format.maxFramerate);
+ (long) format.size.width * format.size.height * format.framerate.max);
}
// Fraction between 0 and 1.
@@ -90,8 +90,8 @@ public class CaptureQualityController implements SeekBar.OnSeekBarChangeListener
// Choose the best format given a target bandwidth.
final CaptureFormat bestFormat = Collections.max(formats, compareFormats);
- width = bestFormat.width;
- height = bestFormat.height;
+ width = bestFormat.size.width;
+ height = bestFormat.size.height;
framerate = calculateFramerate(targetBandwidth, bestFormat);
captureFormatText.setText(width + "x" + height + " @ " + framerate + "fps");
}
@@ -107,8 +107,8 @@ public class CaptureQualityController implements SeekBar.OnSeekBarChangeListener
// Return the highest frame rate possible based on bandwidth and format.
private int calculateFramerate(double bandwidth, CaptureFormat format) {
- return (int) Math.round(Math.min(format.maxFramerate,
- (int) Math.round(bandwidth / (format.width * format.height))) / 1000.0);
+ return (int) Math.round(Math.min(format.framerate.max,
+ (int) Math.round(bandwidth / (format.size.width * format.size.height))) / 1000.0);
}
}

Powered by Google App Engine
This is Rietveld 408576698