From: Sangchul Lee Date: Wed, 24 Jun 2020 04:36:44 +0000 (+0900) Subject: Remove useless converting error logic inside of stream information/routing APIs X-Git-Tag: submit/tizen/20200626.085752~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F10%2F237010%2F4;p=platform%2Fcore%2Fapi%2Fsound-manager.git Remove useless converting error logic inside of stream information/routing APIs [Version] 0.6.12 [Issue Type] Refactoring Change-Id: Iece9229a1b810292b3b98a81b8aac12df7022782 Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-sound-manager.spec b/packaging/capi-media-sound-manager.spec index 8d5f8aa..c13d102 100644 --- a/packaging/capi-media-sound-manager.spec +++ b/packaging/capi-media-sound-manager.spec @@ -1,6 +1,6 @@ Name: capi-media-sound-manager Summary: Sound Manager library -Version: 0.6.11 +Version: 0.6.12 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/sound_manager.c b/src/sound_manager.c index b05e721..0d28bbf 100644 --- a/src/sound_manager.c +++ b/src/sound_manager.c @@ -143,7 +143,7 @@ int sound_manager_remove_volume_changed_cb(int id) int sound_manager_create_stream_information(sound_stream_type_e stream_type, sound_stream_focus_state_changed_cb callback, void *user_data, sound_stream_info_h *stream_info) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; SM_ARG_CHECK(stream_info); @@ -151,15 +151,15 @@ int sound_manager_create_stream_information(sound_stream_type_e stream_type, sou sound_stream_info_s *stream_h = malloc(sizeof(sound_stream_info_s)); if (!stream_h) { - ret = MM_ERROR_OUT_OF_MEMORY; + ret = SOUND_MANAGER_ERROR_INTERNAL; goto LEAVE; } memset(stream_h, 0, sizeof(sound_stream_info_s)); ret = _convert_stream_type(stream_type, &stream_h->stream_type); - if (ret == MM_ERROR_NONE) { + if (ret == SOUND_MANAGER_ERROR_NONE) { ret = _make_pa_connection_and_register_focus(stream_h, callback, user_data); - if (ret == MM_ERROR_NONE) { + if (ret == SOUND_MANAGER_ERROR_NONE) { *stream_info = (sound_stream_info_h)stream_h; LOGI("stream_h(%p), pa_index(%u), focus_id(%d), user_cb(%p), ret(0x%x)", stream_h, stream_h->pa_info.index, stream_h->focus_id, stream_h->user_cb, ret); @@ -170,12 +170,12 @@ LEAVE: if (ret) SM_SAFE_FREE(stream_h); - return _convert_sound_manager_error_code(__func__, ret); + return ret; } int sound_manager_destroy_stream_information(sound_stream_info_h stream_info) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info; SM_ARG_CHECK(stream_h); @@ -186,17 +186,17 @@ int sound_manager_destroy_stream_information(sound_stream_info_h stream_info) if (stream_h->vstream) { LOGE("virtual stream is still alive"); SM_LEAVE_CRITICAL_SECTION(&stream_h->vstream_mutex); - return _convert_sound_manager_error_code(__func__, MM_ERROR_SOUND_INVALID_OPERATION); + return SOUND_MANAGER_ERROR_INVALID_OPERATION; } SM_LEAVE_CRITICAL_SECTION(&stream_h->vstream_mutex); SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_state_mutex, MM_ERROR_SOUND_INTERNAL); ret = _destroy_pa_connection_and_unregister_focus(stream_h); SM_LEAVE_CRITICAL_SECTION(&stream_h->focus_state_mutex); - if (ret == MM_ERROR_NONE) + if (ret == SOUND_MANAGER_ERROR_NONE) SM_SAFE_FREE(stream_h); - return _convert_sound_manager_error_code(__func__, ret); + return ret; } int sound_manager_get_sound_type(sound_stream_info_h stream_info, sound_type_e *sound_type) @@ -224,75 +224,55 @@ LEAVE: int sound_manager_add_device_for_stream_routing(sound_stream_info_h stream_info, sound_device_h device) { - int ret = MM_ERROR_NONE; - sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info; + SM_ARG_CHECK(stream_info); + SM_ARG_CHECK(device); LOGI(">> enter"); - ret = _add_device_for_stream_routing(stream_h, device); - - return _convert_sound_manager_error_code(__func__, ret); + return _add_device_for_stream_routing((sound_stream_info_s*)stream_info, device); } int sound_manager_remove_device_for_stream_routing(sound_stream_info_h stream_info, sound_device_h device) { - int ret = MM_ERROR_NONE; - sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info; + SM_ARG_CHECK(stream_info); + SM_ARG_CHECK(device); LOGI(">> enter"); - ret = _remove_device_for_stream_routing(stream_h, device); - - return _convert_sound_manager_error_code(__func__, ret); + return _remove_device_for_stream_routing((sound_stream_info_s*)stream_info, device); } int sound_manager_remove_all_devices_for_stream_routing(sound_stream_info_h stream_info) { - int ret = MM_ERROR_NONE; - sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info; + SM_ARG_CHECK(stream_info); LOGI(">> enter"); - ret = _remove_all_devices_for_stream_routing(stream_h); - - return _convert_sound_manager_error_code(__func__, ret); + return _remove_all_devices_for_stream_routing((sound_stream_info_s*)stream_info); } int sound_manager_apply_stream_routing(sound_stream_info_h stream_info) { - int ret = MM_ERROR_NONE; - sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info; + SM_ARG_CHECK(stream_info); LOGI(">> enter"); - ret = _apply_stream_routing(stream_h); - - return _convert_sound_manager_error_code(__func__, ret); + return _apply_stream_routing((sound_stream_info_s*)stream_info); } int sound_manager_set_stream_preferred_device(sound_stream_info_h stream_info, sound_device_io_direction_e io_direction, sound_device_h device) { - int ret = MM_ERROR_NONE; - sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info; - - SM_ARG_CHECK(stream_h); - - ret = _set_preferred_device(stream_h, io_direction, device); + SM_ARG_CHECK(stream_info); - return _convert_sound_manager_error_code(__func__, ret); + return _set_preferred_device((sound_stream_info_s*)stream_info, io_direction, device); } int sound_manager_get_stream_preferred_device(sound_stream_info_h stream_info, int *in_device_id, int *out_device_id) { - int ret = MM_ERROR_NONE; - sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info; - - SM_ARG_CHECK(stream_h); + SM_ARG_CHECK(stream_info); SM_ARG_CHECK(in_device_id || out_device_id); - ret = _get_preferred_device(stream_h, in_device_id, out_device_id); - - return _convert_sound_manager_error_code(__func__, ret); + return _get_preferred_device((sound_stream_info_s*)stream_info, in_device_id, out_device_id); } int sound_manager_set_focus_reacquisition(sound_stream_info_h stream_info, bool enable) diff --git a/src/sound_manager_internal.c b/src/sound_manager_internal.c index 385a896..eb6054f 100644 --- a/src/sound_manager_internal.c +++ b/src/sound_manager_internal.c @@ -181,7 +181,7 @@ int sound_manager_remove_volume_changed_cb_internal(int id) int sound_manager_create_stream_information_internal(sound_stream_type_internal_e stream_type, sound_stream_focus_state_changed_cb callback, void *user_data, sound_stream_info_h *stream_info) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; SM_ARG_CHECK(stream_info); @@ -189,13 +189,13 @@ int sound_manager_create_stream_information_internal(sound_stream_type_internal_ sound_stream_info_s *stream_h = malloc(sizeof(sound_stream_info_s)); if (!stream_h) { - ret = MM_ERROR_OUT_OF_MEMORY; + ret = SOUND_MANAGER_ERROR_INTERNAL; goto LEAVE; } memset(stream_h, 0, sizeof(sound_stream_info_s)); ret = _convert_stream_type_for_internal(stream_type, &stream_h->stream_type); - if (ret == MM_ERROR_NONE) { + if (ret == SOUND_MANAGER_ERROR_NONE) { _set_focus_availability(stream_h); ret = _make_pa_connection_and_register_focus(stream_h, callback, user_data); if (!ret) { @@ -209,12 +209,11 @@ LEAVE: if (ret) SM_SAFE_FREE(stream_h); - return _convert_sound_manager_error_code(__func__, ret); + return ret; } int sound_manager_set_stream_routing_option(sound_stream_info_h stream_info, const char *name, int value) { - int ret = MM_ERROR_NONE; sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info; SM_ARG_CHECK(stream_h); @@ -222,14 +221,11 @@ int sound_manager_set_stream_routing_option(sound_stream_info_h stream_info, con LOGI(">> enter"); - ret = _set_route_option(stream_h->pa_info.index, name, value); - - return _convert_sound_manager_error_code(__func__, ret); + return _set_route_option(stream_h->pa_info.index, name, value); } int sound_manager_is_available_stream_information(sound_stream_info_h stream_info, native_api_e api_name, bool *is_available) { - int ret = MM_ERROR_NONE; int i = 0; const char *name = NULL; sound_stream_info_s* stream_h = (sound_stream_info_s*)stream_info; @@ -248,7 +244,7 @@ int sound_manager_is_available_stream_information(sound_stream_info_h stream_inf } LOGI("stream_type[%s], native api[%s], is_available[%d]", stream_h->stream_type, name, *is_available); - return _convert_sound_manager_error_code(__func__, ret); + return SOUND_MANAGER_ERROR_NONE; } int sound_manager_get_type_from_stream_information(sound_stream_info_h stream_info, char **type) @@ -278,38 +274,27 @@ int sound_manager_get_index_from_stream_information(sound_stream_info_h stream_i int sound_manager_add_device_id_for_stream_routing(sound_stream_info_h stream_info, int device_id) { - int ret = MM_ERROR_NONE; - sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info; + SM_ARG_CHECK(stream_info); LOGI(">> enter"); - ret = _add_device_id_for_stream_routing(stream_h, device_id); - - return _convert_sound_manager_error_code(__func__, ret); + return _add_device_id_for_stream_routing((sound_stream_info_s*)stream_info, device_id); } int sound_manager_remove_device_id_for_stream_routing(sound_stream_info_h stream_info, int device_id) { - int ret = MM_ERROR_NONE; - sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info; + SM_ARG_CHECK(stream_info); LOGI(">> enter"); - ret = _remove_device_id_for_stream_routing(stream_h, device_id); - - return _convert_sound_manager_error_code(__func__, ret); + return _remove_device_id_for_stream_routing((sound_stream_info_s*)stream_info, device_id); } int sound_manager_set_stream_preferred_device_id(sound_stream_info_h stream_info, sound_device_io_direction_e io_direction, int device_id) { - int ret = MM_ERROR_NONE; - sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info; - - SM_ARG_CHECK(stream_h); - - ret = _set_preferred_device_id(stream_h, io_direction, device_id); + SM_ARG_CHECK(stream_info); - return _convert_sound_manager_error_code(__func__, ret); + return _set_preferred_device_id((sound_stream_info_s*)stream_info, io_direction, device_id); } int sound_manager_get_device_state_by_id(int device_id, sound_device_state_e *state) diff --git a/src/sound_manager_private.c b/src/sound_manager_private.c index 571b324..5bd5313 100644 --- a/src/sound_manager_private.c +++ b/src/sound_manager_private.c @@ -200,8 +200,7 @@ int _convert_sound_manager_error_code(const char *func, int code) int _convert_stream_type(sound_stream_type_e stream_type_enum, char **stream_type) { - if (stream_type == NULL) - return MM_ERROR_INVALID_ARGUMENT; + SM_ARG_CHECK(stream_type); switch (stream_type_enum) { case SOUND_STREAM_TYPE_MEDIA: @@ -237,22 +236,19 @@ int _convert_stream_type(sound_stream_type_e stream_type_enum, char **stream_typ default: //LCOV_EXCL_START LOGE("could not find the stream_type[%d] in this switch case statement", stream_type_enum); - return MM_ERROR_SOUND_INTERNAL; + return SOUND_MANAGER_ERROR_INTERNAL; //LCOV_EXCL_STOP } LOGI("stream_type[%s]", *stream_type); - return MM_ERROR_NONE; + return SOUND_MANAGER_ERROR_NONE; } //LCOV_EXCL_START int _convert_stream_type_for_internal(sound_stream_type_internal_e stream_type_enum, char **stream_type) { - int ret = MM_ERROR_NONE; - - if (stream_type == NULL) - return MM_ERROR_INVALID_ARGUMENT; + SM_ARG_CHECK(stream_type); switch (stream_type_enum) { case SOUND_STREAM_TYPE_RINGTONE_CALL: @@ -292,12 +288,11 @@ int _convert_stream_type_for_internal(sound_stream_type_internal_e stream_type_e #endif default: LOGE("could not find the stream_type[%d] in this switch case statement", stream_type_enum); - ret = MM_ERROR_SOUND_INTERNAL; - break; + return SOUND_MANAGER_ERROR_INTERNAL; } LOGI("stream_type_for_internal[%s]", *stream_type); - return ret; + return SOUND_MANAGER_ERROR_NONE; } void _set_focus_availability(sound_stream_info_s *stream_info) @@ -490,7 +485,7 @@ int _convert_sound_type_to_enum_for_internal(const char *sound_type, sound_type_ int _convert_device_type_enum_to_str(sound_device_type_e device_type, char **device_type_str) { - SM_NULL_ARG_CHECK_FOR_PRIV(device_type_str); + SM_ARG_CHECK(device_type_str); switch (device_type) { case SOUND_DEVICE_BUILTIN_SPEAKER: @@ -525,12 +520,12 @@ int _convert_device_type_enum_to_str(sound_device_type_e device_type, char **dev break; default: LOGE("could not find the device_type[%d] in this switch case statement", device_type); - return MM_ERROR_SOUND_INTERNAL; + return SOUND_MANAGER_ERROR_INTERNAL; } LOGI("device_type[%s]", *device_type_str); - return MM_ERROR_NONE; + return SOUND_MANAGER_ERROR_NONE; } int _convert_device_type_str_to_enum(const char *device_type_str, sound_device_type_e *device_type) @@ -574,6 +569,8 @@ int _convert_device_type_str_to_enum(const char *device_type_str, sound_device_t //LCOV_EXCL_STOP int _convert_device_type(mm_sound_device_type_e device_type, sound_device_type_e *sound_device_type) { + SM_ARG_CHECK(sound_device_type); + switch (device_type) { case MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER: *sound_device_type = SOUND_DEVICE_BUILTIN_SPEAKER; @@ -608,11 +605,11 @@ int _convert_device_type(mm_sound_device_type_e device_type, sound_device_type_e break; default: LOGE("not supported device_type(%d)", device_type); - return MM_ERROR_INVALID_ARGUMENT; + return SOUND_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_STOP } - return MM_ERROR_NONE; + return SOUND_MANAGER_ERROR_NONE; } int _convert_device_io_direction(mm_sound_device_io_direction_e io_direction, sound_device_io_direction_e *sound_io_direction) @@ -946,7 +943,7 @@ void _pa_stream_state_cb(pa_stream *s, void * userdata) int _get_stream_conf_info(const char *stream_type, stream_conf_info_s *info) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; GVariant *result = NULL; GVariant *child = NULL; GDBusConnection *conn = NULL; @@ -961,7 +958,7 @@ int _get_stream_conf_info(const char *stream_type, stream_conf_info_s *info) assert(info); if ((ret = __get_dbus_connection(&conn))) - return ret; + return SOUND_MANAGER_ERROR_INTERNAL; result = g_dbus_connection_call_sync(conn, PA_BUS_NAME, @@ -979,7 +976,7 @@ int _get_stream_conf_info(const char *stream_type, stream_conf_info_s *info) LOGE("g_dbus_connection_call_sync() for GET_STREAM_INFO error (%s)", err ? err->message : NULL); if (err) g_error_free(err); - ret = MM_ERROR_SOUND_INTERNAL; + ret = SOUND_MANAGER_ERROR_INTERNAL; goto LEAVE; //LCOV_EXCL_STOP } @@ -1017,7 +1014,7 @@ int _get_stream_conf_info(const char *stream_type, stream_conf_info_s *info) g_variant_unref(item); g_variant_unref(child); - /* get availabe in-devices */ + /* get available in-devices */ child = g_variant_get_child_value(result, 3); item = g_variant_get_variant(child); size = g_variant_n_children(item); @@ -1073,7 +1070,7 @@ int _get_stream_conf_info(const char *stream_type, stream_conf_info_s *info) if (info->priority == -1) { LOGE("could not find the info of stream type(%s)", stream_type);//LCOV_EXCL_LINE - ret = MM_ERROR_NOT_SUPPORT_API; + ret = SOUND_MANAGER_ERROR_NOT_SUPPORTED; } LEAVE: @@ -1085,7 +1082,7 @@ LEAVE: int _set_manual_route_info(unsigned int index, manual_route_info_s *info) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; int i = 0; GVariantBuilder *builder_for_in_devices; GVariantBuilder *builder_for_out_devices; @@ -1097,7 +1094,7 @@ int _set_manual_route_info(unsigned int index, manual_route_info_s *info) assert(info); if ((ret = __get_dbus_connection(&conn))) - return ret; + return SOUND_MANAGER_ERROR_INTERNAL; LOGI("stream info index(%u)", index); @@ -1106,7 +1103,7 @@ int _set_manual_route_info(unsigned int index, manual_route_info_s *info) if (!builder_for_in_devices || !builder_for_out_devices) { LOGE("failed to g_variant_builder_new(), builder_for_in_devices(%p), builder_for_out_devices(%p)", builder_for_in_devices, builder_for_out_devices); - ret = MM_ERROR_SOUND_INTERNAL; + ret = SOUND_MANAGER_ERROR_INTERNAL; goto LEAVE; } for (i = 0; i < AVAIL_DEVICES_MAX; i++) { @@ -1138,7 +1135,7 @@ int _set_manual_route_info(unsigned int index, manual_route_info_s *info) LOGE("g_dbus_connection_call_sync() for SET_STREAM_ROUTE_DEVICES error (%s)", err ? err->message : NULL); if (err) g_error_free(err); - ret = MM_ERROR_SOUND_INTERNAL; + ret = SOUND_MANAGER_ERROR_INTERNAL; goto LEAVE; //LCOV_EXCL_STOP } @@ -1146,7 +1143,7 @@ int _set_manual_route_info(unsigned int index, manual_route_info_s *info) g_variant_get(result, "(&s)", &dbus_ret); LOGI("g_dbus_connection_call_sync() success, method return value is (%s)", dbus_ret); if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret))) - ret = MM_ERROR_SOUND_INTERNAL; + ret = SOUND_MANAGER_ERROR_INTERNAL; else info->is_set = true; @@ -1164,7 +1161,7 @@ LEAVE: //LCOV_EXCL_START int _set_route_option(unsigned int index, const char *name, int value) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; GVariant *result = NULL; GDBusConnection *conn = NULL; GError *err = NULL; @@ -1173,7 +1170,7 @@ int _set_route_option(unsigned int index, const char *name, int value) assert(name); if ((ret = __get_dbus_connection(&conn))) - return ret; + return SOUND_MANAGER_ERROR_INTERNAL; LOGI("[OPTION] %s(%d)", name, value); @@ -1192,16 +1189,16 @@ int _set_route_option(unsigned int index, const char *name, int value) LOGE("g_dbus_connection_call_sync() for SET_STREAM_ROUTE_OPTION error (%s)", err ? err->message : NULL); if (err) g_error_free(err); - ret = MM_ERROR_SOUND_INTERNAL; + ret = SOUND_MANAGER_ERROR_INTERNAL; goto LEAVE; } g_variant_get(result, "(&s)", &dbus_ret); LOGI("g_dbus_connection_call_sync() success, method return value is (%s)", dbus_ret); if (!strncmp("STREAM_MANAGER_RETURN_ERROR_NO_STREAM", dbus_ret, strlen(dbus_ret))) - ret = MM_ERROR_SOUND_INVALID_STATE; + ret = SOUND_MANAGER_ERROR_INVALID_STATE; else if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret))) - ret = MM_ERROR_SOUND_INTERNAL; + ret = SOUND_MANAGER_ERROR_INTERNAL; LEAVE: g_variant_unref(result); @@ -2033,7 +2030,7 @@ int _make_pa_connection(sound_pa_info_s *pa_info, const char *context_name) { int pa_ret = PA_OK; - SM_NULL_ARG_CHECK_FOR_PRIV(pa_info); + SM_ARG_CHECK(pa_info); if (!(pa_info->mainloop = pa_threaded_mainloop_new())) goto PA_ERROR; @@ -2071,7 +2068,7 @@ int _make_pa_connection(sound_pa_info_s *pa_info, const char *context_name) pa_threaded_mainloop_unlock(pa_info->mainloop); - return MM_ERROR_NONE; + return SOUND_MANAGER_ERROR_NONE; //LCOV_EXCL_START PA_ERROR_WITH_UNLOCK: pa_threaded_mainloop_unlock(pa_info->mainloop); @@ -2080,21 +2077,22 @@ PA_ERROR: _destroy_pa_connection(pa_info); LOGE("pa_ret %d", pa_ret); - return MM_ERROR_SOUND_INTERNAL; + return SOUND_MANAGER_ERROR_INTERNAL; //LCOV_EXCL_STOP } int _make_pa_connection_and_register_focus(sound_stream_info_s *stream_h, sound_stream_focus_state_changed_cb callback, void *user_data) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; int i = 0; bool is_focus_cb_thread = false; - if ((ret = mm_sound_focus_is_cb_thread(&is_focus_cb_thread, NULL))) - return ret; + if ((mm_ret = mm_sound_focus_is_cb_thread(&is_focus_cb_thread, NULL))) + return _convert_sound_manager_error_code(__func__, mm_ret); if (is_focus_cb_thread) - return MM_ERROR_SOUND_INVALID_OPERATION; + return SOUND_MANAGER_ERROR_INVALID_OPERATION; /* get configuration information of this stream type */ if ((ret = _get_stream_conf_info(stream_h->stream_type, &stream_h->stream_conf_info))) @@ -2108,13 +2106,13 @@ int _make_pa_connection_and_register_focus(sound_stream_info_s *stream_h, sound_ /* register focus */ if (!stream_h->is_focus_unavailable) { - ret = mm_sound_register_focus(stream_h->stream_type, _focus_state_change_callback, stream_h, &stream_h->focus_id); - if (ret == MM_ERROR_NONE) { + mm_ret = mm_sound_register_focus(stream_h->stream_type, _focus_state_change_callback, stream_h, &stream_h->focus_id); + if (mm_ret == MM_ERROR_NONE) { stream_h->user_cb = callback; stream_h->user_data = user_data; } else { - LOGE("failed to register focus, ret(0x%x)", ret);//LCOV_EXCL_LINE - /* disconnect */ + LOGE("failed to register focus, ret(0x%x)", mm_ret);//LCOV_EXCL_LINE + ret = _convert_sound_manager_error_code(__func__, mm_ret); goto ERROR; } } @@ -2131,8 +2129,6 @@ ERROR: SM_SAFE_FREE(stream_h->stream_conf_info.volume_type); _destroy_pa_connection(&stream_h->pa_info); - - ret = MM_ERROR_SOUND_INTERNAL; //LCOV_EXCL_STOP SUCCESS: return ret; @@ -2167,23 +2163,25 @@ void _destroy_pa_connection(sound_pa_info_s *pa_info) int _destroy_pa_connection_and_unregister_focus(sound_stream_info_s *stream_h) { int i = 0; - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; bool is_focus_cb_thread = false; - ret = mm_sound_focus_is_cb_thread(&is_focus_cb_thread, NULL); - if (ret) - return ret; + if ((mm_ret = mm_sound_focus_is_cb_thread(&is_focus_cb_thread, NULL))) + return _convert_sound_manager_error_code(__func__, mm_ret); if (is_focus_cb_thread) - return MM_ERROR_SOUND_INVALID_OPERATION; + return SOUND_MANAGER_ERROR_INVALID_OPERATION; _destroy_pa_connection(&stream_h->pa_info); /* unregister focus */ if (!stream_h->is_focus_unavailable) { - ret = mm_sound_unregister_focus(stream_h->focus_id); - if (ret) - LOGE("failed to unregister focus, ret(0x%x)", ret);//LCOV_EXCL_LINE + mm_ret = mm_sound_unregister_focus(stream_h->focus_id); + if (mm_ret) { + LOGE("failed to unregister focus, ret(0x%x)", mm_ret);//LCOV_EXCL_LINE + ret = _convert_sound_manager_error_code(__func__, mm_ret); + } } for (i = 0; i < AVAIL_DEVICES_MAX; i++) { @@ -2200,28 +2198,28 @@ int _destroy_pa_connection_and_unregister_focus(sound_stream_info_s *stream_h) static int __check_manual_route_type(sound_stream_info_s *stream_info) { - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); + SM_ARG_CHECK(stream_info); if (stream_info->stream_conf_info.route_type != STREAM_ROUTE_TYPE_MANUAL && stream_info->stream_conf_info.route_type != STREAM_ROUTE_TYPE_MANUAL_EXT) { LOGE("route type is not manual or manual-ext"); - return MM_ERROR_POLICY_INTERNAL; + return SOUND_MANAGER_ERROR_POLICY; } - return MM_ERROR_NONE; + return SOUND_MANAGER_ERROR_NONE; } static int __check_auto_route_type(sound_stream_info_s *stream_info) { - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); + SM_ARG_CHECK(stream_info); if (stream_info->stream_conf_info.route_type != STREAM_ROUTE_TYPE_AUTO && stream_info->stream_conf_info.route_type != STREAM_ROUTE_TYPE_AUTO_LAST_CONNECTED) { LOGE("route type is not auto or auto-last-connected"); - return MM_ERROR_POLICY_INTERNAL; + return SOUND_MANAGER_ERROR_INTERNAL; } - return MM_ERROR_NONE; + return SOUND_MANAGER_ERROR_NONE; } static int __add_device_to_stream_info(sound_stream_info_s *stream_info, int device_id, mm_sound_device_io_direction_e device_direction, char *device_type_str) @@ -2229,8 +2227,8 @@ static int __add_device_to_stream_info(sound_stream_info_s *stream_info, int dev int i, j; bool added_successfully = false; - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); - SM_NULL_ARG_CHECK_FOR_PRIV(device_type_str); + SM_ARG_CHECK(stream_info); + SM_ARG_CHECK(device_type_str); if (device_direction == MM_SOUND_DEVICE_IO_DIRECTION_IN || device_direction == MM_SOUND_DEVICE_IO_DIRECTION_BOTH) { for (i = 0; i < AVAIL_DEVICES_MAX; i++) { @@ -2247,7 +2245,7 @@ static int __add_device_to_stream_info(sound_stream_info_s *stream_info, int dev } if (stream_info->manual_route_info.route_in_devices[j] == (unsigned int)device_id) { LOGE("failed to add device, this IN/BOTH-device[type:%s, id:%d] has been already set", device_type_str, device_id); - return MM_ERROR_POLICY_DUPLICATED; + return SOUND_MANAGER_ERROR_POLICY; } } } @@ -2267,7 +2265,7 @@ static int __add_device_to_stream_info(sound_stream_info_s *stream_info, int dev } if (stream_info->manual_route_info.route_out_devices[j] == (unsigned int)device_id) { LOGE("failed to add device, this OUT/BOTH-device[type:%s, id:%d] has been already set", device_type_str, device_id); - return MM_ERROR_POLICY_DUPLICATED; + return SOUND_MANAGER_ERROR_POLICY; } } } @@ -2275,10 +2273,10 @@ static int __add_device_to_stream_info(sound_stream_info_s *stream_info, int dev if (!added_successfully) { LOGE("failed to add device, not supported device[type:%s, id:%d]", device_type_str, device_id); - return MM_ERROR_POLICY_INTERNAL; + return SOUND_MANAGER_ERROR_POLICY; } - return MM_ERROR_NONE; + return SOUND_MANAGER_ERROR_NONE; } static int __remove_device_from_stream_info(sound_stream_info_s *stream_info, int device_id, mm_sound_device_io_direction_e device_direction, char *device_type_str) @@ -2286,8 +2284,8 @@ static int __remove_device_from_stream_info(sound_stream_info_s *stream_info, in int i, j; bool removed_successfully = false; - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); - SM_NULL_ARG_CHECK_FOR_PRIV(device_type_str); + SM_ARG_CHECK(stream_info); + SM_ARG_CHECK(device_type_str); if (device_direction == MM_SOUND_DEVICE_IO_DIRECTION_IN || device_direction == MM_SOUND_DEVICE_IO_DIRECTION_BOTH) { for (i = 0; i < AVAIL_DEVICES_MAX; i++) { @@ -2324,15 +2322,16 @@ static int __remove_device_from_stream_info(sound_stream_info_s *stream_info, in if (!removed_successfully) { LOGE("failed to remove device, could not find this device[type:%s, id:%d]", device_type_str, device_id); - return MM_ERROR_INVALID_ARGUMENT; + return SOUND_MANAGER_ERROR_INVALID_PARAMETER; } - return MM_ERROR_NONE; + return SOUND_MANAGER_ERROR_NONE; } static int __is_available_device(sound_stream_info_s *stream_info, sound_device_h device, bool *available) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; int i = 0; mm_sound_device_type_e mm_sound_device_type; sound_device_type_e device_type; @@ -2341,17 +2340,17 @@ static int __is_available_device(sound_stream_info_s *stream_info, sound_device_ mm_sound_device_io_direction_e device_direction; bool found = false; - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); - SM_INSTANCE_CHECK_FOR_PRIV(device); + SM_ARG_CHECK(stream_info); + SM_ARG_CHECK(device); - if ((ret = mm_sound_get_device_type(device, &mm_sound_device_type))) - return ret; + if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type))) + return _convert_sound_manager_error_code(__func__, mm_ret); if ((ret = _convert_device_type(mm_sound_device_type, &device_type))) return ret; if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str))) return ret; - if ((ret = mm_sound_get_device_io_direction(device, &device_direction))) - return ret; + if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction))) + return _convert_sound_manager_error_code(__func__, mm_ret); if (device_direction & MM_SOUND_DEVICE_IO_DIRECTION_OUT) { for (i = 0; i < AVAIL_DEVICES_MAX; i++) { @@ -2363,7 +2362,7 @@ static int __is_available_device(sound_stream_info_s *stream_info, sound_device_ if (!found) { LOGE("[OUT] this device(%s) is not available for this stream_info(%s)", device_type_str, stream_info->stream_type); *available = false; - return MM_ERROR_NONE; + return ret; } } @@ -2378,89 +2377,91 @@ static int __is_available_device(sound_stream_info_s *stream_info, sound_device_ if (!found) { LOGE("[IN] this device(%s) is not available for this stream_info(%s)", device_type_str, stream_info->stream_type); *available = false; - return MM_ERROR_NONE; + return ret; } } *available = true; - return MM_ERROR_NONE; + return ret; } int _add_device_for_stream_routing(sound_stream_info_s *stream_info, sound_device_h device) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; char *device_type_str = NULL; int device_id = 0; mm_sound_device_type_e mm_sound_device_type; mm_sound_device_io_direction_e device_direction; sound_device_type_e device_type; - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); - SM_NULL_ARG_CHECK_FOR_PRIV(device); + SM_ARG_CHECK(stream_info); + SM_ARG_CHECK(device); if ((ret = __check_manual_route_type(stream_info))) return ret; - if ((ret = mm_sound_get_device_id(device, &device_id))) - return ret; - if ((ret = mm_sound_get_device_type(device, &mm_sound_device_type))) - return ret; + if ((mm_ret = mm_sound_get_device_id(device, &device_id))) + return _convert_sound_manager_error_code(__func__, mm_ret); + if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type))) + return _convert_sound_manager_error_code(__func__, mm_ret); if ((ret = _convert_device_type(mm_sound_device_type, &device_type))) return ret; if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str))) return ret; - if ((ret = mm_sound_get_device_io_direction(device, &device_direction))) - return ret; + if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction))) + return _convert_sound_manager_error_code(__func__, mm_ret); if ((ret = __add_device_to_stream_info(stream_info, device_id, device_direction, device_type_str))) return ret; LOGI("*** added device[type:%s, id:%d]", device_type_str, device_id); - return MM_ERROR_NONE; + return ret; } int _remove_device_for_stream_routing(sound_stream_info_s *stream_info, sound_device_h device) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; char *device_type_str = NULL; int device_id = 0; mm_sound_device_type_e mm_sound_device_type; mm_sound_device_io_direction_e device_direction; sound_device_type_e device_type; - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); - SM_NULL_ARG_CHECK_FOR_PRIV(device); + SM_ARG_CHECK(stream_info); + SM_ARG_CHECK(device); if ((ret = __check_manual_route_type(stream_info))) return ret; - if ((ret = mm_sound_get_device_id(device, &device_id))) - return ret; - if ((ret = mm_sound_get_device_type(device, &mm_sound_device_type))) - return ret; + if ((mm_ret = mm_sound_get_device_id(device, &device_id))) + return _convert_sound_manager_error_code(__func__, mm_ret); + if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type))) + return _convert_sound_manager_error_code(__func__, mm_ret); if ((ret = _convert_device_type(mm_sound_device_type, &device_type))) return ret; if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str))) return ret; - if ((ret = mm_sound_get_device_io_direction(device, &device_direction))) - return ret; + if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction))) + return _convert_sound_manager_error_code(__func__, mm_ret); if ((ret = __remove_device_from_stream_info(stream_info, device_id, device_direction, device_type_str))) return ret; LOGI("*** removed device[type:%s, id:%d]", device_type_str, device_id); - return MM_ERROR_NONE; + return ret; } int _remove_all_devices_for_stream_routing(sound_stream_info_s *stream_info) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; int i; - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); + SM_ARG_CHECK(stream_info); if ((ret = __check_manual_route_type(stream_info))) return ret; @@ -2474,33 +2475,38 @@ int _remove_all_devices_for_stream_routing(sound_stream_info_s *stream_info) LOGI("*** removed all devices"); - return MM_ERROR_NONE; + return ret; } //LCOV_EXCL_START int _add_device_id_for_stream_routing(sound_stream_info_s *stream_info, int device_id) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; char *device_type_str = NULL; mm_sound_device_type_e mm_sound_device_type; mm_sound_device_io_direction_e device_direction; sound_device_type_e device_type; MMSoundDevice_t device = NULL; - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); + SM_ARG_CHECK(stream_info); if ((ret = __check_manual_route_type(stream_info))) return ret; - if ((ret = mm_sound_get_device_by_id(device_id, &device))) - return ret; - if ((ret = mm_sound_get_device_type(device, &mm_sound_device_type))) + if ((mm_ret = mm_sound_get_device_by_id(device_id, &device))) + return _convert_sound_manager_error_code(__func__, mm_ret); + if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type))) { + ret = _convert_sound_manager_error_code(__func__, mm_ret); goto LEAVE; + } if ((ret = _convert_device_type(mm_sound_device_type, &device_type))) goto LEAVE; if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str))) goto LEAVE; - if ((ret = mm_sound_get_device_io_direction(device, &device_direction))) + if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction))) { + ret = _convert_sound_manager_error_code(__func__, mm_ret); goto LEAVE; + } if ((ret = __add_device_to_stream_info(stream_info, device_id, device_direction, device_type_str))) goto LEAVE; @@ -2515,28 +2521,33 @@ LEAVE: int _remove_device_id_for_stream_routing(sound_stream_info_s *stream_info, int device_id) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; char *device_type_str = NULL; mm_sound_device_type_e mm_sound_device_type; mm_sound_device_io_direction_e device_direction; sound_device_type_e device_type; MMSoundDevice_t device = NULL; - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); + SM_ARG_CHECK(stream_info); if ((ret = __check_manual_route_type(stream_info))) return ret; - if ((ret = mm_sound_get_device_by_id(device_id, &device))) - return ret; - if ((ret = mm_sound_get_device_type(device, &mm_sound_device_type))) + if ((mm_ret = mm_sound_get_device_by_id(device_id, &device))) + return _convert_sound_manager_error_code(__func__, mm_ret); + if ((mm_ret = mm_sound_get_device_type(device, &mm_sound_device_type))) { + ret = _convert_sound_manager_error_code(__func__, mm_ret); goto LEAVE; + } if ((ret = _convert_device_type(mm_sound_device_type, &device_type))) goto LEAVE; if ((ret = _convert_device_type_enum_to_str(device_type, &device_type_str))) goto LEAVE; - if ((ret = mm_sound_get_device_io_direction(device, &device_direction))) + if ((mm_ret = mm_sound_get_device_io_direction(device, &device_direction))) { + ret = _convert_sound_manager_error_code(__func__, mm_ret); goto LEAVE; + } if ((ret = __remove_device_from_stream_info(stream_info, device_id, device_direction, device_type_str))) goto LEAVE; @@ -2553,14 +2564,14 @@ int _apply_stream_routing(sound_stream_info_s *stream_info) { int i = 0; - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); + SM_ARG_CHECK(stream_info); if (stream_info->stream_conf_info.route_type != STREAM_ROUTE_TYPE_MANUAL && stream_info->stream_conf_info.route_type != STREAM_ROUTE_TYPE_MANUAL_EXT) { LOGE("route type is not manual or manual-ext");//LCOV_EXCL_LINE /* Differ from others, it uses SOUND_INTERNAL error. * ACR process is required prior to changing error value. */ - return MM_ERROR_SOUND_INTERNAL;//LCOV_EXCL_LINE + return SOUND_MANAGER_ERROR_INTERNAL;//LCOV_EXCL_LINE } for (i = 0; i < AVAIL_DEVICES_MAX; i++) { @@ -2569,7 +2580,7 @@ int _apply_stream_routing(sound_stream_info_s *stream_info) return _set_manual_route_info(stream_info->pa_info.index, &stream_info->manual_route_info); } - return MM_ERROR_SOUND_INVALID_STATE; + return SOUND_MANAGER_ERROR_INVALID_STATE; } //LCOV_EXCL_START @@ -2979,7 +2990,7 @@ LEAVE: static int __invoke_ipc_set_preferred_device_id(sound_stream_info_s *stream_info, int device_id, sound_device_io_direction_e io_direction, sound_device_io_direction_e req_direction) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; GVariant *result = NULL; GDBusConnection *conn = NULL; GError *err = NULL; @@ -2987,10 +2998,10 @@ static int __invoke_ipc_set_preferred_device_id(sound_stream_info_s *stream_info const gchar *direction_str; int i; - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); + SM_ARG_CHECK(stream_info); if ((ret = __get_dbus_connection(&conn))) - return ret; + return SOUND_MANAGER_ERROR_INTERNAL; for (i = SOUND_DEVICE_IO_DIRECTION_IN; i < SOUND_DEVICE_IO_DIRECTION_BOTH; i++) { if (device_id) { @@ -3015,7 +3026,7 @@ static int __invoke_ipc_set_preferred_device_id(sound_stream_info_s *stream_info &err); if (!result || err) { LOGE("g_dbus_connection_call_sync() for SET PREFERRED DEVICE error (%s)", err ? err->message : NULL); - ret = _convert_dbus_error(err ? err->message : NULL); + ret = _convert_sound_manager_error_code(__func__, _convert_dbus_error(err ? err->message : NULL)); if (err) g_error_free(err); if (result) @@ -3028,11 +3039,11 @@ static int __invoke_ipc_set_preferred_device_id(sound_stream_info_s *stream_info g_variant_get(result, "(&s)", &dbus_ret); LOGI("g_dbus_connection_call_sync() success, method return value is (%s)", dbus_ret); if (!strncmp("STREAM_MANAGER_RETURN_ERROR_DEVICE_NOT_FOUND", dbus_ret, strlen(dbus_ret))) - ret = MM_ERROR_INVALID_ARGUMENT; + ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER; else if (!strncmp("STREAM_MANAGER_RETURN_POLICY", dbus_ret, strlen(dbus_ret))) - ret = MM_ERROR_POLICY_INTERNAL; + ret = SOUND_MANAGER_ERROR_POLICY; else if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret))) - ret = MM_ERROR_SOUND_INTERNAL; + ret = SOUND_MANAGER_ERROR_INTERNAL; g_variant_unref(result); if (ret) @@ -3051,12 +3062,13 @@ LEAVE: int _set_preferred_device(sound_stream_info_s *stream_info, sound_device_io_direction_e direction, sound_device_h device) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; bool available = false; int device_id = 0; mm_sound_device_io_direction_e io_direction = MM_SOUND_DEVICE_IO_DIRECTION_IN; - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); + SM_ARG_CHECK(stream_info); /* allow only auto route type */ if ((ret = __check_auto_route_type(stream_info))) @@ -3068,14 +3080,14 @@ int _set_preferred_device(sound_stream_info_s *stream_info, sound_device_io_dire if ((ret = __is_available_device(stream_info, device, &available))) return ret; if (!available) - return MM_ERROR_POLICY_INTERNAL; - if ((ret = mm_sound_get_device_id(device, &device_id))) - return ret; - if ((ret = mm_sound_get_device_io_direction(device, &io_direction))) - return ret; + return SOUND_MANAGER_ERROR_POLICY; + if ((mm_ret = mm_sound_get_device_id(device, &device_id))) + return _convert_sound_manager_error_code(__func__, mm_ret); + if ((mm_ret = mm_sound_get_device_io_direction(device, &io_direction))) + return _convert_sound_manager_error_code(__func__, mm_ret); if (!(io_direction & (direction + 1)) || ((int)io_direction < (int)(direction + 1))) { LOGE("device direction(0x%x), request direction(0x%x)", io_direction, (direction + 1)); - return MM_ERROR_INVALID_ARGUMENT; + return SOUND_MANAGER_ERROR_INVALID_PARAMETER; } } @@ -3084,11 +3096,12 @@ int _set_preferred_device(sound_stream_info_s *stream_info, sound_device_io_dire int _set_preferred_device_id(sound_stream_info_s *stream_info, sound_device_io_direction_e direction, int device_id) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; + int mm_ret = MM_ERROR_NONE; bool available = false; mm_sound_device_io_direction_e io_direction = MM_SOUND_DEVICE_IO_DIRECTION_IN; - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); + SM_ARG_CHECK(stream_info); /* allow only auto route type */ if ((ret = __check_auto_route_type(stream_info))) @@ -3099,21 +3112,23 @@ int _set_preferred_device_id(sound_stream_info_s *stream_info, sound_device_io_d if (device_id) { MMSoundDevice_t device = NULL; - if ((ret = mm_sound_get_device_by_id(device_id, &device))) { + if ((mm_ret = mm_sound_get_device_by_id(device_id, &device))) { LOGE("failed to mm_sound_get_device_by_id()"); - return ret; + return _convert_sound_manager_error_code(__func__, mm_ret); } if ((ret = __is_available_device(stream_info, (sound_device_h)device, &available))) goto device_free; if (!available) { - ret = MM_ERROR_POLICY_INTERNAL; + ret = SOUND_MANAGER_ERROR_POLICY; goto device_free; } - if ((ret = mm_sound_get_device_io_direction(device, &io_direction))) + if ((mm_ret = mm_sound_get_device_io_direction(device, &io_direction))) { + ret = _convert_sound_manager_error_code(__func__, mm_ret); goto device_free; + } if (!(io_direction & (direction + 1)) || ((int)io_direction < (int)(direction + 1))) { LOGE("device direction(0x%x), request direction(0x%x)", io_direction, (direction + 1)); - ret = MM_ERROR_INVALID_ARGUMENT; + ret = SOUND_MANAGER_ERROR_INVALID_PARAMETER; } device_free: mm_sound_free_device(device); @@ -3126,7 +3141,7 @@ device_free: int _get_preferred_device(sound_stream_info_s *stream_info, int *in_device_id, int *out_device_id) { - int ret = MM_ERROR_NONE; + int ret = SOUND_MANAGER_ERROR_NONE; GDBusConnection *conn = NULL; GError *err = NULL; GVariant *result = NULL; @@ -3134,10 +3149,10 @@ int _get_preferred_device(sound_stream_info_s *stream_info, int *in_device_id, i unsigned int _in_device_id; unsigned int _out_device_id; - SM_INSTANCE_CHECK_FOR_PRIV(stream_info); + SM_ARG_CHECK(stream_info); if ((ret = __get_dbus_connection(&conn))) - return ret; + return SOUND_MANAGER_ERROR_INTERNAL; result = g_dbus_connection_call_sync(conn, PA_BUS_NAME, @@ -3152,7 +3167,7 @@ int _get_preferred_device(sound_stream_info_s *stream_info, int *in_device_id, i &err); if (!result || err) { LOGE("g_dbus_connection_call_sync() for GET_STREAM_PREFERRED_DEVICE error"); - ret = _convert_dbus_error(err ? err->message : NULL); + ret = _convert_sound_manager_error_code(__func__, _convert_dbus_error(err ? err->message : NULL)); if (err) g_error_free(err); goto LEAVE; @@ -3166,7 +3181,7 @@ int _get_preferred_device(sound_stream_info_s *stream_info, int *in_device_id, i if (in_device_id) { if (stream_info->preferred_device_info.in != _in_device_id) { LOGE("mismatching id [prev: %d, curr: %d]", stream_info->preferred_device_info.in, _in_device_id); - ret = MM_ERROR_SOUND_INTERNAL; + ret = SOUND_MANAGER_ERROR_INTERNAL; } else { *in_device_id = _in_device_id; LOGI("preferred device id[in:%d]", *in_device_id); @@ -3175,14 +3190,14 @@ int _get_preferred_device(sound_stream_info_s *stream_info, int *in_device_id, i if (out_device_id) { if (stream_info->preferred_device_info.out != _out_device_id) { LOGE("mismatching id [prev: %d, curr: %d]", stream_info->preferred_device_info.out, _out_device_id); - ret = MM_ERROR_SOUND_INTERNAL; + ret = SOUND_MANAGER_ERROR_INTERNAL; } else { *out_device_id = _out_device_id; LOGI("preferred device id[out:%d]", *out_device_id); } } } else { - ret = MM_ERROR_SOUND_INTERNAL; + ret = SOUND_MANAGER_ERROR_INTERNAL; } LEAVE: