[TENSORREPO] Fix hanging while waiting pulled signal when eos.
authorjijoong.moon <jijoong.moon@samsung.com>
Wed, 27 Mar 2019 09:54:04 +0000 (18:54 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Thu, 28 Mar 2019 02:21:09 +0000 (11:21 +0900)
There is hanging error when it is waiting pulled signal. In the case
of EOS(End of Stream), there is no pulling procedure but it is
required to get signal to get out the while loop.

**Self evaluation:**
1. Build test:   [X]Passed [ ]Failed [ ]Skipped
2. Run test:     [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
gst/nnstreamer/tensor_repo.c

index c1f895b..8815df3 100644 (file)
@@ -225,15 +225,15 @@ gst_tensor_repo_set_buffer (guint nth, guint o_nth, GstBuffer * buffer,
 
   GstTensorRepoData *data = gst_tensor_repo_get_repodata (nth);
 
+  while (data->buffer != NULL && !data->eos) {
+    GST_TENSOR_REPO_WAIT_PULL (nth);
+  }
+
   if (data->eos) {
     GST_TENSOR_REPO_UNLOCK (nth);
     return FALSE;
   }
 
-  while (data->buffer != NULL) {
-    GST_TENSOR_REPO_WAIT_PULL (nth);
-  }
-
   data->buffer = gst_buffer_copy (buffer);
 
   GstMetaRepo *meta = GST_META_REPO_ADD (data->buffer);
@@ -301,6 +301,7 @@ gst_tensor_repo_set_eos (guint nth)
   GstTensorRepoData *data = gst_tensor_repo_get_repodata (nth);
   data->eos = TRUE;
   GST_TENSOR_REPO_SIGNAL_PUSH (nth);
+  GST_TENSOR_REPO_SIGNAL_PULL (nth);
   GST_TENSOR_REPO_UNLOCK (nth);
   return data->eos;
 }