Add isStop flag not to handle memory in _vision_source_cb() but just to return the... 52/290252/2
authorTae-Young Chung <ty83.chung@samsung.com>
Wed, 22 Mar 2023 04:48:34 +0000 (13:48 +0900)
committerTae-Young Chung <ty83.chung@samsung.com>
Fri, 24 Mar 2023 00:38:21 +0000 (09:38 +0900)
[Version] 0.23.47
[Issue type] bug fix

After stopping by vision_source_stop_stream(), _vision_source_cb() is
invoked with buffers and then close the device.
In _vision_source_cb(), buffers, which aren't available, are handled and
processed to detect objects.
So, this commit is to return the callback after
vision_source_stop_stream().

Change-Id: I82b4c4f1a214ceec78ceb1bf8dd0aec56aed57db
Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
packaging/capi-media-vision.spec
test/testsuites/machine_learning/inference/odstream_test_suite.cpp

index cd8017276db1b16ee9904947756a8f1ff256491f..bc8d4b73c77844121fc177fb7334acc8ecdb4d0a 100644 (file)
@@ -1,6 +1,6 @@
 Name:        capi-media-vision
 Summary:     Media Vision library for Tizen Native API
-Version:     0.23.46
+Version:     0.23.47
 Release:     0
 Group:       Multimedia/Framework
 License:     Apache-2.0 and BSD-3-Clause
index b22ec852f42d9a7c0a98ee20f28c0de4b31e2639..6266c0c27e8d4c117ebef6a1694d0c18d545af1c 100644 (file)
@@ -75,6 +75,7 @@ typedef struct _appdata
        mv_source_h mvSource;
        mv_inference_h inferHandle;
        mv_engine_config_h engineConfig;
+       bool isStop;
        struct {
                std::string url;
                mv_source_h source;
@@ -137,8 +138,8 @@ static void _object_detected_cb(mv_source_h source, const int number_of_objects,
 static int _vision_source_cb(vision_source_buffer_s *buffer, void *user_data)
 {
        auto app = static_cast<appdata *>(user_data);
-       if (app->mvSource == nullptr || app->inferHandle == nullptr) {
-               std::cout << "mv_source or mv3d_handle is null" << std::endl;
+       if (app->mvSource == nullptr || app->inferHandle == nullptr || app->isStop) {
+               std::cout << "mv_source or mv3d_handle is null, or app stops" << std::endl;
                return 0;
        }
 
@@ -319,10 +320,12 @@ int main(int argc, char *argv[])
                goto _err;
        }
 
+       app.isStop = false;
        vision_source_start_stream(vsHandle, _vision_source_cb, &app);
        std::cout << "starting... " << std::endl;
        g_main_loop_run(loop);
        std::cout << "stop" << std::endl;
+       app.isStop = true;
 
        vision_source_stop_stream(vsHandle);