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");
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 */
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");
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);
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;
}
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;
}
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;