在Nexus 4至尊相机滞后 [英] Extreme camera lag on Nexus 4

查看:254
本文介绍了在Nexus 4至尊相机滞后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用下面的非常简单的摄像头preVIEW活动(从这里找到),Nexus的4摄像头是明显慢了该设备的标准摄像头应用程序:

Using the following very simple camera preview activity (from a google example found here), the Nexus 4 camera is noticeably slower that the device's standard camera application:

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与我的应用程序的摄像头速度的问题,但我看到没有其他设备这个问题。我很担心,这是一个果冻豆4.2的区别,但Galaxy Nexus的手机运行的JB4.2工作正常,没有滞后。我意识到这个例子code使用TextureView,但其他手机没有这个例子遇到网络延迟。

I have been having issues with my application's camera speed on the Nexus 4, but I see this problem on no other devices. I was concerned that this was a Jelly Bean 4.2 difference, but Galaxy Nexus phones running JB4.2 work as normal with no lag. I realize this example code uses a TextureView, but other phones do not experience lag with this example.

任何帮助将大大AP preciated。

Any help would be greatly appreciated.

推荐答案

我已发现,preVIEW帧速率可以通过提高到正常的速率<一href=\"http://developer.android.com/reference/android/hardware/Camera.Parameters.html#setRecordingHint%28boolean%29\">setting录音提示真,但是这严重降低尤其是在中低光照情况下对于色彩饱和度和对比度的相机性能(我在给定的,这是谷歌的最新和最伟大的前置摄像头的质量惊呆了尝试与iPhone 5和她的品质相机相抗衡...... 不能等待为X手机)。

I have found that the preview frame rate can be increased to a normal rate by setting the recording hint to true, but this severely decreases camera performance especially in medium to low light situations with regard to color saturation and contrast (I am shocked at the quality of the front facing camera given that this is Google's latest and greatest attempt to compete with the iPhone 5 and her quality cameras... can't wait for the X Phone).

这是不会这个问题的解决方案,但它是一个创可贴,为开发人员希望避免令人震惊的帧速率的东西。

This is not a solution to the problem, but it is something of a band-aid for developers looking to avoid shocking frame rates.

这篇关于在Nexus 4至尊相机滞后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆