From ae3071e3baa390c9fe0d5d502380b1991399148e Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Wed, 2 Nov 2016 21:05:44 +0900 Subject: [PATCH] [v0.6.9] change state by defined mm funct instead of gst interface 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 --- packaging/libmm-player.spec | 2 +- src/mm_player_priv.c | 4 +--- src/mm_player_sound_focus.c | 15 +++++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 2c9ff87..a55d715 100644 --- a/packaging/libmm-player.spec +++ b/packaging/libmm-player.spec @@ -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 diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index aa57339..4586657 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -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: diff --git a/src/mm_player_sound_focus.c b/src/mm_player_sound_focus.c index 751883a..5d4b727 100644 --- a/src/mm_player_sound_focus.c +++ b/src/mm_player_sound_focus.c @@ -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; -- 2.7.4