diff options
author | Eunhae Choi <eunhae1.choi@samsung.com> | 2017-05-10 20:30:58 +0900 |
---|---|---|
committer | Eunhae Choi <eunhae1.choi@samsung.com> | 2017-05-10 20:32:52 +0900 |
commit | f1ffb1907e924fd419e93d945c50aa883691b488 (patch) | |
tree | d73d8a4e21ebdd7ad41b183aaa908ada634414a9 | |
parent | 69bb9e00107ef8de034eb41ff9d1248f004da40a (diff) | |
parent | 277844f8e30c2b18145dae03146467090849eb37 (diff) | |
download | libmm-player-f1ffb1907e924fd419e93d945c50aa883691b488.tar.gz libmm-player-f1ffb1907e924fd419e93d945c50aa883691b488.tar.bz2 libmm-player-f1ffb1907e924fd419e93d945c50aa883691b488.zip |
[0.6.46] Merge branch tizen_3.0 to tizensubmit/tizen/20170511.065823accepted/tizen/unified/20170511.173307
[0.6.45] set muse client pid to audiosink property
[0.6.46] Apply blocking policy
Change-Id: I9286a14ddc3af7786b04c9c988eeae8e6e32c063
-rw-r--r-- | packaging/libmm-player.spec | 2 | ||||
-rw-r--r-- | src/mm_player_priv.c | 11 | ||||
-rw-r--r-- | src/mm_player_sound_focus.c | 45 |
3 files changed, 50 insertions, 8 deletions
diff --git a/packaging/libmm-player.spec b/packaging/libmm-player.spec index 6a42a3c..f378ba4 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.44 +Version: 0.6.46 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index 2ffe025..421e5a9 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -4537,14 +4537,15 @@ void __mmplayer_gst_set_audiosink_property(mm_player_t* player, MMHandleType att LOGE("stream_type is null.\n"); } else { if (player->sound_focus.focus_id) - snprintf(stream_props, sizeof(stream_props)-1, "props,media.role=%s, media.parent_id=%d, media.focus_id=%d", - stream_type, stream_id, player->sound_focus.focus_id); + snprintf(stream_props, sizeof(stream_props)-1, "props,media.role=%s, media.parent_id=%d, media.focus_id=%d, mused.client_pid=%d", + stream_type, stream_id, player->sound_focus.focus_id, player->sound_focus.pid); else - snprintf(stream_props, sizeof(stream_props)-1, "props,media.role=%s, media.parent_id=%d", - stream_type, stream_id); + snprintf(stream_props, sizeof(stream_props)-1, "props,media.role=%s, media.parent_id=%d, mused.client_pid=%d", + stream_type, stream_id, player->sound_focus.pid); props = gst_structure_from_string(stream_props, NULL); g_object_set(player->pipeline->audiobin[MMPLAYER_A_SINK].gst, "stream-properties", props, NULL); - LOGI("stream_type[%s], stream_id[%d], focus_id[%d], result[%s].\n", stream_type, stream_id, player->sound_focus.focus_id, stream_props); + LOGI("stream_type[%s], stream_id[%d], focus_id[%d], client_pid[%d], result[%s].\n", + stream_type, stream_id, player->sound_focus.focus_id, player->sound_focus.pid, stream_props); } mm_attrs_get_int_by_name(attrs, "sound_latency_mode", &latency_mode); diff --git a/src/mm_player_sound_focus.c b/src/mm_player_sound_focus.c index e7a932c..4e27284 100644 --- a/src/mm_player_sound_focus.c +++ b/src/mm_player_sound_focus.c @@ -114,6 +114,25 @@ __mmplayer_sound_get_stream_type(gint type) return "media"; } +static bool +__mmplayer_check_need_block(const char *focus_acquired_by) +{ + if (!focus_acquired_by) + return false; + + if (!strcmp(focus_acquired_by, "alarm") || + !strcmp(focus_acquired_by, "ringtone-voip") || + !strcmp(focus_acquired_by, "ringtone-call") || + !strcmp(focus_acquired_by, "voip") || + !strcmp(focus_acquired_by, "call-voice") || + !strcmp(focus_acquired_by, "call-video")) { + LOGW("Blocked by session policy, focus_acquired_by[%s]", focus_acquired_by); + return true; + } + + return false; +} + int _mmplayer_sound_acquire_focus(MMPlayerSoundFocus* sound_focus) { @@ -131,7 +150,7 @@ _mmplayer_sound_acquire_focus(MMPlayerSoundFocus* sound_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\n"); + LOGE("failed to acquire sound focus [0x%X]", ret); return ret; } @@ -139,7 +158,29 @@ _mmplayer_sound_acquire_focus(MMPlayerSoundFocus* sound_focus) ret = mm_sound_update_focus_status(sound_focus->focus_id, 1); if (ret != MM_ERROR_NONE) - LOGE("failed to update focus status\n"); + LOGE("failed to update focus status [0x%X]", ret); + } else { + if (sound_focus->watch_id > 0) { + char *stream_type = NULL; + char *ext_info = NULL; + int option = 0; + + ret = mm_sound_get_stream_type_of_acquired_focus(FOCUS_FOR_BOTH, &stream_type, &option, &ext_info); + if (ret == MM_ERROR_NONE) { + LOGD("Focus is acquired by stream_type[%s], option[%d], ext_info[%s]", stream_type, option, ext_info); + if (__mmplayer_check_need_block((const char*)stream_type)) { + LOGE("Blocked by an acquired focus[%s]", stream_type); + ret = MM_ERROR_POLICY_INTERNAL; + } + } else { + LOGW("failed to get stream type of acquired focus [0x%X]", ret); + if (ret == MM_ERROR_SOUND_NO_DATA) /* there is no acquired focus, it is normal case */ + ret = MM_ERROR_NONE; + } + + if (stream_type) free(stream_type); + if (ext_info) free(ext_info); + } } MMPLAYER_FLEAVE(); |