Bug 1124338 - Fix possible camera cached parameters invalidation from underlying driver modification. r=aosmond

This commit is contained in:
Roger Yang 2015-05-24 11:36:00 -04:00
parent c7f9cc167f
commit 160a111f22
2 changed files with 35 additions and 2 deletions

View File

@ -179,7 +179,7 @@ nsGonkCameraControl::Initialize()
mCurrentConfiguration.mRecorderProfile.Truncate();
// Initialize our camera configuration database.
PullParametersImpl();
mCameraHw->PullParameters(mParams);
// Set preferred preview frame format.
mParams.Set(CAMERA_PARAM_PREVIEWFORMAT, NS_LITERAL_STRING("yuv420sp"));
@ -1127,7 +1127,13 @@ nsGonkCameraControl::PullParametersImpl()
DOM_CAMERA_LOGI("Pulling camera parameters\n");
RETURN_IF_NO_CAMERA_HW();
return mCameraHw->PullParameters(mParams);
nsresult rv = mCameraHw->PullParameters(mParams);
mParams.Get(CAMERA_PARAM_THUMBNAILSIZE, mLastThumbnailSize);
mParams.Get(CAMERA_PARAM_PICTURE_SIZE, mCurrentConfiguration.mPictureSize);
mParams.Get(CAMERA_PARAM_PREVIEWSIZE, mCurrentConfiguration.mPreviewSize);
mParams.Get(CAMERA_PARAM_VIDEOSIZE, mLastRecorderSize);
return rv;
}
nsresult

View File

@ -527,6 +527,33 @@ suite.test('bug-1052851', function() {
.then(resolve, suite.rejectGetCamera);
});
suite.test('bug-1124338', function() {
function triggerAutoFocus(p) {
var sync = new Promise(function(resolve, reject) {
function onEvent(e) {
suite.camera.removeEventListener('focus', onEvent);
var thumbnailSize = suite.camera.getThumbnailSize();
ok(thumbnailSize.width == 640 && thumbnailSize.height == 480, 'thumbnail size reset with auto focus');
resolve();
}
suite.camera.addEventListener('focus', onEvent);
});
var initThumbnailSize = suite.camera.getThumbnailSize();
ok(initThumbnailSize.width == 320 && initThumbnailSize.height == 240, 'initial thumbnail size incorrect');
suite.hw.params['jpeg-thumbnail-width'] = '640';
suite.hw.params['jpeg-thumbnail-height'] = '480';
suite.hw.fireAutoFocusComplete(false);
return sync;
}
suite.hw.params['jpeg-thumbnail-size-values'] = '320x240,640x480';
suite.hw.params['jpeg-thumbnail-width'] = '320';
suite.hw.params['jpeg-thumbnail-height'] = '240';
return suite.getCamera()
.then(triggerAutoFocus)
});
suite.setup()
.then(suite.run);