Я использую пример hello_ar_ c. Когда я пытаюсь получить текущий образ процессора, если я впоследствии его выпускаю, приложение вылетает.
void HelloArApplication::OnDrawFrame() {
// Render the scene.
glClearColor(0.9f, 0.9f, 0.9f, 1.0f);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (ar_session_ == nullptr) return;
ArSession_setCameraTextureName(ar_session_,
background_renderer_.GetTextureId());
// Update session to get current frame and render camera background.
if (ArSession_update(ar_session_, ar_frame_) != AR_SUCCESS) {
LOGE("HelloArApplication::OnDrawFrame ArSession_update error");
}
ArCamera* ar_camera;
ArFrame_acquireCamera(ar_session_, ar_frame_, &ar_camera);
ArImage* ar_image;
ArFrame_acquireCameraImage(ar_session_, ar_frame_, &ar_image);
ArImage_release(ar_image);
Вот трассировка стека:
2020-03-15 18:27:32.211 818-6317/? I/cie: FaceStoryAlgo::isCurFrameRun isCurFrameRun. Process mode 0.
2020-03-15 18:27:32.212 818-1473/? I/AlgoEvent: [HWA_CAM3]yuv tracking rect[0 0 0 0] raw tracking rect[0 0 0 0]
2020-03-15 18:27:32.212 818-6311/? D/Misc____: [0b99617d_64D] onProcessFrame(666), afDistance(0.000000)
2020-03-15 18:27:32.212 656-656/? I/mediacomm@2.1-service: getMdcClient:114: get client<Camera, 117, 818>, channel<4, 1>, perfLev=2, powerStatue=0.
2020-03-15 18:27:32.212 656-656/? I/mediacomm@2.1-service: getMdcVotePerfLev:179: Connected Mdc client<Camera, 117, 818> channel<4, 1> perfLev<2>
2020-03-15 18:27:32.213 800-1480/? E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -32
2020-03-15 18:27:32.213 800-1480/? E/Camera3-OutputStream: returnBufferCheckedLocked: Stream 1: Error queueing buffer to native window: Broken pipe (-32)
2020-03-15 18:27:32.213 800-1480/? E/Camera3-Device: Can't return buffer to its stream: (0xe9921480), error: Broken pipe (-32)
2020-03-15 18:27:32.215 656-656/? I/mediacomm@2.1-service: doCopybit:495: client<Camera, 0> ret = 818 finish copybit -.
2020-03-15 18:27:32.215 818-6320/? I/GRALLOC: LockFlexLayout: baseFormat: 11, yStride: 640, ySize: 307200, uOffset: 307200, uStride: 640
2020-03-15 18:27:32.215 818-6320/? I/GRALLOC: LockFlexLayout: baseFormat: 11, yStride: 640, ySize: 307200, uOffset: 307200, uStride: 640
2020-03-15 18:27:32.215 800-1480/? E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -32
2020-03-15 18:27:32.215 800-1480/? E/Camera3-OutputStream: returnBufferCheckedLocked: Stream 0: Error queueing buffer to native window: Broken pipe (-32)
2020-03-15 18:27:32.215 800-1480/? E/Camera3-Device: Can't return buffer to its stream: (0xe9923700), error: Broken pipe (-32)
2020-03-15 18:27:32.228 818-6308/? I/HwaStatInfo: [0b99617d_64I] algotype is 0, videoRatio is 1.000000, ratio is 2.666667, faceNum is 0
2020-03-15 18:27:32.228 818-6322/? I/afstatAlgo: do_afstat_num:0,flow =0, aftype:0, focus_stage = 0,focus_scene:0 fv[code:0 normalFV:0, peakHoldFV:0],frame_rect[0, 0], focus_rect[0 0 0 0]
2020-03-15 18:27:32.245 818-6317/? I/EnvImpl: [HWA_CAM3]getArCalorieMode mArCalorieMode 0
2020-03-15 18:27:32.245 818-6315/? I/YuvCalculate: mono_mode: 0, ae_stable: [1, 0], colorDis: 1, buf_cnt:1
2020-03-15 18:27:32.245 818-6317/? I/cie: FaceStoryAlgo::isCurFrameRun isCurFrameRun. Process mode 0.
2020-03-15 18:27:32.245 818-6311/? D/Misc____: [0b99617d_64D] onProcessFrame(666), afDistance(0.000000)
2020-03-15 18:27:32.245 818-1473/? I/AlgoEvent: [HWA_CAM3]yuv tracking rect[0 0 0 0] raw tracking rect[0 0 0 0]
2020-03-15 18:27:32.246 656-656/? I/mediacomm@2.1-service: getMdcClient:114: get client<Camera, 117, 818>, channel<4, 1>, perfLev=2, powerStatue=0.
2020-03-15 18:27:32.246 656-656/? I/mediacomm@2.1-service: getMdcVotePerfLev:179: Connected Mdc client<Camera, 117, 818> channel<4, 1> perfLev<2>
Когда я закомментирую строку, которая выпускает изображение, программа запускается, фон отображается правильно на экране, но трассировка стека возвращает:
2020-03-15 18:34:27.753 800-6919/? I/Camera3-Stream: getBuffer: Stream 1, 0xe9921300: Already dequeued max output buffers (7), wait for next returned one.
2020-03-15 18:34:27.754 6723-6818/com.google.ar.core.examples.c.helloar E/native: cpu_image_manager.cc:260 Failed to acquire new image, due to too many images acquired but not released.
2020-03-15 18:34:27.754 6723-6818/com.google.ar.core.examples.c.helloar E/native: status.cc:156 RESOURCE_EXHAUSTED:
ARCoreError: third_party/arcore/ar/core/cpu_image_manager.cc:262
[type.googleapis.com/util.ErrorSpacePayload='ArStatusErrorSpace::AR_ERROR_RESOURCE_EXHAUSTED']
Я ожидаю, что AR_ERROR_RESOURCE_EXHAUSTED появится, если ни одно из изображений не будет выпущено. Я просто не уверен, почему, когда я пытаюсь выпустить изображения, я получаю приложение для sh.