summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packaging/libmm-player.spec2
-rw-r--r--src/mm_player_priv.c26
-rw-r--r--src/mm_player_sound_focus.c13
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;