diff options
author | Jeongmo Yang <jm80.yang@samsung.com> | 2024-01-02 20:31:27 +0900 |
---|---|---|
committer | Jeongmo Yang <jm80.yang@samsung.com> | 2024-01-02 20:31:27 +0900 |
commit | e549a7569adeabd52f7637d46dddc92dda86aa5f (patch) | |
tree | 56cc1d4f3e8065fb4b3c7da03035673a9ebcd9f6 | |
parent | 850aaed1b97562496e9b21ff9fa84251c38d5599 (diff) | |
download | camera-accepted/tizen_unified_riscv.tar.gz camera-accepted/tizen_unified_riscv.tar.bz2 camera-accepted/tizen_unified_riscv.zip |
Fix coverity issue - Data race conditionaccepted/tizen/unified/riscv/20240108.035925accepted/tizen/unified/20240105.165037accepted/tizen_unified_riscv
[Version] 0.4.118
[Issue Type] Coverity
Change-Id: I78d51b1e3b467c3e52799d36568a511a29960564
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r-- | packaging/capi-media-camera.spec | 2 | ||||
-rw-r--r-- | src/camera.c | 35 |
2 files changed, 20 insertions, 17 deletions
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index ac211a6..2c01ab2 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -1,6 +1,6 @@ Name: capi-media-camera Summary: A Camera API -Version: 0.4.117 +Version: 0.4.118 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera.c b/src/camera.c index 66861d1..ecd9e82 100644 --- a/src/camera.c +++ b/src/camera.c @@ -473,24 +473,43 @@ static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv * 2. EVAS display rendering * 3. media bridge is set */ + + g_mutex_lock(&cb_info->bridge_lock); + if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] || cb_info->is_evas_render || cb_info->bridge) { ret = __camera_create_media_packet_data(ret_fd, tfd, num_buffer_fd, bo, buffer_bo, data_bo, &mp_data); if (ret != CAMERA_ERROR_NONE) { + g_mutex_unlock(&cb_info->bridge_lock); CAM_LOG_ERROR("__camera_create_media_packet_data failed[0x%x]", ret); goto _PREVIEW_CB_HANDLER_DONE; } ret = __camera_create_media_packet(cb_info, stream, mp_data, &pkt); if (ret != CAMERA_ERROR_NONE) { + g_mutex_unlock(&cb_info->bridge_lock); CAM_LOG_ERROR("__camera_create_media_packet failed[0x%x]", ret); __camera_release_media_packet_data(mp_data, cb_info); mp_data = NULL; goto _PREVIEW_CB_HANDLER_DONE; } + +//LCOV_EXCL_START + /* 3. media bridge */ + if (cb_info->bridge) { + media_packet_ref(pkt); + ret = media_bridge_push_packet(cb_info->bridge, pkt); + if (ret != MEDIA_BRIDGE_ERROR_NONE) { + CAM_LOG_ERROR("push packet to bridge failed[0x%x]", ret); + media_packet_unref(pkt); + } + } +//LCOV_EXCL_STOP } + g_mutex_unlock(&cb_info->bridge_lock); + /* 1. media packet preview callback */ if (cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW]) { media_packet_ref(pkt); @@ -518,22 +537,6 @@ static void __camera_event_handler_preview(camera_cb_info_s *cb_info, char *recv } } -//LCOV_EXCL_START - /* 3. media bridge */ - g_mutex_lock(&cb_info->bridge_lock); - - if (cb_info->bridge) { - media_packet_ref(pkt); - ret = media_bridge_push_packet(cb_info->bridge, pkt); - if (ret != MEDIA_BRIDGE_ERROR_NONE) { - CAM_LOG_ERROR("push packet to bridge failed[0x%x]", ret); - media_packet_unref(pkt); - } - } -//LCOV_EXCL_STOP - - g_mutex_unlock(&cb_info->bridge_lock); - _PREVIEW_CB_HANDLER_DONE: /* send PREVIEW_CB_RETURN message if zero copy buffer is used(num_buffer_fd is bigger than 0) and preview callback(normal or media packet) is set. */ |