繁体   English   中英

setTorchMode非常慢,如何加快通话速度?

[英]setTorchMode is very slow, how can I speed up the call?

我需要在特定时间闪光相机闪光灯,最好以每0.5秒2ms的精度闪烁。 有了音频,我已经做到了这一点,但是对setTorchMode的调用似乎花费了将近1 / 2s。 我试图将调用放在Runnable中,但是(如预期的那样)会产生积压。 这是我的计时测量:

  public void doFlash() {
        if (cameraManager == null) return;
        try {
            Log.d(TAG,"1="+System.nanoTime()/1000000);
            cameraManager.setTorchMode(cameraId, true);
            Log.d(TAG,"2="+System.nanoTime()/1000000);
            yield();
            Log.d(TAG,"3="+System.nanoTime()/1000000);
            cameraManager.setTorchMode(cameraId, false);
            Log.d(TAG,"4="+System.nanoTime()/1000000);
            Log.d(TAG,"-------------");
        } catch (Exception e) {
            Log.d(TAG, "Could not switch on flash");
        }
    }
}

02-02 23:06:57.950 17528-17792 / tech.glasgowneuro.attyseeg D / EPFragment:1 = 1662873286 02-02 23:06:58.668 17528-17792 / tech.glasgowneuro.attyseeg D / EPFragment:2 = 1662874004 02- 02 23:06:58.668 17528-17792 / tech.glasgowneuro.attyseeg D / EPFragment:3 = 1662874004 02-02 23:06:59.149 17528-17792 / tech.glasgowneuro.attyseeg D / EPFragment:4 = 1662874484 02-02 23 :06:59.149 17528-17792 / tech.glasgowneuro.attyseeg D / EPFragment:------------- 02-02 23:06:59.149 17528-17792 / tech.glasgowneuro.attyseeg D / EPFragment :1 = 1662874484 02-02 23:06:59.649 17528-17792 / tech.glasgowneuro.attyseeg D / EPFragment:2 = 1662874985 02-02 23:06:59.649 17528-17792 / tech.glasgowneuro.attyseeg D / EPFragment:3 = 1662874985 02-02 23:07:00.074 17528-17792 / tech.glasgowneuro.attyseeg D / EPFragment:4 = 1662875409

我很困惑为什么这个功能需要这么长时间? 是否有其他通话速度更快,或者如何在2ms或更短的时间内完成通话?

我同意这一点-大约需要1/3到1秒(三星Galaxy S7)。 与旧的“相机”相比,如果您想眨眼,则无法使用...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM