gpt4 book ai didi

android - Nexus 4 上的极端相机延迟

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:09:39 24 4
gpt4 key购买 nike

使用以下非常简单的相机预览 Activity ( from a google example found here ),Nexus 4 相机明显比设备的标准相机应用程序慢:

public class LiveCameraActivity extends Activity implements TextureView.SurfaceTextureListener {
private Camera mCamera;
private TextureView mTextureView;

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mTextureView = new TextureView(this);
mTextureView.setSurfaceTextureListener(this);

setContentView(mTextureView);
}

public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
mCamera = Camera.open();

try {
mCamera.setPreviewTexture(surface);
mCamera.startPreview();
} catch (IOException ioe) {
// Something bad happened
}
}

public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
// Ignored, Camera does all the work for us
}

public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
mCamera.stopPreview();
mCamera.release();
return true;
}

public void onSurfaceTextureUpdated(SurfaceTexture surface) {
// Invoked every time there's a new Camera preview frame
}
}

我的应用程序在 Nexus 4 上的相机速度一直存在问题,但我在其他设备上没有看到这个问题。我担心这是 Jelly Bean 4.2 的差异,但运行 JB4.2 的 Galaxy Nexus 手机可以正常工作,没有延迟。我意识到此示例代码使用了 TextureView,但其他手机不会遇到此示例的延迟。

如有任何帮助,我们将不胜感激。

最佳答案

我发现预览帧速率可以通过 setting the recording hint to true 提高到正常速率, 但这会严重降低相机性能,尤其是在中低光条件下的色彩饱和度和对比度(我对前置摄像头的质量感到震惊,因为这是谷歌与 iPhone 5 和她的 iPhone 5 竞争的最新和最大的尝试优质相机... can't wait for the X Phone )。

不是问题的解决方案,但对于希望避免令人震惊的帧速率的开发人员来说,它是一种创可贴。

关于android - Nexus 4 上的极端相机延迟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14131900/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com