diff options
| author | Steve Kondik <shade@chemlab.org> | 2013-10-16 04:09:07 -0700 |
|---|---|---|
| committer | Steve Kondik <shade@chemlab.org> | 2013-10-16 09:13:58 -0700 |
| commit | 8a1aced9a1a2d070d3533f95b3bc3dedb1b1f282 (patch) | |
| tree | c47dfee5ba16fb5b3f5c741cd420464d1bf5a58a | |
| parent | dc33f268eaf56fc6c3f925218eaa0bb7dadeadc9 (diff) | |
| download | android_packages_apps_Gallery2-8a1aced9a1a2d070d3533f95b3bc3dedb1b1f282.tar.gz android_packages_apps_Gallery2-8a1aced9a1a2d070d3533f95b3bc3dedb1b1f282.tar.bz2 android_packages_apps_Gallery2-8a1aced9a1a2d070d3533f95b3bc3dedb1b1f282.zip | |
camera: Add workaround for broken video snapshots
* A certain device requires careful handling of this parameter
so that the hardware is configured properly and the memory is
freed after a video is recorded.
* Add workaround until bug is fixed.
Change-Id: I027bd16ecd76f85157cb8bf9dfc8d94c0d25fb76
| -rw-r--r-- | res/values/config.xml | 2 | ||||
| -rw-r--r-- | src/com/android/camera/VideoModule.java | 29 |
2 files changed, 20 insertions, 11 deletions
diff --git a/res/values/config.xml b/res/values/config.xml index 88ea0ade0..94c2e4d1a 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -50,4 +50,6 @@ <!-- Stay in continuous focus even if touch-to-focus is used This option doesn't make sense if wantsFocusModes is on --> <bool name="useContinuosFocusForTouch">false</bool> + <!-- A certain beefy device has issues with video snapshots --> + <bool name="useVideoSnapshotWorkaround">false</bool> </resources> diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index 0cef4677c..ce8a97ae9 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -1712,8 +1712,10 @@ public class VideoModule implements CameraModule, if (!mPaused) { mActivity.mCameraDevice.lock(); mActivity.mCameraDevice.waitDone(); - if (ApiHelper.HAS_SURFACE_TEXTURE && - !ApiHelper.HAS_SURFACE_TEXTURE_RECORDING) { + if ((ApiHelper.HAS_SURFACE_TEXTURE && + !ApiHelper.HAS_SURFACE_TEXTURE_RECORDING) || + !mActivity.getResources().getBoolean( + R.bool.useVideoSnapshotWorkaround)) { stopPreview(); // Switch back to use SurfaceTexture for preview. ((CameraScreenNail) mActivity.mCameraScreenNail).setOneTimeOnFrameDrawnListener( @@ -1921,15 +1923,20 @@ public class VideoModule implements CameraModule, // The logic here is different from the logic in still-mode camera. // There we determine the preview size based on the picture size, but // here we determine the picture size based on the preview size. - List<Size> supported = mParameters.getSupportedPictureSizes(); - Size optimalSize = Util.getOptimalVideoSnapshotPictureSize(supported, - (double) mDesiredPreviewWidth / mDesiredPreviewHeight); - Size original = mParameters.getPictureSize(); - if (!original.equals(optimalSize)) { - mParameters.setPictureSize(optimalSize.width, optimalSize.height); - } - Log.v(TAG, "Video snapshot size is " + optimalSize.width + "x" + - optimalSize.height); + if (!mActivity.getResources().getBoolean(R.bool.useVideoSnapshotWorkaround)) { + List<Size> supported = mParameters.getSupportedPictureSizes(); + Size optimalSize = Util.getOptimalVideoSnapshotPictureSize(supported, + (double) mDesiredPreviewWidth / mDesiredPreviewHeight); + Size original = mParameters.getPictureSize(); + if (!original.equals(optimalSize)) { + mParameters.setPictureSize(optimalSize.width, optimalSize.height); + } + Log.v(TAG, "Video snapshot size is " + optimalSize.width + "x" + + optimalSize.height); + } else { + // At least one device will get bus overflows if we set this too high + mParameters.setPictureSize(mDesiredPreviewWidth, mDesiredPreviewHeight); + } // Set JPEG quality. int jpegQuality = CameraProfile.getJpegEncodingQualityParameter(mCameraId, |
