summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorYin-Chia Yeh <yinchiayeh@google.com>2015-03-31 18:24:57 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-03-31 18:24:57 +0000
commit904edf8413039d816e5aaa0d4db51d34e08c232a (patch)
tree4366f59b80703273555e94f16d2648c7c1a426e6 /services
parent7699916e839f56fe827cc3d674f14a46b3e08a56 (diff)
parent44d842a762e463f0a29e95036e97fef2def4b8ea (diff)
downloadframeworks_av-904edf8413039d816e5aaa0d4db51d34e08c232a.zip
frameworks_av-904edf8413039d816e5aaa0d4db51d34e08c232a.tar.gz
frameworks_av-904edf8413039d816e5aaa0d4db51d34e08c232a.tar.bz2
Merge "Camera: iterate through all encoders for finding max video size"
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/api1/client2/Parameters.cpp26
1 files changed, 20 insertions, 6 deletions
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp
index 87e0132..6b0f8b5 100644
--- a/services/camera/libcameraservice/api1/client2/Parameters.cpp
+++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp
@@ -65,15 +65,29 @@ status_t Parameters::initialize(const CameraMetadata *info, int deviceVersion) {
const Size MAX_PREVIEW_SIZE = { MAX_PREVIEW_WIDTH, MAX_PREVIEW_HEIGHT };
// Treat the H.264 max size as the max supported video size.
MediaProfiles *videoEncoderProfiles = MediaProfiles::getInstance();
- int32_t maxVideoWidth = videoEncoderProfiles->getVideoEncoderParamByName(
- "enc.vid.width.max", VIDEO_ENCODER_H264);
- int32_t maxVideoHeight = videoEncoderProfiles->getVideoEncoderParamByName(
- "enc.vid.height.max", VIDEO_ENCODER_H264);
- const Size MAX_VIDEO_SIZE = {maxVideoWidth, maxVideoHeight};
+ Vector<video_encoder> encoders = videoEncoderProfiles->getVideoEncoders();
+ int32_t maxVideoWidth = 0;
+ int32_t maxVideoHeight = 0;
+ for (size_t i = 0; i < encoders.size(); i++) {
+ int width = videoEncoderProfiles->getVideoEncoderParamByName(
+ "enc.vid.width.max", encoders[i]);
+ int height = videoEncoderProfiles->getVideoEncoderParamByName(
+ "enc.vid.height.max", encoders[i]);
+ // Treat width/height separately here to handle the case where different
+ // profile might report max size of different aspect ratio
+ if (width > maxVideoWidth) {
+ maxVideoWidth = width;
+ }
+ if (height > maxVideoHeight) {
+ maxVideoHeight = height;
+ }
+ }
+ // This is just an upper bound and may not be an actually valid video size
+ const Size VIDEO_SIZE_UPPER_BOUND = {maxVideoWidth, maxVideoHeight};
res = getFilteredSizes(MAX_PREVIEW_SIZE, &availablePreviewSizes);
if (res != OK) return res;
- res = getFilteredSizes(MAX_VIDEO_SIZE, &availableVideoSizes);
+ res = getFilteredSizes(VIDEO_SIZE_UPPER_BOUND, &availableVideoSizes);
if (res != OK) return res;
// Select initial preview and video size that's under the initial bound and