问题:logcat.txt:05-30 21:02:30.304 24824 15469 E QCamera : <HAL><ERROR> enqueueBuffer: 2004: enqueue_buffer failed, err = -38 logcat.txt:05-30 21:02:30.304 24824 15469 E QCamera : <HAL><ERROR> synchronous_stream_cb_routine: 831: Enqueue Buffer failed logcat.txt:05-30 21:02:30.305 24867 24899 E Surface : queueBuffer: error queuing buffer to SurfaceTexture, -32 log中有这样的报错,所以调查buffer的分配、释放、管理。 enqueueBuffer的分析int32_t QCameraGrallocMemory::enqueueBuffer(uint32_t index, nsecs_t timeStamp) { err = mWindow->enqueue_buffer(mWindow, (buffer_handle_t *)mBufferHandle[index]); } mWindow设置在如下函数: void QCameraGrallocMemory::setWindowInfo(preview_stream_ops_t *window, int width, int height, int stride, int scanline, int format, int maxFPS, int usage) { mWindow = window; mWidth = width; mHeight = height; mStride = stride; mScanline = scanline; mFormat = format; mUsage = usage; setMaxFPS(maxFPS); } 该函数的调用如下: QCameraMemory *QCamera2HardwareInterface::allocateStreamBuf( cam_stream_type_t stream_type, size_t size, int stride, int scanline, uint8_t &bufferCnt) { case CAM_STREAM_TYPE_PREVIEW: { if (isNoDisplayMode()) { mem = new QCameraStreamMemory(mGetMemory, mCallbackCookie, bCachedMem, (bPoolMem) ? &m_memoryPool : NULL, stream_type); } else { cam_dimension_t dim; int minFPS, maxFPS; QCameraGrallocMemory *grallocMemory = NULL; grallocMemory = new QCameraGrallocMemory(mGetMemory, mCallbackCookie); mParameters.getStreamDimension(stream_type, dim); /* we are interested only in maxfps here */ mParameters.getPreviewFpsRange(&minFPS, &maxFPS); int usage = 0; if(mParameters.isUBWCEnabled()) { cam_format_t fmt; mParameters.getStreamFormat(CAM_STREAM_TYPE_PREVIEW,fmt); if (fmt == CAM_FORMAT_YUV_420_NV12_UBWC) { usage = GRALLOC_USAGE_PRIVATE_ALLOC_UBWC ; } } if (grallocMemory) { grallocMemory->setMappable( CAMERA_INITIAL_MAPPABLE_PREVIEW_BUFFERS); grallocMemory->setWindowInfo(mPreviewWindow, dim.width,dim.height, stride, scanline, mParameters.getPreviewHalPixelFormat(), maxFPS, usage); pthread_mutex_lock(&mGrallocLock); if (bufferCnt > CAMERA_INITIAL_MAPPABLE_PREVIEW_BUFFERS) { mEnqueuedBuffers = (bufferCnt - CAMERA_INITIAL_MAPPABLE_PREVIEW_BUFFERS); } else { mEnqueuedBuffers = 0; } pthread_mutex_unlock(&mGrallocLock); } mem = grallocMemory; } } } |
|
来自: 新用户8389DdzY > 《高通》