summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/CaptureModule.java
diff options
context:
space:
mode:
authorByunghun Jeon <bjeon@codeaurora.org>2016-07-29 11:14:33 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-08-16 16:14:23 -0700
commitbfd4c0fd72d6a53464c7f894f79157a23aad8980 (patch)
tree1df0bbc4d198c38a9055820b9edff81ecd3e154b /src/com/android/camera/CaptureModule.java
parent0321ab092671d680373bff35673fa6a069d7e57e (diff)
downloadandroid_packages_apps_Snap-bfd4c0fd72d6a53464c7f894f79157a23aad8980.tar.gz
android_packages_apps_Snap-bfd4c0fd72d6a53464c7f894f79157a23aad8980.tar.bz2
android_packages_apps_Snap-bfd4c0fd72d6a53464c7f894f79157a23aad8980.zip
SnapdragonCamera: Fix video capture bandwith issue
When setting video size to 4k, it results in bandwidth issue due to using full size for preview stream. Limit the size of preview stream to avoid this issue. CRs-Fixed: 1050099 Change-Id: I730ecc8ba3e7ee41da4e7ef2604e147c35a79c1a
Diffstat (limited to 'src/com/android/camera/CaptureModule.java')
-rw-r--r--src/com/android/camera/CaptureModule.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 5566737e5..4d34cc27c 100644
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -250,6 +250,7 @@ public class CaptureModule implements CameraModule, PhotoController,
private CameraCaptureSession mCurrentSession;
private Size mPreviewSize;
private Size mPictureSize;
+ private Size mVideoPreviewSize;
private Size mVideoSize;
private Size mVideoSnapshotSize;
@@ -2141,6 +2142,11 @@ public class CaptureModule implements CameraModule, PhotoController,
private void updateVideoSize() {
String videoSize = mSettingsManager.getValue(SettingsManager.KEY_VIDEO_QUALITY);
mVideoSize = parsePictureSize(videoSize);
+ Point screenSize = new Point();
+ mActivity.getWindowManager().getDefaultDisplay().getSize(screenSize);
+ Size[] prevSizes = mSettingsManager.getSupportedOutputSize(getMainCameraId(),
+ MediaRecorder.class);
+ mVideoPreviewSize = getOptimalPreviewSize(mVideoSize, prevSizes, screenSize.x, screenSize.y);
}
private void updateVideoSnapshotSize() {
@@ -2179,7 +2185,8 @@ public class CaptureModule implements CameraModule, PhotoController,
mControlAFMode = CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE;
closePreviewSession();
mFrameProcessor.onClose();
- boolean changed = mUI.setPreviewSize(mVideoSize.getWidth(), mVideoSize.getHeight());
+ boolean changed = mUI.setPreviewSize(mVideoPreviewSize.getWidth(),
+ mVideoPreviewSize.getHeight());
if (changed) {
mUI.hideSurfaceView();
mUI.showSurfaceView();
@@ -2193,17 +2200,24 @@ public class CaptureModule implements CameraModule, PhotoController,
List<Surface> surfaces = new ArrayList<>();
Surface surface = getPreviewSurfaceForSession(cameraId);
- mFrameProcessor.init(mVideoSize);
+
if(mFrameProcessor.isFrameFilterEnabled()) {
+ mFrameProcessor.init(mVideoSize);
mActivity.runOnUiThread(new Runnable() {
public void run() {
mUI.getSurfaceHolder().setFixedSize(mVideoSize.getHeight(), mVideoSize.getWidth());
}
});
+ mFrameProcessor.setOutputSurface(surface);
+ mFrameProcessor.setVideoOutputSurface(mMediaRecorder.getSurface());
+ addPreviewSurface(mPreviewBuilder, surfaces, cameraId);
+ } else {
+ surfaces.add(surface);
+ mPreviewBuilder.addTarget(surface);
+ surfaces.add(mMediaRecorder.getSurface());
+ mPreviewBuilder.addTarget(mMediaRecorder.getSurface());
}
- mFrameProcessor.setOutputSurface(surface);
- mFrameProcessor.setVideoOutputSurface(mMediaRecorder.getSurface());
- addPreviewSurface(mPreviewBuilder, surfaces, cameraId);
+
if (!mHighSpeedCapture) surfaces.add(mVideoSnapshotImageReader.getSurface());
else mPreviewBuilder.set(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, mHighSpeedFPSRange);