diff options
author | Manikanta Kanamarlapudi <kmanikan@codeaurora.org> | 2019-05-03 12:54:35 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-05-06 05:21:29 -0700 |
commit | 0e4a20d9be972e7ffd093096510b1fd6d2ee1644 (patch) | |
tree | 09f0aa905f399d90eef6762449aab6d1868c778a /src/com/android/camera | |
parent | e7b55c8d6d823d58ea877b8819ed9669eb94034f (diff) | |
download | android_packages_apps_Snap-0e4a20d9be972e7ffd093096510b1fd6d2ee1644.tar.gz android_packages_apps_Snap-0e4a20d9be972e7ffd093096510b1fd6d2ee1644.tar.bz2 android_packages_apps_Snap-0e4a20d9be972e7ffd093096510b1fd6d2ee1644.zip |
Update bitrate only for software codecs
Choose minimum of profileBitrate and maxBitRate
as bitrate for software codecs.
Change-Id: I1220db9e38a415846b743ec71e3d72a4bc96b498
Diffstat (limited to 'src/com/android/camera')
-rw-r--r--[-rwxr-xr-x] | src/com/android/camera/CaptureModule.java | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index df0f43700..eda33fe81 100755..100644 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -5437,23 +5437,16 @@ public class CaptureModule implements CameraModule, PhotoController, if (!info.isEncoder() || info.getName().contains("google")) continue; for (String type : info.getSupportedTypes()) { if ((videoEncoder == MediaRecorder.VideoEncoder.MPEG_4_SP && type.equalsIgnoreCase(MediaFormat.MIMETYPE_VIDEO_MPEG4)) - || (videoEncoder == MediaRecorder.VideoEncoder.H263 && type.equalsIgnoreCase(MediaFormat.MIMETYPE_VIDEO_H263)) - || (videoEncoder == MediaRecorder.VideoEncoder.H264 && type.equalsIgnoreCase(MediaFormat.MIMETYPE_VIDEO_AVC)) - || (videoEncoder == MediaRecorder.VideoEncoder.HEVC && type.equalsIgnoreCase(MediaFormat.MIMETYPE_VIDEO_HEVC))) + || (videoEncoder == MediaRecorder.VideoEncoder.H263 && type.equalsIgnoreCase(MediaFormat.MIMETYPE_VIDEO_H263))) { CodecCapabilities codecCapabilities = info.getCapabilitiesForType(type); VideoCapabilities videoCapabilities = codecCapabilities.getVideoCapabilities(); try { if (videoCapabilities != null) { Log.d(TAG, "updateBitrate type is " + type + " " + info.getName()); - long maxBitRate = videoCapabilities.getBitrateRange().getUpper().intValue(); - int maxWidth = videoCapabilities.getSupportedWidths().getUpper().intValue(); - int maxHeight = videoCapabilities.getSupportedHeights().getUpper().intValue(); - Log.d(TAG, "updateBitrate size is " + width + "x" + height); - int adjustedBitRate = (int) (maxBitRate * width * height / (maxWidth * maxHeight)); - Log.d(TAG, "updateBitrate maxBitRate is " + maxBitRate + ", profileBitRate is " + bitRate - + ", adjustedBitRate is " + adjustedBitRate); - mMediaRecorder.setVideoEncodingBitRate(Math.min(bitRate, adjustedBitRate)); + int maxBitRate = videoCapabilities.getBitrateRange().getUpper().intValue(); + Log.d(TAG, "maxBitRate is " + maxBitRate + ", profileBitRate is " + bitRate); + mMediaRecorder.setVideoEncodingBitRate(Math.min(bitRate, maxBitRate)); return; } } catch (IllegalArgumentException e) { |