return state;
}
+bool MediaPlayer::isCallReason(sound_stream_focus_change_reason_e reason)
+{
+ return reason == SOUND_STREAM_FOCUS_CHANGED_BY_RINGTONE ||
+ reason == SOUND_STREAM_FOCUS_CHANGED_BY_VOIP ||
+ reason == SOUND_STREAM_FOCUS_CHANGED_BY_CALL;
+}
+
bool MediaPlayer::getFocus() const
{
sound_stream_focus_change_reason_e acquiredBy = SOUND_STREAM_FOCUS_CHANGED_BY_MEDIA;
if (sound_manager_get_current_playback_focus(&acquiredBy, &flags, &extraInfo) == SOUND_MANAGER_ERROR_NONE)
{
free(extraInfo);
- return acquiredBy != SOUND_STREAM_FOCUS_CHANGED_BY_RINGTONE &&
- acquiredBy != SOUND_STREAM_FOCUS_CHANGED_BY_VOIP &&
- acquiredBy != SOUND_STREAM_FOCUS_CHANGED_BY_CALL;
+ return !isCallReason(acquiredBy);
}
return true;
{
MSG_LOG("Interrupted focus change reason = ", reason);
auto *self = static_cast<MediaPlayer*>(user_data);
- ecore_main_loop_thread_safe_call_async
- (
+ if (isCallReason(reason))
+ {
+ ecore_main_loop_thread_safe_call_async(
[](void *data)
{
auto *self = (MediaPlayer*)data;
self->m_pListener->onMediaPlayerSoundFocusChanged();
},
self);
+ }
}