mv3d: create DfsAdaptor and call bind() when mDfsAdaptor is nullptr 95/285095/1
authorTae-Young Chung <ty83.chung@samsung.com>
Tue, 6 Dec 2022 05:05:15 +0000 (14:05 +0900)
committerTae-Young Chung <ty83.chung@samsung.com>
Tue, 6 Dec 2022 05:05:55 +0000 (14:05 +0900)
[Issue type] bug fix

This commit is manually patched from https://review.tizen.org/gerrit/#/c/platform/core/api/mediavision/+/285093/
to avoid conflict.

Change-Id: Icca5dfce80771641a7d0fce8e7b317247a8d1db7
Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
mv_3d/3d/src/Mv3d.cpp

index e98eee0..bbc8f41 100644 (file)
@@ -124,15 +124,17 @@ namespace mv3d
                mIntrinsicPath = stereoConfigPath.substr(0, found) + std::string(".json");
                mPointcloudOutputPath = pointcloudOutputPath;
 
-               try {
-                       mDfsAdaptor = new DfsAdaptor();
-                       mDfsAdaptor->bind();
-               } catch (const std::bad_alloc &e) {
-                       LOGE("Failed to create dfs adaptation : %s", e.what());
-                       return MEDIA_VISION_ERROR_OUT_OF_MEMORY;
-               } catch (const std::runtime_error &e) {
-                       LOGE("Failed to bind %s adpator", e.what());
-                       return MEDIA_VISION_ERROR_INVALID_OPERATION;
+               if (!mDfsAdaptor) {
+                       try {
+                               mDfsAdaptor = new DfsAdaptor();
+                               mDfsAdaptor->bind();
+                       } catch (const std::bad_alloc &e) {
+                               LOGE("Failed to create dfs adaptation : %s", e.what());
+                               return MEDIA_VISION_ERROR_OUT_OF_MEMORY;
+                       } catch (const std::runtime_error &e) {
+                               LOGE("Failed to bind %s adpator", e.what());
+                               return MEDIA_VISION_ERROR_INVALID_OPERATION;
+                       }
                }
 
                return MEDIA_VISION_ERROR_NONE;