Add restriction about setting MEDIA_STREAMER_PARAM_DISPLAY 61/237561/5
authorHyunil <hyunil46.park@samsung.com>
Wed, 1 Jul 2020 07:26:20 +0000 (16:26 +0900)
committerHyunil <hyunil46.park@samsung.com>
Thu, 2 Jul 2020 00:21:51 +0000 (09:21 +0900)
- MEDIA_STREAMER_PARAM_DISPLAY should be set in main thread.
  Otherwise, it will return MEDIA_STREAMER_ERROR_INVALID_OPERATION by internal restriction.
  To avoid MEDIA_STREAMER_ERROR_INVALID_OPERATION in sub thread, ecore_thread_main_loop_begin() and
  ecore_thread_main_loop_end() can be used, but deadlock can be also occurred if main thread is busy.

[Version] 0.1.79
[Issue Type] Improvement

Change-Id: Ie7290e99d6e051b363760421b18b4702b39acee0
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
include/media_streamer.h
packaging/capi-media-streamer.spec
test/media_streamer_test.c

index 4c4dc9e652be340b1fa73884d603b85618af2ca7..efd9ddadef82c611d45456d592545e6d324170e1 100644 (file)
@@ -386,7 +386,13 @@ typedef enum {
  * @details It is a object to draw video frame on.
  *          Data type is pointer.
  * @since_tizen 3.0
+ * @remarks This parameter must be set in main thread of application.
+ *          Otherwise, media_streamer_node_set_param() will return #MEDIA_STREAMER_ERROR_INVALID_OPERATION by internal restriction.
+ *          To avoid #MEDIA_STREAMER_ERROR_INVALID_OPERATION in sub thread, ecore_thread_main_loop_begin() and
+ *          ecore_thread_main_loop_end() can be used, but deadlock can be also occurred if main thread is busy.
  * @see media_streamer_node_get_params()
+ * @see ecore_thread_main_loop_begin()
+ * @see ecore_thread_main_loop_end()
  */
 #define MEDIA_STREAMER_PARAM_DISPLAY "display"
 
index 99f1017c5b3decf20f8b41a38b7080bb5d581912..906654d15a1746bbdbefe7e96b2af70a036e6618 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-streamer
 Summary:    A Media Streamer API
-Version:    0.1.78
+Version:    0.1.79
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 155bee8a6839422215a11f346658b8082ad70e59..e461bfdc05ef5b57159d32567472ff5a0246e0c1 100644 (file)
@@ -252,9 +252,19 @@ static void webrtc_decoded_ready_cb(media_streamer_node_h node, const char *src_
                APPEND_NODE(video_converter);
 
                media_streamer_node_create_sink(MEDIA_STREAMER_NODE_SINK_TYPE_OVERLAY, &video_sink);
-               media_streamer_node_add(current_media_streamer, video_sink);
+
+               /*
+               * MEDIA_STREAMER_PARAM_DISPLAY should be set in main thread of application.
+               * Otherwise, it will return MEDIA_STREAMER_ERROR_INVALID_OPERATION by internal restriction.
+               * To avoid MEDIA_STREAMER_ERROR_INVALID_OPERATION in sub thread, ecore_thread_main_loop_begin() and
+               * ecore_thread_main_loop_end() can be used, but deadlock can be also occurred if main thread is busy.
+               */
+               ecore_thread_main_loop_begin();
                media_streamer_node_set_param(video_sink, MEDIA_STREAMER_PARAM_DISPLAY, (void*)ad.win);
+               ecore_thread_main_loop_end();
+
                media_streamer_node_set_param(video_sink, MEDIA_STREAMER_PARAM_DISPLAY_GEOMETRY_METHOD, "1");
+               media_streamer_node_add(current_media_streamer, video_sink);
                APPEND_NODE(video_sink);
 
                media_streamer_node_link(node , src_pad_name, video_converter, "sink");