[0.3.110] send disconnected error by error_cb 01/199501/2 accepted/tizen/unified/20190214.060537 submit/tizen/20190213.031645
authorEunhae Choi <eunhae1.choi@samsung.com>
Tue, 12 Feb 2019 07:41:10 +0000 (16:41 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Tue, 12 Feb 2019 07:41:58 +0000 (16:41 +0900)
- disconnected event does not have own user_cb
  but it is delivered by registered error_cb

Change-Id: I0b77b9f31ddf52a77dd901f823edefd39f0114b6

packaging/capi-media-player.spec
src/player.c

index 55d9b8d3c72cf2fe78533a048ab38512b0bc9e2c..e38c4524d7e3ccd8d0cfdceda632e86c1594012d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.109
+Version:    0.3.110
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 43a6f415e319e150b3862799b38eb7549024b244..5f3169face448705890c768ea8e62143a324e9d7 100644 (file)
@@ -1202,7 +1202,8 @@ gboolean _player_event_job_function(void *user_data)
        }
        g_mutex_unlock(&data->cb_info->event_queue.idle_ev_mutex);
 
-       if (data->cb_info->user_cb[ev])
+       if ((data->cb_info->user_cb[ev] || (ev == MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED)) &&
+               (_user_callbacks[ev]))
                _user_callbacks[ev](data->cb_info, data->recv_data);
        else
                LOGW("user callback is unset. type : %d", ev);
@@ -1262,7 +1263,7 @@ static void *_player_event_queue_loop(void *param)
                        event_data = (_player_cb_data *)g_queue_pop_head(ev->queue);
                        g_mutex_unlock(&ev->qlock);
                        if (event_data) {
-                               muse_player_event_e event_type = ((_player_cb_data *)event_data)->int_data;
+                               muse_player_event_e event_type = event_data->int_data;
 
                                if (event_type == MUSE_PLAYER_EVENT_TYPE_SEEK) {
                                        g_mutex_lock(&cb_info->seek_cb_mutex);
@@ -1275,21 +1276,21 @@ static void *_player_event_queue_loop(void *param)
                                        g_mutex_unlock(&cb_info->seek_cb_mutex);
                                }
 
-                               if (_player_need_sync_context(event_data->int_data)) {
-                                       if (cb_info->user_cb[event_data->int_data] &&
-                                               _user_callbacks[event_data->int_data]) {
+                               if (_player_need_sync_context(event_type)) {
+                                       if ((cb_info->user_cb[event_type] || (event_type == MUSE_PLAYER_EVENT_TYPE_SERVICE_DISCONNECTED)) &&
+                                               _user_callbacks[event_type]) {
                                                g_mutex_lock(&ev->idle_ev_mutex);
                                                ev->idle_ev_list = g_list_append(ev->idle_ev_list, (gpointer)event_data);
                                                g_mutex_unlock(&ev->idle_ev_mutex);
 
-                                               LOGD("add ev %d to main loop", event_data->int_data);
+                                               LOGD("add ev %d to main loop", event_type);
 
                                                g_idle_add_full(G_PRIORITY_DEFAULT,
                                                                                (GSourceFunc)_player_event_job_function,
                                                                                (gpointer)event_data,
                                                                                NULL);
                                        } else {
-                                               LOGW("there is no registered cb for ev:%d", event_data->int_data);
+                                               LOGW("there is no registered cb for ev:%d", event_type);
                                                if (event_data->recv_data) {
                                                        g_free(event_data->recv_data->buffer);
                                                        g_free(event_data->recv_data);