[v0.6.9] change state by defined mm funct instead of gst interface 20/95220/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Wed, 2 Nov 2016 12:05:44 +0000 (21:05 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Wed, 2 Nov 2016 12:05:47 +0000 (21:05 +0900)
mm state can not be updated by direct state change
in this case, after pause, there is no way to resume

Change-Id: Ifb27df230979dd5234874f8e570d5f26d29b924a
Signed-off-by: Eunhae Choi <eunhae1.choi@samsung.com>
packaging/libmm-player.spec
src/mm_player_priv.c
src/mm_player_sound_focus.c

index 2c9ff87..a55d715 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-player
 Summary:    Multimedia Framework Player Library
-Version:    0.6.8
+Version:    0.6.9
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index aa57339..4586657 100644 (file)
@@ -8375,7 +8375,6 @@ __mmplayer_sound_focus_callback(int id, mm_sound_focus_type_e focus_type, mm_sou
 {
        mm_player_t* player = (mm_player_t*) user_data;
        int result = MM_ERROR_NONE;
-       gboolean lazy_pause = FALSE;
        MMPlayerFocusChangedMsg msg = MM_PLAYER_FOCUS_CHANGED_BY_UNKNOWN;
 
        LOGW("get focus notified");
@@ -8445,8 +8444,7 @@ __mmplayer_sound_focus_callback(int id, mm_sound_focus_type_e focus_type, mm_sou
                LOGW("unknown focus state %d", focus_state);
 
 DONE:
-       if (!lazy_pause)
-               player->sound_focus.by_asm_cb = FALSE;
+       player->sound_focus.by_asm_cb = FALSE;
        player->sound_focus.cb_pending = FALSE;
 
 EXIT:
index 751883a..5d4b727 100644 (file)
@@ -87,7 +87,6 @@ __mmplayer_sound_device_connected_cb_func(MMSoundDevice_t device_h, bool is_conn
 
        mm_sound_device_type_e device_type;
        int ret;
-       MMMessageParamType msg = {0, };
 
        LOGW("device_connected_cb is called, device_h[0x%x], is_connected[%d]\n", device_h, is_connected);
 
@@ -102,15 +101,19 @@ __mmplayer_sound_device_connected_cb_func(MMSoundDevice_t device_h, bool is_conn
                case MM_SOUND_DEVICE_TYPE_HDMI:
                case MM_SOUND_DEVICE_TYPE_USB_AUDIO:
                {
-                       ret = gst_element_set_state(player->pipeline->mainbin[MMPLAYER_M_PIPE].gst, GST_STATE_PAUSED);
-                       if (ret != GST_STATE_CHANGE_SUCCESS) {
+                       int result = MM_ERROR_NONE;
+                       LOGW("pause immediately");
+
+                       player->sound_focus.by_asm_cb = TRUE;
+                       player->sound_focus.focus_changed_msg = MM_PLAYER_FOCUS_CHANGED_BY_EARJACK_UNPLUG;
+
+                       result = _mmplayer_pause((MMHandleType)player);
+                       if (result != MM_ERROR_NONE) {
                                LOGE("focus_id [%d], watch_id [%d], connected_id [%d], change_state result[%d]",
                                        player->sound_focus.focus_id, player->sound_focus.watch_id,
                                        player->sound_focus.connected_id, ret);
                        }
-                       msg.union_type = MM_MSG_UNION_CODE;
-                       msg.code = MM_PLAYER_FOCUS_CHANGED_BY_EARJACK_UNPLUG;
-                       MMPLAYER_POST_MSG(player, MM_MESSAGE_STATE_INTERRUPTED, &msg);
+                       player->sound_focus.by_asm_cb = FALSE;
                }
                break;