MCPcopy Create free account
hub / github.com/android/ndk-samples / ~NDKCamera

Method ~NDKCamera

camera/basic/src/main/cpp/camera_manager.cpp:267–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267NDKCamera::~NDKCamera() {
268 valid_ = false;
269 // stop session if it is on:
270 if (captureSessionState_ == CaptureSessionState::ACTIVE) {
271 ACameraCaptureSession_stopRepeating(captureSession_);
272 }
273 ACameraCaptureSession_close(captureSession_);
274
275 for (auto& req : requests_) {
276 CALL_REQUEST(removeTarget(req.request_, req.target_));
277 ACaptureRequest_free(req.request_);
278 ACameraOutputTarget_free(req.target_);
279
280 CALL_CONTAINER(remove(outputContainer_, req.sessionOutput_));
281 ACaptureSessionOutput_free(req.sessionOutput_);
282
283 ANativeWindow_release(req.outputNativeWindow_);
284 }
285
286 requests_.resize(0);
287 ACaptureSessionOutputContainer_free(outputContainer_);
288
289 for (auto& cam : cameras_) {
290 if (cam.second.device_) {
291 CALL_DEV(close(cam.second.device_));
292 }
293 }
294 cameras_.clear();
295 if (cameraMgr_) {
296 CALL_MGR(unregisterAvailabilityCallback(cameraMgr_, GetManagerListener()));
297 ACameraManager_delete(cameraMgr_);
298 cameraMgr_ = nullptr;
299 }
300}
301
302/**
303 * EnumerateCamera()

Callers

nothing calls this directly

Calls 1

resizeMethod · 0.45

Tested by

no test coverage detected