From 14f5abf81f9684493a070764f91588d8b351605a Mon Sep 17 00:00:00 2001 From: Ismo Puustinen Date: Fri, 12 Oct 2012 16:46:31 +0300 Subject: [PATCH] Make ASM handling external. --- server/include/mm_sound_mgr_asm.h | 1 - server/mm_sound_mgr_codec.c | 12 ++++++------ server/mm_sound_mgr_session.c | 8 ++++---- server/mm_sound_server.c | 2 ++ 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/server/include/mm_sound_mgr_asm.h b/server/include/mm_sound_mgr_asm.h index 3bd9f94..35b154a 100644 --- a/server/include/mm_sound_mgr_asm.h +++ b/server/include/mm_sound_mgr_asm.h @@ -30,6 +30,5 @@ int MMSoundMgrASMFini(void); int __asm_process_message (void *asm_rcv_msg, void *asm_ret_msg); - #endif /* __MM_SOUND_MGR_ASM_H__ */ diff --git a/server/mm_sound_mgr_codec.c b/server/mm_sound_mgr_codec.c index 849de31..2dc6f7d 100644 --- a/server/mm_sound_mgr_codec.c +++ b/server/mm_sound_mgr_codec.c @@ -241,8 +241,8 @@ int MMSoundMgrCodecPlay(int *slotid, const mmsound_mgr_codec_param_t *param) */ if(param->session_type != ASM_EVENT_CALL && param->session_type != ASM_EVENT_VIDEOCALL) { - if(!ASM_register_sound_ex((int)param->param, ¶m->session_handle, param->session_type, ASM_STATE_PLAYING, - sound_codec_asm_callback, (void*)*slotid, ASM_RESOURCE_NONE, &errorcode, __asm_process_message)) { + if(!ASM_register_sound((int)param->param, ¶m->session_handle, param->session_type, ASM_STATE_PLAYING, + sound_codec_asm_callback, (void*)*slotid, ASM_RESOURCE_NONE, &errorcode)) { debug_critical("ASM_register_sound() failed %d\n", errorcode); pthread_mutex_unlock(&g_slot_mutex); return MM_ERROR_POLICY_INTERNAL; @@ -286,7 +286,7 @@ int MMSoundMgrCodecPlay(int *slotid, const mmsound_mgr_codec_param_t *param) cleanup: if(param->session_type != ASM_EVENT_CALL && param->session_type != ASM_EVENT_VIDEOCALL && need_asm_unregister == 1) { - if(!ASM_unregister_sound_ex(param->session_handle, param->session_type, &errorcode,__asm_process_message)) { + if(!ASM_unregister_sound(param->session_handle, param->session_type, &errorcode)) { debug_error("Unregister sound failed 0x%X\n", errorcode); return MM_ERROR_POLICY_INTERNAL; } @@ -358,8 +358,8 @@ int MMSoundMgrCodecPlayDtmf(int *slotid, const mmsound_mgr_codec_param_t *param) int need_asm_unregister = 0; if(param->session_type != ASM_EVENT_CALL && param->session_type != ASM_EVENT_VIDEOCALL) { - if(!ASM_register_sound_ex((int)param->param, ¶m->session_handle, param->session_type, ASM_STATE_PLAYING, - sound_codec_asm_callback, (void*)*slotid, ASM_RESOURCE_NONE, &errorcode, __asm_process_message)) { + if(!ASM_register_sound((int)param->param, ¶m->session_handle, param->session_type, ASM_STATE_PLAYING, + sound_codec_asm_callback, (void*)*slotid, ASM_RESOURCE_NONE, &errorcode)) { debug_critical("ASM_register_sound() failed %d\n", errorcode); pthread_mutex_unlock(&g_slot_mutex); return MM_ERROR_POLICY_INTERNAL; @@ -454,7 +454,7 @@ static int _MMSoundMgrCodecStopCallback(int param) if(g_slots[param].session_type != ASM_EVENT_CALL && g_slots[param].session_type != ASM_EVENT_VIDEOCALL) { debug_msg("[CODEC MGR] ASM unregister\n"); - if(!ASM_unregister_sound_ex(g_slots[param].session_handle, g_slots[param].session_type, &errorcode, __asm_process_message)) { + if(!ASM_unregister_sound(g_slots[param].session_handle, g_slots[param].session_type, &errorcode)) { debug_error("[CODEC MGR] Unregister sound failed 0x%X\n", errorcode); } } diff --git a/server/mm_sound_mgr_session.c b/server/mm_sound_mgr_session.c index 404b623..b1f514d 100644 --- a/server/mm_sound_mgr_session.c +++ b/server/mm_sound_mgr_session.c @@ -208,7 +208,7 @@ static bool _asm_register_for_headset (int * handle) return false; } - if (!ASM_register_sound_ex (-1, handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_NONE, NULL, NULL, ASM_RESOURCE_NONE, &asm_error, __asm_process_message)) { + if(!ASM_register_sound (-1, handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_NONE, NULL, NULL, ASM_RESOURCE_NONE, &asm_error)) { debug_warning("earjack event register failed with 0x%x\n", asm_error); return false; } @@ -237,11 +237,11 @@ static void _asm_pause_process(int handle) //do pause debug_warning("Send earphone unplug event to Audio Session Manager Server for BT headset\n"); - if (!ASM_set_sound_state_ex(handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_PLAYING, ASM_RESOURCE_NONE, &asm_error, __asm_process_message)) { + if(!ASM_set_sound_state(handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_PLAYING, ASM_RESOURCE_NONE, &asm_error)) { debug_error("earjack event set sound state to playing failed with 0x%x\n", asm_error); } - if (!ASM_set_sound_state_ex(handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_STOP, ASM_RESOURCE_NONE, &asm_error, __asm_process_message)) { + if(!ASM_set_sound_state(handle, ASM_EVENT_EARJACK_UNPLUG, ASM_STATE_STOP, ASM_RESOURCE_NONE, &asm_error)) { debug_error("earjack event set sound state to stop failed with 0x%x\n", asm_error); } @@ -257,7 +257,7 @@ static bool _asm_unregister_for_headset (int *handle) return false; } - if (!ASM_unregister_sound_ex(*handle, ASM_EVENT_EARJACK_UNPLUG, &asm_error, __asm_process_message)) { + if(!ASM_unregister_sound(handle, ASM_EVENT_EARJACK_UNPLUG, &asm_error)) { debug_error("earjack event unregister failed with 0x%x\n", asm_error); return false; } diff --git a/server/mm_sound_server.c b/server/mm_sound_server.c index 5a4c67d..e5f9df9 100644 --- a/server/mm_sound_server.c +++ b/server/mm_sound_server.c @@ -221,9 +221,11 @@ int main(int argc, char **argv) MMSoundMgrIpcInit(); pulse_handle = MMSoundMgrPulseInit(); +#if 0 MMSoundMgrASMInit(); /* Wait for ASM Ready */ __wait_for_asm_ready(); +#endif _mm_sound_mgr_device_init(); MMSoundMgrHeadsetInit(); MMSoundMgrDockInit(); -- 2.7.4