summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2018-11-30 10:29:51 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2018-11-30 10:29:51 -0800
commit14ff02756c32293d2d9498140efe518d56ae0c84 (patch)
tree5877fbca45c15e52b9468127d1ac3eb9f726ab3e /src
parent3f4542a0daa9868853fb10dbeed2c388940c28c1 (diff)
parentdd30707c2d5987c6329a142a7566206390913fe1 (diff)
downloadandroid_packages_apps_Snap-14ff02756c32293d2d9498140efe518d56ae0c84.tar.gz
android_packages_apps_Snap-14ff02756c32293d2d9498140efe518d56ae0c84.tar.bz2
android_packages_apps_Snap-14ff02756c32293d2d9498140efe518d56ae0c84.zip
Merge "Upate liveshot size" into camera-SnapdragonCamera.lnx.2.0
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/android/camera/CaptureModule.java41
1 files changed, 32 insertions, 9 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 390834edf..77b399a59 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -4223,16 +4223,10 @@ public class CaptureModule implements CameraModule, PhotoController,
private void updateVideoSnapshotSize() {
mVideoSnapshotSize = mVideoSize;
- if (isVideoSize1080P(mVideoSnapshotSize)) {
- updateHFRSetting();
- mHighSpeedFPSRange = new Range(mHighSpeedCaptureRate, mHighSpeedCaptureRate);
- Log.d(TAG,"updateVideoSnapshotSize " + mHighSpeedCaptureRate);
- boolean is60FPS = ((int)mHighSpeedFPSRange.getUpper() == 60);
- // if video is 1080p encode except 60fps, VideoSnapShotSize set 16M(5312x2988)
- if (!is60FPS) {
- mVideoSnapshotSize = new Size(5312, 2988);
- }
+ if (!is4kSize(mVideoSize) && (mHighSpeedCaptureRate == 0)) {
+ mVideoSnapshotSize = getMaxPictureSizeLiveshot();
}
+
String videoSnapshot = getVideoSnapshotSize();
String[] sourceStrArray = videoSnapshot.split("x");
if (sourceStrArray != null && sourceStrArray.length >= 2) {
@@ -4246,6 +4240,35 @@ public class CaptureModule implements CameraModule, PhotoController,
mVideoSnapshotThumbSize = getOptimalPreviewSize(mVideoSnapshotSize, thumbSizes); // get largest thumb size
}
+ private boolean is4kSize(Size size) {
+ return (size.getHeight() >= 2160 || size.getWidth() >= 3840);
+ }
+
+ private Size getMaxPictureSizeLiveshot() {
+ Size[] sizes = mSettingsManager.getSupportedOutputSize(getMainCameraId(), ImageFormat.JPEG);
+ float ratio = (float) mVideoSize.getWidth() / mVideoSize.getHeight();
+ Size optimalSize = null;
+ for (Size size : sizes) {
+ float pictureRatio = (float) size.getWidth() / size.getHeight();
+ if (Math.abs(pictureRatio - ratio) > 0.01) continue;
+ if (optimalSize == null || size.getWidth() > optimalSize.getWidth()) {
+ optimalSize = size;
+ }
+ }
+
+ // Cannot find one that matches the aspect ratio. This should not happen.
+ // Ignore the requirement.
+ if (optimalSize == null) {
+ Log.w(TAG, "getMaxPictureSizeLiveshot: no picture size match the aspect ratio");
+ for (Size size : sizes) {
+ if (optimalSize == null || size.getWidth() > optimalSize.getWidth()) {
+ optimalSize = size;
+ }
+ }
+ }
+ return optimalSize;
+ }
+
private String getVideoSnapshotSize(){
return SystemProperties.get("persist.sys.camera.video.snapshotsize", "");
}