diff options
author | Gilbok Lee <gilbok.lee@samsung.com> | 2017-08-29 14:57:32 +0900 |
---|---|---|
committer | Gilbok Lee <gilbok.lee@samsung.com> | 2017-08-29 19:43:25 +0900 |
commit | 0cbc81b06fb7511a457277c481873011e301fa2c (patch) | |
tree | 4bbcdd7b7cf4287d37460a9e49ecc1abf9b055b3 | |
parent | 3b0091e7b3c835fd0656c5e274232758927acb48 (diff) | |
download | libmm-player-0cbc81b06fb7511a457277c481873011e301fa2c.tar.gz libmm-player-0cbc81b06fb7511a457277c481873011e301fa2c.tar.bz2 libmm-player-0cbc81b06fb7511a457277c481873011e301fa2c.zip |
[0.6.59] Add Check resume option in sound_focus callback.submit/tizen_3.0/20170831.061703
player resume even if the MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED option is not set.
Change-Id: I8ae4a3ffea20e8d5467b5a9aa5d3d436add231d6
-rw-r--r-- | packaging/libmm-player.spec | 2 | ||||
-rw-r--r-- | src/mm_player_priv.c | 26 | ||||
-rw-r--r-- | src/mm_player_sound_focus.c | 13 |
3 files changed, 29 insertions, 12 deletions
diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index b88cefa..7e78bc0 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.58 +Version: 0.6.59 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index d00d5f4..a0678cc 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -8189,10 +8189,9 @@ void __mmplayer_sound_focus_watch_callback(int id, mm_sound_focus_type_e focus_t if (MM_ERROR_NONE == __mmplayer_convert_sound_focus_state(FALSE, reason_for_change, &msg)) player->sound_focus.focus_changed_msg = (int)msg; - if (strstr(reason_for_change, "call") || - strstr(reason_for_change, "voip") || /* FIXME: to check */ - strstr(reason_for_change, "alarm") || - strstr(reason_for_change, "media")) { + if (player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_CALL || + player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_ALARM || + player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_MEDIA ) { if (!MMPLAYER_IS_RTSP_STREAMING(player)) { // hold 0.7 second to excute "fadedown mute" effect LOGW("do fade down->pause->undo fade down"); @@ -8204,6 +8203,7 @@ void __mmplayer_sound_focus_watch_callback(int id, mm_sound_focus_type_e focus_t LOGW("fail to set Pause state by asm"); goto EXIT; } + __mmplayer_undo_sound_fadedown(player); } else /* rtsp should connect again in specific network becasue tcp session can't be kept any more */ @@ -8279,10 +8279,9 @@ __mmplayer_sound_focus_callback(int id, mm_sound_focus_type_e focus_type, mm_sou if (MM_ERROR_NONE == __mmplayer_convert_sound_focus_state(FALSE, reason_for_change, &msg)) player->sound_focus.focus_changed_msg = (int)msg; - if (strstr(reason_for_change, "call") || - strstr(reason_for_change, "voip") || /* FIXME: to check */ - strstr(reason_for_change, "alarm") || - strstr(reason_for_change, "media")) { + if (player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_CALL || + player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_ALARM || + player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_MEDIA ) { if (!MMPLAYER_IS_RTSP_STREAMING(player)) { //hold 0.7 second to excute "fadedown mute" effect LOGW("do fade down->pause->undo fade down"); @@ -8295,9 +8294,10 @@ __mmplayer_sound_focus_callback(int id, mm_sound_focus_type_e focus_type, mm_sou goto EXIT; } __mmplayer_undo_sound_fadedown(player); - } else + } else { /* rtsp should connect again in specific network becasue tcp session can't be kept any more */ _mmplayer_unrealize((MMHandleType)player); + } } else { LOGW("pause immediately"); result = _mmplayer_pause((MMHandleType)player); @@ -8306,6 +8306,14 @@ __mmplayer_sound_focus_callback(int id, mm_sound_focus_type_e focus_type, mm_sou goto EXIT; } } + + if (player->sound_focus.focus_changed_msg == MM_PLAYER_FOCUS_CHANGED_BY_MEDIA && + player->sound_focus.session_type == MM_SESSION_TYPE_MEDIA && + !(player->sound_focus.session_flags & MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED)) { + result = mm_sound_set_focus_reacquisition_for_session(player->sound_focus.focus_id, false); + if (result != MM_ERROR_NONE) + LOGW("fail to set focus reacquisition to FALSE, skip going on.."); + } } else if (focus_state == FOCUS_IS_ACQUIRED) { LOGW("FOCUS_IS_ACQUIRED: Got msg from asm to resume"); player->sound_focus.antishock = TRUE; diff --git a/src/mm_player_sound_focus.c b/src/mm_player_sound_focus.c index 4e27284..c9c42bf 100644 --- a/src/mm_player_sound_focus.c +++ b/src/mm_player_sound_focus.c @@ -147,8 +147,12 @@ _mmplayer_sound_acquire_focus(MMPlayerSoundFocus* sound_focus) } if (_mmplayer_is_using_internal_sound_focus(sound_focus)) { + if (sound_focus->session_type == MM_SESSION_TYPE_MEDIA) + /* option: 1 for no-resume */ + ret = mm_sound_acquire_focus_with_option(sound_focus->focus_id, FOCUS_FOR_BOTH, 1, "mm-player acquire focus"); + else + ret = mm_sound_acquire_focus(sound_focus->focus_id, FOCUS_FOR_BOTH, "mm-player acquire focus"); - ret = mm_sound_acquire_focus(sound_focus->focus_id, FOCUS_FOR_BOTH, "mm-player acquire focus"); if (ret != MM_ERROR_NONE) { LOGE("failed to acquire sound focus [0x%X]", ret); return ret; @@ -201,7 +205,12 @@ _mmplayer_sound_release_focus(MMPlayerSoundFocus* sound_focus) } if (_mmplayer_is_using_internal_sound_focus(sound_focus)) { - ret = mm_sound_release_focus(sound_focus->focus_id, FOCUS_FOR_BOTH, "mm-player release focus"); + if (sound_focus->session_type == MM_SESSION_TYPE_MEDIA) + /* option: 1 for no-resume */ + ret = mm_sound_release_focus_with_option(sound_focus->focus_id, FOCUS_FOR_BOTH, 1, "mm-player release focus"); + else + ret = mm_sound_release_focus(sound_focus->focus_id, FOCUS_FOR_BOTH, "mm-player release focus"); + if (ret != MM_ERROR_NONE) { LOGE("failed to release sound focus\n"); return ret; |