* The main function rendering a frame. In our case, it is yuv to RGBA8888 * converter */
| 153 | * converter |
| 154 | */ |
| 155 | void CameraEngine::DrawFrame(void) { |
| 156 | if (!cameraReady_ || !yuvReader_) return; |
| 157 | AImage* image = yuvReader_->GetNextImage(); |
| 158 | if (!image) { |
| 159 | return; |
| 160 | } |
| 161 | |
| 162 | ANativeWindow_acquire(app_->window); |
| 163 | ANativeWindow_Buffer buf; |
| 164 | if (ANativeWindow_lock(app_->window, &buf, nullptr) < 0) { |
| 165 | yuvReader_->DeleteImage(image); |
| 166 | return; |
| 167 | } |
| 168 | |
| 169 | yuvReader_->DisplayImage(&buf, image); |
| 170 | ANativeWindow_unlockAndPost(app_->window); |
| 171 | ANativeWindow_release(app_->window); |
| 172 | } |
no test coverage detected