summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2013-10-16 04:09:07 -0700
committerSteve Kondik <shade@chemlab.org>2013-10-16 09:13:58 -0700
commit8a1aced9a1a2d070d3533f95b3bc3dedb1b1f282 (patch)
treec47dfee5ba16fb5b3f5c741cd420464d1bf5a58a /src
parentdc33f268eaf56fc6c3f925218eaa0bb7dadeadc9 (diff)
downloadandroid_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
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/VideoModule.java29
1 files changed, 18 insertions, 11 deletions
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,