[0.2.89] update player state with the interrupt msg 28/191728/2
authorEunhae Choi <eunhae1.choi@samsung.com>
Tue, 23 Oct 2018 03:58:05 +0000 (12:58 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Tue, 23 Oct 2018 04:40:17 +0000 (13:40 +0900)
- mm player resource is released internally,
  so the player state have to be updated.

Change-Id: Ica4ee6d9a2fc7866fd40fb2f97d594bb7bc2f4d6

legacy/src/legacy_player.c
packaging/mmsvc-player.spec

index 1cabbc788e9a2a9b5723fe1f6850abd061954c31..080a30eda879c01c0d35d13f0045f5000e3a46d1 100644 (file)
@@ -397,6 +397,14 @@ static void __message_cb_loop(void *data)
        return;
 }
 
+static player_state_e __convert_player_state(MMPlayerStateType state)
+{
+       if (state == MM_PLAYER_STATE_NONE)
+               return PLAYER_STATE_NONE;
+       else
+               return state +1;
+}
+
 static int __msg_callback(int message, void *param, void *user_data)
 {
        player_s *handle = (player_s *)user_data;
@@ -452,8 +460,14 @@ static int __msg_callback(int message, void *param, void *user_data)
                        ((player_buffering_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_BUFFERING])(msg->connection.buffering, handle->user_data[MUSE_PLAYER_EVENT_TYPE_BUFFERING]);
                break;
        case MM_MESSAGE_STATE_INTERRUPTED:      /* 0x04 */
-               if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_INTERRUPT])
+               if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_INTERRUPT]) {
+                       if (msg->union_type == MM_MSG_UNION_STATE) {
+                               LOGW("received mm state msg prev:%d, curr:%d", msg->state.previous, msg->state.current);
+                               handle->state = __convert_player_state(msg->state.current);
+                               LOGW("player state is changed to %d by resource conflict", handle->state);
+                       }
                        ((player_interrupted_cb)handle->user_cb[MUSE_PLAYER_EVENT_TYPE_INTERRUPT])(handle->user_data[MUSE_PLAYER_EVENT_TYPE_INTERRUPT]);
+               }
                break;
        case MM_MESSAGE_CONNECTION_TIMEOUT:     /* 0x102 */
                LOGI("[%s] PLAYER_ERROR_CONNECTION_FAILED (0x%08x) : CONNECTION_TIMEOUT", __FUNCTION__, PLAYER_ERROR_CONNECTION_FAILED);
index 97f78cf872f02b4fb4808ee2b1c82b9ae5cbda60..32780021719cde846961407388c5e3aa58e8ef2b 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-player
 Summary:    A Media Player module for muse server
-Version:    0.2.88
+Version:    0.2.89
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0