mv3d: create DfsAdaptor and call bind() when mDfsAdaptor is nullptr
authorTae-Young Chung <ty83.chung@samsung.com>
Tue, 6 Dec 2022 04:59:44 +0000 (13:59 +0900)
committerKwanghoon Son <k.son@samsung.com>
Wed, 14 Dec 2022 06:33:18 +0000 (15:33 +0900)
[Issue type] bug fix

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

index 288103c..39f5cf5 100644 (file)
@@ -118,15 +118,17 @@ int Mv3d::Configure(int mode, unsigned int width, unsigned int height, int minDi
        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;