diff options
| author | Yin-Chia Yeh <yinchiayeh@google.com> | 2015-03-27 11:35:31 -0700 | 
|---|---|---|
| committer | Yin-Chia Yeh <yinchiayeh@google.com> | 2015-03-31 11:24:04 -0700 | 
| commit | 44d842a762e463f0a29e95036e97fef2def4b8ea (patch) | |
| tree | 4207632235575adb437d1c39148e5e497bcd2bed /services/camera | |
| parent | 0e4421286b92a81e952f53210227adbf05d97c25 (diff) | |
| download | frameworks_av-44d842a762e463f0a29e95036e97fef2def4b8ea.zip frameworks_av-44d842a762e463f0a29e95036e97fef2def4b8ea.tar.gz frameworks_av-44d842a762e463f0a29e95036e97fef2def4b8ea.tar.bz2  | |
Camera: iterate through all encoders for finding max video size
Bug: 19712132
Change-Id: I5c1fc748fcc756f6665c31951f8af8a37ff4254d
Diffstat (limited to 'services/camera')
| -rw-r--r-- | services/camera/libcameraservice/api1/client2/Parameters.cpp | 26 | 
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  | 
