试图超过最大出列缓冲区数(12)

时间:2018-06-03 09:39:01

标签: android kotlin

我正在构建一个app相机(api2),我会显示相机预览,捕捉和显示图像。

它工作但我的logcat有错误:

dequeueBuffer: attempting to exceed the max dequeued buffer count (12)

这是我的代码相机预览:

fun cameraPreview(){
    if(camOutputSizeWidth > camOutputSizeHeight){
        val layoutParam = RelativeLayout.LayoutParams(widthPixels,(widthPixels*camOutputSizeWidth)/(camOutputSizeHeight))
        mytextureView.layoutParams = layoutParam
    }else{
        val layoutParam = RelativeLayout.LayoutParams(widthPixels,(widthPixels*camOutputSizeHeight)/(camOutputSizeWidth))
        mytextureView.layoutParams = layoutParam
    }

    val texture = mytextureView.surfaceTexture
    texture.setDefaultBufferSize(camOutputSizeWidth, camOutputSizeWidth)

    val surface  = Surface(texture)
    captureRequestBuilder = mCamera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW)
    captureRequestBuilder.addTarget(surface)
    mCamera.createCaptureSession(arrayListOf(surface),CameraPreviewSessionCallback(), null)
}

为什么会出错?怎么办呢?

0 个答案:

没有答案