#include <glib.h>
+#include <string.h>
#include "music.h"
#include "mp-player-mgr.h"
#include "mp-player-control.h"
}
PLAYER_ENTER_LOG("start");
- error = sound_manager_acquire_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL);
- if (error != SOUND_MANAGER_ERROR_NONE) {
- ERROR_TRACE("failed to acquire focus [%x]", error);
- }
+ if (ad->stream_info) {
+ error = sound_manager_acquire_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL);
+ if (error != SOUND_MANAGER_ERROR_NONE) {
+ ERROR_TRACE("failed to acquire focus [%x]", error);
+ }
- sound_manager_get_focus_reacquisition(ad->stream_info, &reacquire_state);
- if (reacquire_state == EINA_FALSE) {
- sound_manager_set_focus_reacquisition(ad->stream_info, EINA_TRUE);
+ sound_manager_get_focus_reacquisition(ad->stream_info, &reacquire_state);
+ if (reacquire_state == EINA_FALSE) {
+ sound_manager_set_focus_reacquisition(ad->stream_info, EINA_TRUE);
+ }
}
err = g_player_apis.start(_player);
PLAYER_LEAVE_LOG("start");
sound_stream_focus_state_e state_for_playback;
sound_stream_focus_state_e state_for_recording;
int ret = -1;
- ret = sound_manager_get_focus_state(ad->stream_info, &state_for_playback,
- &state_for_recording);
mp_util_lock_cpu();
if (!mp_player_mgr_is_active()) {
return err;
}
}
- if (state_for_playback != SOUND_STREAM_FOCUS_STATE_ACQUIRED) {
- error = sound_manager_acquire_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL);
- if (error != SOUND_MANAGER_ERROR_NONE) {
- ERROR_TRACE("failed to acquire focus [%x]", error);
- return error;
- }
- }
- sound_manager_get_focus_reacquisition(ad->stream_info, &reacquire_state);
- if (reacquire_state == EINA_FALSE) {
- sound_manager_set_focus_reacquisition(ad->stream_info, EINA_TRUE);
+ if (ad->stream_info) {
+ ret = sound_manager_get_focus_state(ad->stream_info, &state_for_playback, &state_for_recording);
+ if (state_for_playback != SOUND_STREAM_FOCUS_STATE_ACQUIRED) {
+ error = sound_manager_acquire_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL);
+ if (error != SOUND_MANAGER_ERROR_NONE) {
+ ERROR_TRACE("failed to acquire focus [%x]", error);
+ return error;
+ }
+ }
+
+ sound_manager_get_focus_reacquisition(ad->stream_info, &reacquire_state);
+ if (reacquire_state == EINA_FALSE) {
+ sound_manager_set_focus_reacquisition(ad->stream_info, EINA_TRUE);
+ }
}
+
if (mp_player_mgr_get_state() != PLAYER_STATE_IDLE) {
DEBUG_TRACE("player state is ready");
PLAYER_ENTER_LOG("start");
PLAYER_ENTER_LOG("pause");
err = g_player_apis.pause(_player);
- error = sound_manager_release_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL);
- if (error != SOUND_MANAGER_ERROR_NONE) {
- ERROR_TRACE("failed to release focus error[%x]", error);
+ if (ad->stream_info) {
+ error = sound_manager_release_focus(ad->stream_info, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL);
+ if (error != SOUND_MANAGER_ERROR_NONE) {
+ ERROR_TRACE("failed to release focus error[%x]", error);
+ }
}
PLAYER_LEAVE_LOG("pause");
if (reason_for_change != SOUND_STREAM_FOCUS_CHANGED_BY_ALARM &&
reason_for_change != SOUND_STREAM_FOCUS_CHANGED_BY_NOTIFICATION) {
sound_manager_get_focus_reacquisition(ad->stream_info, &reacquire_state);
- if (reacquire_state == EINA_TRUE) {
+ if (!strcmp(additional_info, "cam_capture")) {
+ sound_manager_set_focus_reacquisition(ad->stream_info, EINA_TRUE);
+ } else if (reacquire_state == EINA_TRUE) {
sound_manager_set_focus_reacquisition(ad->stream_info, EINA_FALSE);
}
}