Commit 9bb9310b authored by Kuo Jen Wei's avatar Kuo Jen Wei Committed by Commit Bot

[CCA] Treat 848:480 as 16:9 aspect ratio

Bug: b:147986763
Test: Pass 'tast run <DUT> camera.CCAUIResolutions' with
crrev.com/c/2128208 on treeya

Change-Id: Ia3181cbfd0438b36f403ace4f4771b0fdfd40955
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2127995Reviewed-by: default avatarWei Lee <wtlee@chromium.org>
Reviewed-by: default avatarShik Chen <shik@chromium.org>
Commit-Queue: Kuo Jen Wei <inker@chromium.org>
Auto-Submit: Kuo Jen Wei <inker@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756956}
parent 1bf2119d
...@@ -501,17 +501,26 @@ export class PhotoConstraintsPreferrer extends ConstraintsPreferrer { ...@@ -501,17 +501,26 @@ export class PhotoConstraintsPreferrer extends ConstraintsPreferrer {
* @private * @private
*/ */
pairCapturePreviewResolutions_(captureResolutions, previewResolutions) { pairCapturePreviewResolutions_(captureResolutions, previewResolutions) {
const toSupportedPreviewRatio = (r) => {
// Special aspect ratio mapping rule, see http://b/147986763.
if (r.width === 848 && r.height === 480) {
return (new Resolution(16, 9)).aspectRatio;
}
return r.aspectRatio;
};
/** @type {!Object<string, !ResolutionList>} */ /** @type {!Object<string, !ResolutionList>} */
const previewRatios = previewResolutions.reduce((rs, r) => { const previewRatios = previewResolutions.reduce((rs, r) => {
rs[r.aspectRatio] = rs[r.aspectRatio] || []; const ratio = toSupportedPreviewRatio(r);
rs[r.aspectRatio].push(r); rs[ratio] = rs[ratio] || [];
rs[ratio].push(r);
return rs; return rs;
}, {}); }, {});
/** @type {!Object<string, !ResolutionList>} */ /** @type {!Object<string, !ResolutionList>} */
const captureRatios = captureResolutions.reduce((rs, r) => { const captureRatios = captureResolutions.reduce((rs, r) => {
if (r.aspectRatio in previewRatios) { const ratio = toSupportedPreviewRatio(r);
rs[r.aspectRatio] = rs[r.aspectRatio] || []; if (ratio in previewRatios) {
rs[r.aspectRatio].push(r); rs[ratio] = rs[ratio] || [];
rs[ratio].push(r);
} }
return rs; return rs;
}, {}); }, {});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment