diff options
author | Sai Kumar Sanagavarapu <ssanagav@codeaurora.org> | 2014-01-23 15:27:14 +0530 |
---|---|---|
committer | Abhisek Devkota <ciwrl@cyanogenmod.com> | 2014-10-20 22:24:17 +0000 |
commit | 7c9c58454caf1b0b6ef2f00b7c12503f8b56b763 (patch) | |
tree | 1434275011d86a23f65b8b2a933fd505e7967a67 | |
parent | 08a1edda789db5e55dda96d9518114cfa1daa698 (diff) | |
download | android_packages_apps_Camera2-7c9c58454caf1b0b6ef2f00b7c12503f8b56b763.tar.gz android_packages_apps_Camera2-7c9c58454caf1b0b6ef2f00b7c12503f8b56b763.tar.bz2 android_packages_apps_Camera2-7c9c58454caf1b0b6ef2f00b7c12503f8b56b763.zip |
Camera: Check if codec supports HFR resolution/fps.
Some codecs can have limitation on the max HFR fps and video
size combination. So, query the video encoder capabilites first
and report error if codec doesnt support the combination.
Change-Id: Ic2032176067a6f92d1363471d1a767d5ef589591
-rw-r--r-- | src/com/android/camera/VideoModule.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index caeb270c4..9958ed81c 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -2065,6 +2065,30 @@ public class VideoModule implements CameraModule, Log.e(TAG, "supported hfr sizes is null"); } + int hfrFps = Integer.parseInt(highFrameRate); + int inputBitrate = videoWidth*videoHeight*hfrFps; + + //check if codec supports the resolution, otherwise throw toast + List<VideoEncoderCap> videoEncoders = EncoderCapabilities.getVideoEncoders(); + for (VideoEncoderCap videoEncoder: videoEncoders) { + if (videoEncoder.mCodec == mVideoEncoder){ + int maxBitrate = (videoEncoder.mMaxHFRFrameWidth * + videoEncoder.mMaxHFRFrameHeight * + videoEncoder.mMaxHFRMode); + if (inputBitrate > maxBitrate ){ + Log.e(TAG,"Selected codec "+mVideoEncoder+ + " does not support HFR " + highFrameRate + " with "+ videoWidth + + "x" + videoHeight +" resolution"); + Log.e(TAG, "Codec capabilities: " + + "mMaxHFRFrameWidth = " + videoEncoder.mMaxHFRFrameWidth + " , "+ + "mMaxHFRFrameHeight = " + videoEncoder.mMaxHFRFrameHeight + " , "+ + "mMaxHFRMode = " + videoEncoder.mMaxHFRMode); + mUnsupportedHFRVideoSize = true; + } + break; + } + } + if(mUnsupportedHFRVideoSize) Log.v(TAG,"Unsupported hfr resolution"); |