Android front camera debugging minutes

Source: Internet
Author: User

 

Recently, Android 2.3.5 (CM-basedCodeThe front camera records the problems encountered and solutions for review.

1: Why can't upper-layer applications obtain information about the front camera?

Messages from the front camera are generally stored in the Hal layer, for example, in Samsung's Crespo. However, CM strangely implemented these interfaces in the framework layer (cameraservice. cpp) about HTC adaptation ). This should be in conflict with the android architecture. In addition, for non-HTC mobile phones, 1 is returned directly when the number of cameras in front is obtained. As a result, the upper layer cannot detect the existence of the front camera. Solution: In cameraservice, disable cm to obtain the camera modification and implement it at the Hal layer. The main interfaces are hal_getnumberofcameras, hal_getcamerainfo,
Hal_opencamerahardware.

2 :) when you press the shutter button, the preview will display a small frame with auto focus, but there is no photo action, and the result isProgramDie.

Cause: in 2.3.5, cameraservice: when the client calls autofocos, the autofocus function at the Hal layer is used. The hardware I debugged does not have the auto focus function, but it will be called here because the preliminary parameters are not set correctly. In the autofucs of the Hal layer, the callback function of notifycallback notifies cameraservice: client. However, the lockifmessagewanted function is added to notifycallback in 2.3.5, and the function is changed to try to return the lock. If it cannot be obtained, it will be obtained all the time. At this time, autofocus has not been executed yet (it will never be executed), but it still holds. So it will lead to deadlocks. In addition, after pressing the shutter key in the future, the transplant will not perform the photo operation, because the changes also need to first get the lock.

The solution is actually very simple. When initializing cameraparameters, set the focusmode to infinity. If you have the auto focus function, you cannot notify the framework layer in the aotufocus process. You can create a detached thread to return the status.

3: You can use the pre-camera, but when you switch to the camera, the process will die.

The video is stored as a 3GP or MP4 file, which must be encoded. This information is controlled by the meidaprofiles. cpp file. When the class is initialized, the system searches for the meida_profiles.xml file under/etc. If the file is not found, the default setting is performed. The default setting does not set the encoding information of the front camera.

Solution: add the front camera encoding information to the media_profiles.xml file. Copy the part of the rear camera, but remember to set cameraid.

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.