Field of camera preview is smaller if I use the way of preview in grifika's ContinuousCaptureActivity

不想你离开。 提交于 2019-12-20 04:25:27

问题


We know that we will get a lager field of preview at the same distance when camera preview ratio set to 4:3 instead of 16:9, the detail is as follows:

Android Camera API - Weird zoom effect

But I encountered a problem when I worked with android camera preview with opengl, that is the second way mentioned below.

There are 2 ways of implementing camera preview:

  1. Traditional way without opengl, just use Camera.setPreviewTexture(SurfaceTexture texture) or Camera.setPreviewDisplay(SurfaceHolder holder)
  2. The way of ContinuousCaptureActivity using opengl, we render the preview image with API swapBuffers().

The first way is OK, I will find that preview field become larger if preview ratio changed from 16:9 to 4:3.

However,The second way is not OK in some android phones, the preview field stay the same when preview ratio changed and the preview field is smaller than the first way at the ratio 4:3. I insist that this is an error, I want to resolve this problem very much, Who can give me some advices?


回答1:


After a struggle, I finally found out the exact reason, it is the API Camera.Parameters.setRecordingHint(true)

When I removed this clause in my source code, the field of preview became normal.

In one word, the API Camera.Parameters.setRecordingHint(true) is a bug in some android devices.

For some devices, if preview ratio is set to 4:3(use API Camera.Parameters.setPreviewSize(int, int)), calling API setRecordingHint(true) will cause the field of camera preview to be smaller.



来源:https://stackoverflow.com/questions/31114191/field-of-camera-preview-is-smaller-if-i-use-the-way-of-preview-in-grifikas-cont

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!