1e41f4b71Sopenharmony_ci# Sample of Secondary Processing of Recording Streams (C/C++)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## Development Process
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciAfter obtaining the output stream capabilities supported by the camera, create a video stream. The development process is as follows:
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci![Recording Development Process](figures/recording-ndk-imageReceiver-development-process.png)
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## Sample Code
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci1. Link the dynamic library in the CMake script.
12e41f4b71Sopenharmony_ci    ```txt
13e41f4b71Sopenharmony_ci        target_link_libraries(entry PUBLIC libohcamera.so libhilog_ndk.z.so)
14e41f4b71Sopenharmony_ci    ```
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci2. Import the NDK APIs on the C++ side, and perform recording based on the surface ID passed in.
17e41f4b71Sopenharmony_ci    ```c++
18e41f4b71Sopenharmony_ci    #include "hilog/log.h"
19e41f4b71Sopenharmony_ci    #include "ohcamera/camera.h"
20e41f4b71Sopenharmony_ci    #include "ohcamera/camera_input.h"
21e41f4b71Sopenharmony_ci    #include "ohcamera/capture_session.h"
22e41f4b71Sopenharmony_ci    #include "ohcamera/photo_output.h"
23e41f4b71Sopenharmony_ci    #include "ohcamera/preview_output.h"
24e41f4b71Sopenharmony_ci    #include "ohcamera/video_output.h"
25e41f4b71Sopenharmony_ci    #include "ohcamera/camera_manager.h"
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci    void OnCameraInputError(const Camera_Input* cameraInput, Camera_ErrorCode errorCode)
28e41f4b71Sopenharmony_ci    {
29e41f4b71Sopenharmony_ci        OH_LOG_INFO(LOG_APP, "OnCameraInput errorCode = %{public}d", errorCode);
30e41f4b71Sopenharmony_ci    }
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci    CameraInput_Callbacks* GetCameraInputListener(void)
33e41f4b71Sopenharmony_ci    {
34e41f4b71Sopenharmony_ci        static CameraInput_Callbacks cameraInputCallbacks = {
35e41f4b71Sopenharmony_ci            .onError = OnCameraInputError
36e41f4b71Sopenharmony_ci        };
37e41f4b71Sopenharmony_ci        return &cameraInputCallbacks;
38e41f4b71Sopenharmony_ci    }
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci    void CaptureSessionOnFocusStateChange(Camera_CaptureSession* session, Camera_FocusState focusState)
41e41f4b71Sopenharmony_ci    {
42e41f4b71Sopenharmony_ci        OH_LOG_INFO(LOG_APP, "CaptureSessionOnFocusStateChange");
43e41f4b71Sopenharmony_ci    }
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci    void CaptureSessionOnError(Camera_CaptureSession* session, Camera_ErrorCode errorCode)
46e41f4b71Sopenharmony_ci    {
47e41f4b71Sopenharmony_ci        OH_LOG_INFO(LOG_APP, "CaptureSessionOnError = %{public}d", errorCode);
48e41f4b71Sopenharmony_ci    }
49e41f4b71Sopenharmony_ci
50e41f4b71Sopenharmony_ci    CaptureSession_Callbacks* GetCaptureSessionRegister(void)
51e41f4b71Sopenharmony_ci    {
52e41f4b71Sopenharmony_ci        static CaptureSession_Callbacks captureSessionCallbacks = {
53e41f4b71Sopenharmony_ci            .onFocusStateChange = CaptureSessionOnFocusStateChange,
54e41f4b71Sopenharmony_ci            .onError = CaptureSessionOnError
55e41f4b71Sopenharmony_ci        };
56e41f4b71Sopenharmony_ci        return &captureSessionCallbacks;
57e41f4b71Sopenharmony_ci    }
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci    void VideoOutputOnFrameStart(Camera_VideoOutput* videoOutput)
60e41f4b71Sopenharmony_ci    {
61e41f4b71Sopenharmony_ci        OH_LOG_INFO(LOG_APP, "VideoOutputOnFrameStart");
62e41f4b71Sopenharmony_ci    }
63e41f4b71Sopenharmony_ci
64e41f4b71Sopenharmony_ci    void VideoOutputOnFrameEnd(Camera_VideoOutput* videoOutput, int32_t frameCount)
65e41f4b71Sopenharmony_ci    {
66e41f4b71Sopenharmony_ci        OH_LOG_INFO(LOG_APP, "VideoOutput frameCount = %{public}d", frameCount);
67e41f4b71Sopenharmony_ci    }
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ci    void VideoOutputOnError(Camera_VideoOutput* videoOutput, Camera_ErrorCode errorCode)
70e41f4b71Sopenharmony_ci    {
71e41f4b71Sopenharmony_ci        OH_LOG_INFO(LOG_APP, "VideoOutput errorCode = %{public}d", errorCode);
72e41f4b71Sopenharmony_ci    }
73e41f4b71Sopenharmony_ci
74e41f4b71Sopenharmony_ci    VideoOutput_Callbacks* GetVideoOutputListener(void)
75e41f4b71Sopenharmony_ci    {
76e41f4b71Sopenharmony_ci        static VideoOutput_Callbacks videoOutputListener = {
77e41f4b71Sopenharmony_ci            .onFrameStart = VideoOutputOnFrameStart,
78e41f4b71Sopenharmony_ci            .onFrameEnd = VideoOutputOnFrameEnd,
79e41f4b71Sopenharmony_ci            .onError = VideoOutputOnError
80e41f4b71Sopenharmony_ci        };
81e41f4b71Sopenharmony_ci        return &videoOutputListener;
82e41f4b71Sopenharmony_ci    }
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ci    void CameraManagerStatusCallback(Camera_Manager* cameraManager, Camera_StatusInfo* status)
85e41f4b71Sopenharmony_ci    {
86e41f4b71Sopenharmony_ci        OH_LOG_INFO(LOG_APP, "CameraManagerStatusCallback is called");
87e41f4b71Sopenharmony_ci    }
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_ci    CameraManager_Callbacks* GetCameraManagerListener()
90e41f4b71Sopenharmony_ci    {
91e41f4b71Sopenharmony_ci        static CameraManager_Callbacks cameraManagerListener = {
92e41f4b71Sopenharmony_ci            .onCameraStatus = CameraManagerStatusCallback
93e41f4b71Sopenharmony_ci        };
94e41f4b71Sopenharmony_ci        return &cameraManagerListener;
95e41f4b71Sopenharmony_ci    }
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ci    NDKCamera::NDKCamera(char *previewId, char *videoId)
98e41f4b71Sopenharmony_ci    {
99e41f4b71Sopenharmony_ci        Camera_Manager* cameraManager = nullptr;
100e41f4b71Sopenharmony_ci        Camera_Device* cameras = nullptr;
101e41f4b71Sopenharmony_ci        Camera_CaptureSession* captureSession = nullptr;
102e41f4b71Sopenharmony_ci        Camera_OutputCapability* cameraOutputCapability = nullptr;
103e41f4b71Sopenharmony_ci        Camera_VideoOutput* videoOutput = nullptr;
104e41f4b71Sopenharmony_ci        const Camera_Profile* previewProfile = nullptr;
105e41f4b71Sopenharmony_ci        const Camera_Profile* photoProfile = nullptr;
106e41f4b71Sopenharmony_ci        const Camera_VideoProfile* videoProfile = nullptr;
107e41f4b71Sopenharmony_ci        Camera_PreviewOutput* previewOutput = nullptr;
108e41f4b71Sopenharmony_ci        Camera_PhotoOutput* photoOutput = nullptr;
109e41f4b71Sopenharmony_ci        Camera_Input* cameraInput = nullptr;
110e41f4b71Sopenharmony_ci        uint32_t size = 0;
111e41f4b71Sopenharmony_ci        uint32_t cameraDeviceIndex = 0;
112e41f4b71Sopenharmony_ci        char* videoSurfaceId = videoId;
113e41f4b71Sopenharmony_ci        char* previewSurfaceId = previewId;
114e41f4b71Sopenharmony_ci        // Create a CameraManager object.
115e41f4b71Sopenharmony_ci        Camera_ErrorCode ret = OH_Camera_GetCameraManager(&cameraManager);
116e41f4b71Sopenharmony_ci        if (cameraManager == nullptr || ret != CAMERA_OK) {
117e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_Camera_GetCameraMananger failed.");
118e41f4b71Sopenharmony_ci        }
119e41f4b71Sopenharmony_ci        // Listen for camera status changes.
120e41f4b71Sopenharmony_ci        ret = OH_CameraManager_RegisterCallback(cameraManager, GetCameraManagerListener());
121e41f4b71Sopenharmony_ci        if (ret != CAMERA_OK) {
122e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CameraManager_RegisterCallback failed.");
123e41f4b71Sopenharmony_ci        }
124e41f4b71Sopenharmony_ci
125e41f4b71Sopenharmony_ci        // Obtain the camera list.
126e41f4b71Sopenharmony_ci        ret = OH_CameraManager_GetSupportedCameras(cameraManager, &cameras, &size);
127e41f4b71Sopenharmony_ci        if (cameras == nullptr || size < 0 || ret != CAMERA_OK) {
128e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CameraManager_GetSupportedCameras failed.");
129e41f4b71Sopenharmony_ci        }
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ci        for (int index = 0; index < size; index++) {
132e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "cameraId  =  %{public}s ", cameras[index].cameraId);              // Obtain the camera ID.
133e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "cameraPosition  =  %{public}d ", cameras[index].cameraPosition);  // Obtain the camera position.
134e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "cameraType  =  %{public}d ", cameras[index].cameraType);          // Obtain the camera type.
135e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "connectionType  =  %{public}d ", cameras[index].connectionType);  // Obtain the camera connection type.
136e41f4b71Sopenharmony_ci        }
137e41f4b71Sopenharmony_ci
138e41f4b71Sopenharmony_ci        // Obtain the output streams supported by the camera.
139e41f4b71Sopenharmony_ci        ret = OH_CameraManager_GetSupportedCameraOutputCapability(cameraManager, &cameras[cameraDeviceIndex],
140e41f4b71Sopenharmony_ci                                                                &cameraOutputCapability);
141e41f4b71Sopenharmony_ci        if (cameraOutputCapability == nullptr || ret != CAMERA_OK) {
142e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CameraManager_GetSupportedCameraOutputCapability failed.");
143e41f4b71Sopenharmony_ci        }
144e41f4b71Sopenharmony_ci
145e41f4b71Sopenharmony_ci        if (cameraOutputCapability->previewProfilesSize < 0) {
146e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "previewProfilesSize == null");
147e41f4b71Sopenharmony_ci        }
148e41f4b71Sopenharmony_ci        previewProfile = cameraOutputCapability->previewProfiles[0];
149e41f4b71Sopenharmony_ci
150e41f4b71Sopenharmony_ci        if (cameraOutputCapability->photoProfilesSize < 0) {
151e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "photoProfilesSize == null");
152e41f4b71Sopenharmony_ci        }
153e41f4b71Sopenharmony_ci        photoProfile = cameraOutputCapability->photoProfiles[0];
154e41f4b71Sopenharmony_ci
155e41f4b71Sopenharmony_ci        if (cameraOutputCapability->videoProfilesSize < 0) {
156e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "videorofilesSize == null");
157e41f4b71Sopenharmony_ci        }
158e41f4b71Sopenharmony_ci        videoProfile = cameraOutputCapability->videoProfiles[0];
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ci        // Call getVideoSurfaceID() on the TS side.
161e41f4b71Sopenharmony_ci
162e41f4b71Sopenharmony_ci        // Create a VideoOutput instance.
163e41f4b71Sopenharmony_ci        ret = OH_CameraManager_CreateVideoOutput(cameraManager, videoProfile, videoSurfaceId, &videoOutput);
164e41f4b71Sopenharmony_ci        if (videoProfile == nullptr || videoOutput == nullptr || ret != CAMERA_OK) {
165e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CameraManager_CreateVideoOutput failed.");
166e41f4b71Sopenharmony_ci        }
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ci        // Listen for video output errors.
169e41f4b71Sopenharmony_ci        ret = OH_VideoOutput_RegisterCallback(videoOutput, GetVideoOutputListener());
170e41f4b71Sopenharmony_ci        if (ret != CAMERA_OK) {
171e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_VideoOutput_RegisterCallback failed.");
172e41f4b71Sopenharmony_ci        }
173e41f4b71Sopenharmony_ci
174e41f4b71Sopenharmony_ci        // Create a session.
175e41f4b71Sopenharmony_ci        ret = OH_CameraManager_CreateCaptureSession(cameraManager, &captureSession);
176e41f4b71Sopenharmony_ci        if (captureSession == nullptr || ret != CAMERA_OK) {
177e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CameraManager_CreateCaptureSession failed.");
178e41f4b71Sopenharmony_ci        }
179e41f4b71Sopenharmony_ci        // Listen for session errors.
180e41f4b71Sopenharmony_ci        ret = OH_CaptureSession_RegisterCallback(captureSession, GetCaptureSessionRegister());
181e41f4b71Sopenharmony_ci        if (ret != CAMERA_OK) {
182e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_RegisterCallback failed.");
183e41f4b71Sopenharmony_ci        }
184e41f4b71Sopenharmony_ci
185e41f4b71Sopenharmony_ci        // Start configuration for the session.
186e41f4b71Sopenharmony_ci        ret = OH_CaptureSession_BeginConfig(captureSession);
187e41f4b71Sopenharmony_ci        if (ret != CAMERA_OK) {
188e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_BeginConfig failed.");
189e41f4b71Sopenharmony_ci        }
190e41f4b71Sopenharmony_ci
191e41f4b71Sopenharmony_ci        // Create a camera input stream.
192e41f4b71Sopenharmony_ci        ret = OH_CameraManager_CreateCameraInput(cameraManager, &cameras[cameraDeviceIndex], &cameraInput);
193e41f4b71Sopenharmony_ci        if (cameraInput == nullptr || ret != CAMERA_OK) {
194e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CameraManager_CreateCameraInput failed.");
195e41f4b71Sopenharmony_ci        }
196e41f4b71Sopenharmony_ci
197e41f4b71Sopenharmony_ci        // Listen for camera input errors.
198e41f4b71Sopenharmony_ci        ret = OH_CameraInput_RegisterCallback(cameraInput, GetCameraInputListener());
199e41f4b71Sopenharmony_ci        if (ret != CAMERA_OK) {
200e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CameraInput_RegisterCallback failed.");
201e41f4b71Sopenharmony_ci        }
202e41f4b71Sopenharmony_ci
203e41f4b71Sopenharmony_ci        // Open the camera.
204e41f4b71Sopenharmony_ci        ret = OH_CameraInput_Open(cameraInput);
205e41f4b71Sopenharmony_ci        if (ret != CAMERA_OK) {
206e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CameraInput_Open failed.");
207e41f4b71Sopenharmony_ci        }
208e41f4b71Sopenharmony_ci
209e41f4b71Sopenharmony_ci        // Add the camera input stream to the session.
210e41f4b71Sopenharmony_ci        ret = OH_CaptureSession_AddInput(captureSession, cameraInput);
211e41f4b71Sopenharmony_ci        if (ret != CAMERA_OK) {
212e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_AddInput failed.");
213e41f4b71Sopenharmony_ci        }
214e41f4b71Sopenharmony_ci
215e41f4b71Sopenharmony_ci        // Create a preview output stream. For details about the surfaceId parameter, see the <XComponent>. The preview stream is the surface provided by the <XComponent>.
216e41f4b71Sopenharmony_ci        ret = OH_CameraManager_CreatePreviewOutput(cameraManager, previewProfile, previewSurfaceId, &previewOutput);
217e41f4b71Sopenharmony_ci        if (previewProfile == nullptr || previewOutput == nullptr || ret != CAMERA_OK) {
218e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CameraManager_CreatePreviewOutput failed.");
219e41f4b71Sopenharmony_ci        }
220e41f4b71Sopenharmony_ci
221e41f4b71Sopenharmony_ci        // Add the preview output stream to the session.
222e41f4b71Sopenharmony_ci        ret = OH_CaptureSession_AddPreviewOutput(captureSession, previewOutput);
223e41f4b71Sopenharmony_ci        if (ret != CAMERA_OK) {
224e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_AddPreviewOutput failed.");
225e41f4b71Sopenharmony_ci        }
226e41f4b71Sopenharmony_ci
227e41f4b71Sopenharmony_ci        // Add the video output stream to the session.
228e41f4b71Sopenharmony_ci        ret = OH_CaptureSession_AddVideoOutput(captureSession, videoOutput);
229e41f4b71Sopenharmony_ci        if (ret != CAMERA_OK) {
230e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_AddVideoOutput failed.");
231e41f4b71Sopenharmony_ci        }
232e41f4b71Sopenharmony_ci
233e41f4b71Sopenharmony_ci        // Commit the session configuration.
234e41f4b71Sopenharmony_ci        ret = OH_CaptureSession_CommitConfig(captureSession);
235e41f4b71Sopenharmony_ci        if (ret != CAMERA_OK) {
236e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_CommitConfig failed.");
237e41f4b71Sopenharmony_ci        }
238e41f4b71Sopenharmony_ci
239e41f4b71Sopenharmony_ci        // Start the session.
240e41f4b71Sopenharmony_ci        ret = OH_CaptureSession_Start(captureSession);
241e41f4b71Sopenharmony_ci        if (ret != CAMERA_OK) {
242e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_Start failed.");
243e41f4b71Sopenharmony_ci        }
244e41f4b71Sopenharmony_ci
245e41f4b71Sopenharmony_ci        // Start the video output stream.
246e41f4b71Sopenharmony_ci        ret = OH_VideoOutput_Start(videoOutput);
247e41f4b71Sopenharmony_ci        if (ret != CAMERA_OK) {
248e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_VideoOutput_Start failed.");
249e41f4b71Sopenharmony_ci        }
250e41f4b71Sopenharmony_ci
251e41f4b71Sopenharmony_ci        // Stop the video output stream.
252e41f4b71Sopenharmony_ci        ret = OH_VideoOutput_Stop(videoOutput);
253e41f4b71Sopenharmony_ci        if (ret != CAMERA_OK) {
254e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_VideoOutput_Stop failed.");
255e41f4b71Sopenharmony_ci        }
256e41f4b71Sopenharmony_ci
257e41f4b71Sopenharmony_ci        // Stop the session.
258e41f4b71Sopenharmony_ci        ret = OH_CaptureSession_Stop(captureSession);
259e41f4b71Sopenharmony_ci        if (ret == CAMERA_OK) {
260e41f4b71Sopenharmony_ci        OH_LOG_INFO(LOG_APP, "OH_CaptureSession_Stop success ");
261e41f4b71Sopenharmony_ci        } else {
262e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_Stop failed. %d ", ret);
263e41f4b71Sopenharmony_ci        }
264e41f4b71Sopenharmony_ci
265e41f4b71Sopenharmony_ci        // Release the camera input stream.
266e41f4b71Sopenharmony_ci        ret = OH_CameraInput_Close(cameraInput);
267e41f4b71Sopenharmony_ci        if (ret == CAMERA_OK) {
268e41f4b71Sopenharmony_ci        OH_LOG_INFO(LOG_APP, "OH_CameraInput_Close success ");
269e41f4b71Sopenharmony_ci        } else {
270e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CameraInput_Close failed. %d ", ret);
271e41f4b71Sopenharmony_ci        }
272e41f4b71Sopenharmony_ci
273e41f4b71Sopenharmony_ci        // Release the preview output stream.
274e41f4b71Sopenharmony_ci        ret = OH_PreviewOutput_Release(previewOutput);
275e41f4b71Sopenharmony_ci        if (ret == CAMERA_OK) {
276e41f4b71Sopenharmony_ci        OH_LOG_INFO(LOG_APP, "OH_PreviewOutput_Release success ");
277e41f4b71Sopenharmony_ci        } else {
278e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_PreviewOutput_Release failed. %d ", ret);
279e41f4b71Sopenharmony_ci        }
280e41f4b71Sopenharmony_ci
281e41f4b71Sopenharmony_ci        // Release the video output stream.
282e41f4b71Sopenharmony_ci        ret = OH_VideoOutput_Release(videoOutput);
283e41f4b71Sopenharmony_ci        if (ret == CAMERA_OK) {
284e41f4b71Sopenharmony_ci        OH_LOG_INFO(LOG_APP, "OH_VideoOutput_Release success ");
285e41f4b71Sopenharmony_ci        } else {
286e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_VideoOutput_Release failed. %d ", ret);
287e41f4b71Sopenharmony_ci        }
288e41f4b71Sopenharmony_ci
289e41f4b71Sopenharmony_ci        // Release the session.
290e41f4b71Sopenharmony_ci        ret = OH_CaptureSession_Release(captureSession);
291e41f4b71Sopenharmony_ci        if (ret == CAMERA_OK) {
292e41f4b71Sopenharmony_ci        OH_LOG_INFO(LOG_APP, "OH_CaptureSession_Release success ");
293e41f4b71Sopenharmony_ci        } else {
294e41f4b71Sopenharmony_ci        OH_LOG_ERROR(LOG_APP, "OH_CaptureSession_Release failed. %d ", ret);
295e41f4b71Sopenharmony_ci        }
296e41f4b71Sopenharmony_ci    }
297e41f4b71Sopenharmony_ci    ```
298