Revise logs in sound_manager_internal.c 63/238063/2 submit/tizen/20200709.075529
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 8 Jul 2020 05:39:02 +0000 (14:39 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 8 Jul 2020 07:40:21 +0000 (16:40 +0900)
Logs related to function arguments are added to each function.

[Version] 0.6.24
[Issue Type] Log

Change-Id: Ieddfca9848195338e22c60b1cb0dc306fe7b276a
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-sound-manager.spec
src/sound_manager_internal.c

index c9c964c..f86053f 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.6.23
+Version:    0.6.24
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index a5a40e4..2729223 100644 (file)
@@ -27,11 +27,11 @@ int sound_manager_get_max_master_volume(int *max_level)
 
        SM_ARG_CHECK(max_level);
 
-       LOGI(">> enter");
-
        ret = _get_volume_max_level(DIRECTION_OUT_STR, SOUND_TYPE_MASTER_STR, &volume_level);
-       if (ret == SOUND_MANAGER_ERROR_NONE)
+       if (ret == SOUND_MANAGER_ERROR_NONE) {
                *max_level = (int)volume_level;
+               LOGI("max_level[%d]", *max_level);
+       }
 
        return ret;
 }
@@ -40,10 +40,12 @@ int sound_manager_set_master_volume(int level)
 {
        int ret = SOUND_MANAGER_ERROR_NONE;
 
-       LOGI(">> enter");
+       LOGI("level[%d]", level);
 
        ret = _set_volume_level(DIRECTION_OUT_STR, SOUND_TYPE_MASTER_STR, (unsigned int)level);
 
+       LOGI("ret[0x%x]", ret);
+
        return ret;
 }
 
@@ -54,11 +56,13 @@ int sound_manager_get_master_volume(int *level)
 
        SM_ARG_CHECK(level);
 
-       LOGI(">> enter");
-
        ret = _get_volume_level(DIRECTION_OUT_STR, SOUND_TYPE_MASTER_STR, &volume_level);
-       if (ret == SOUND_MANAGER_ERROR_NONE)
+       if (ret == SOUND_MANAGER_ERROR_NONE) {
                *level = (int)volume_level;
+               LOGI("level[%d]", *level);
+       }
+
+       LOGI("ret[0x%x]", ret);
 
        return ret;
 }
@@ -70,8 +74,9 @@ int sound_manager_set_mute(sound_type_e type, bool mute)
 
        SM_ARG_CHECK(type < SOUND_TYPE_NUM);
 
+       LOGI("type[%d] mute[%d]", type, mute);
+
        ret = mm_sound_set_mute(type, mute);
-       LOGI("type=%d, mute=%d", type, mute);
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
@@ -83,8 +88,11 @@ int sound_manager_get_mute(sound_type_e type, bool *muted)
        SM_ARG_CHECK(type < SOUND_TYPE_NUM);
        SM_ARG_CHECK(muted);
 
+       LOGI("type[%d]", type);
+
        ret = mm_sound_get_mute(type, muted);
-       LOGI("type=%d, mute=%d", type, *muted);
+
+       LOGI("muted[%d]", *muted);
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
@@ -98,13 +106,19 @@ int sound_manager_get_max_volume_internal(sound_type_internal_e type, int *max)
        SM_ARG_CHECK(max);
        SM_ARG_CHECK(type < SOUND_TYPE_INTERNAL_NUM);
 
+       LOGI("type[%d]", type);
+
        ret = _convert_sound_type_for_internal(type, &volume_type);
        if (ret == SOUND_MANAGER_ERROR_NONE) {
                ret = _get_volume_max_level(DIRECTION_OUT_STR, volume_type, &max_level);
-               if (ret == SOUND_MANAGER_ERROR_NONE)
+               if (ret == SOUND_MANAGER_ERROR_NONE) {
                        *max = (int)max_level -1;       /* actual volume step can be max step - 1 */
+                       LOGI("volume_type[%s] max_level[%d]", volume_type, *max);
+               }
        }
 
+       LOGI("ret[0x%x]", ret);
+
        return ret;
 }
 
@@ -115,8 +129,9 @@ int sound_manager_set_volume_internal(sound_type_internal_e type, int level)
        SM_ARG_CHECK(type < SOUND_TYPE_INTERNAL_NUM);
        SM_ARG_CHECK(level >= 0);
 
+       LOGI("type[%d] level[%d]", type, level);
+
        ret = mm_sound_volume_set_value_internal(type, level);
-       LOGI("type=%d, level=%d", type, level);
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
@@ -129,11 +144,13 @@ int sound_manager_get_volume_internal(sound_type_internal_e type, int *level)
        SM_ARG_CHECK(type < SOUND_TYPE_INTERNAL_NUM);
        SM_ARG_CHECK(level);
 
+       LOGI("type[%d]", type);
+
        ret = mm_sound_volume_get_value_internal(type, &uvolume);
-       if (ret == MM_ERROR_NONE)
+       if (ret == MM_ERROR_NONE) {
                *level = uvolume;
-
-       LOGI("type=%d, level=%d", type, *level);
+               LOGI("level[%d]", *level);
+       }
 
        return _convert_sound_manager_error_code(__func__, ret);
 }
@@ -150,9 +167,11 @@ int sound_manager_get_current_sound_type_internal(sound_type_internal_e *type)
        if (ret == SOUND_MANAGER_ERROR_NONE) {
                ret = _convert_sound_type_to_enum_for_internal((const char*)volume_type, type);
                if (ret == SOUND_MANAGER_ERROR_NONE)
-                       LOGI("type=%d", *type);
+                       LOGI("volume_type[%s] type[%d]", volume_type, *type);
        }
 
+       LOGI("ret[0x%x]", ret);
+
        return ret;
 }
 
@@ -163,8 +182,12 @@ int sound_manager_add_volume_changed_cb_internal(sound_manager_volume_changed_cb
        SM_ARG_CHECK(callback);
        SM_ARG_CHECK(id);
 
+       LOGI("callback[%p] user_data[%p]", callback, user_data);
+
        ret = mm_sound_add_volume_changed_callback_internal((mm_sound_volume_changed_cb_internal)callback, user_data, (unsigned int*)id);
 
+       LOGI("id[%d]", *id);
+
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
@@ -174,6 +197,8 @@ int sound_manager_remove_volume_changed_cb_internal(int id)
 
        SM_ARG_CHECK(id >= 0);
 
+       LOGI("id[%d]", id);
+
        ret = mm_sound_remove_volume_changed_callback_internal(id);
 
        return _convert_sound_manager_error_code(__func__, ret);
@@ -185,7 +210,7 @@ int sound_manager_create_stream_information_internal(sound_stream_type_internal_
 
        SM_ARG_CHECK(stream_info);
 
-       LOGI(">> enter");
+       LOGI("stream_type[%d] callback[%p] user_data[%p]", stream_type, callback, user_data);
 
        sound_stream_info_s *stream_h = malloc(sizeof(sound_stream_info_s));
        if (!stream_h) {
@@ -198,10 +223,10 @@ int sound_manager_create_stream_information_internal(sound_stream_type_internal_
        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) {
+               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);
+                       LOGI("stream_info[%p, type:%s] pa_index[%u] focus_id[%d]",
+                               stream_info, stream_h->stream_type, stream_h->pa_info.index, stream_h->focus_id);
                }
        }
 
@@ -209,6 +234,8 @@ LEAVE:
        if (ret)
                SM_SAFE_FREE(stream_h);
 
+       LOGI("ret[0x%x]", ret);
+
        return ret;
 }
 
@@ -219,7 +246,7 @@ int sound_manager_set_stream_routing_option(sound_stream_info_h stream_info, con
        SM_ARG_CHECK(stream_h);
        SM_ARG_CHECK(name);
 
-       LOGI(">> enter");
+       LOGI("stream_info[%p] name[%s] value[%d]", stream_info, name, value);
 
        return _set_route_option(stream_h->pa_info.index, name, value);
 }
@@ -276,7 +303,7 @@ int sound_manager_add_device_id_for_stream_routing(sound_stream_info_h stream_in
 {
        SM_ARG_CHECK(stream_info);
 
-       LOGI(">> enter");
+       LOGI("stream_info[%p] device_id[%d]", stream_info, device_id);
 
        return _add_device_id_for_stream_routing((sound_stream_info_s*)stream_info, device_id);
 }
@@ -285,7 +312,7 @@ int sound_manager_remove_device_id_for_stream_routing(sound_stream_info_h stream
 {
        SM_ARG_CHECK(stream_info);
 
-       LOGI(">> enter");
+       LOGI("stream_info[%p] device_id[%d]", stream_info, device_id);
 
        return _remove_device_id_for_stream_routing((sound_stream_info_s*)stream_info, device_id);
 }
@@ -294,6 +321,8 @@ int sound_manager_set_stream_preferred_device_id(sound_stream_info_h stream_info
 {
        SM_ARG_CHECK(stream_info);
 
+       LOGI("stream_info[%p] io_direction[%d] device_id[%d]", stream_info, io_direction, device_id);
+
        return _set_preferred_device_id((sound_stream_info_s*)stream_info, io_direction, device_id);
 }
 
@@ -302,7 +331,9 @@ int sound_manager_get_device_state_by_id(int device_id, sound_device_state_e *st
        int ret = MM_ERROR_NONE;
        MMSoundDevice_t device = NULL;
 
-       LOGI(">> enter");
+       SM_ARG_CHECK(state);
+
+       LOGI("device_id[%d]", device_id);
 
        if ((ret = mm_sound_get_device_by_id(device_id, &device)) != MM_ERROR_NONE) {
                LOGE("failed to mm_sound_get_device_by_id()");
@@ -311,6 +342,8 @@ int sound_manager_get_device_state_by_id(int device_id, sound_device_state_e *st
 
        ret = mm_sound_get_device_state(device, (mm_sound_device_state_e*)state);
 
+       LOGI("state[%d]", *state);
+
        mm_sound_free_device(device);
 LEAVE:
        return _convert_sound_manager_error_code(__func__, ret);
@@ -320,7 +353,7 @@ int sound_manager_is_device_running_by_id(int device_id, bool *is_running)
 {
        SM_ARG_CHECK(is_running);
 
-       LOGI(">> enter");
+       LOGI("device_id[%d]", device_id);
 
        return _is_device_running_by_id(device_id, is_running);
 }
@@ -330,14 +363,14 @@ int sound_manager_get_supported_sample_formats_by_id(int device_id, sound_sample
        SM_ARG_CHECK(formats);
        SM_ARG_CHECK(num_of_elems);
 
-       LOGI(">> enter");
+       LOGI("device_id[%d]", device_id);
 
        return _get_supported_sample_formats(device_id, formats, num_of_elems);
 }
 
 int sound_manager_set_sample_format_by_id(int device_id, sound_sample_format_e format)
 {
-       LOGI(">> enter");
+       LOGI("device_id[%d] format[%d]", device_id, format);
 
        return _set_sample_format(device_id, format);
 }
@@ -346,7 +379,7 @@ int sound_manager_get_sample_format_by_id(int device_id, sound_sample_format_e *
 {
        SM_ARG_CHECK(format);
 
-       LOGI(">> enter");
+       LOGI("device_id[%d]", device_id);
 
        return _get_sample_format(device_id, format);
 }
@@ -356,14 +389,14 @@ int sound_manager_get_supported_sample_rates_by_id(int device_id, sound_sample_r
        SM_ARG_CHECK(rates);
        SM_ARG_CHECK(num_of_elems);
 
-       LOGI(">> enter");
+       LOGI("device_id[%d]", device_id);
 
        return _get_supported_sample_rates(device_id, rates, num_of_elems);
 }
 
 int sound_manager_set_sample_rate_by_id(int device_id, sound_sample_rate_e rate)
 {
-       LOGI(">> enter");
+       LOGI("device_id[%d] rate[%d]", device_id, rate);
 
        return _set_sample_rate(device_id, rate);
 }
@@ -372,14 +405,14 @@ int sound_manager_get_sample_rate_by_id(int device_id, sound_sample_rate_e *rate
 {
        SM_ARG_CHECK(rate);
 
-       LOGI(">> enter");
+       LOGI("device_id[%d]", device_id);
 
        return _get_sample_rate(device_id, rate);
 }
 
 int sound_manager_set_avoid_resampling_by_id(int device_id, bool enable)
 {
-       LOGI(">> enter");
+       LOGI("device_id[%d] enable[%d]", device_id, enable);
 
        return _set_avoid_resampling(device_id, enable);
 }
@@ -388,14 +421,14 @@ int sound_manager_get_avoid_resampling_by_id(int device_id, bool *enabled)
 {
        SM_ARG_CHECK(enabled);
 
-       LOGI(">> enter");
+       LOGI("device_id[%d]", device_id);
 
        return _get_avoid_resampling(device_id, enabled);
 }
 
 int sound_manager_set_media_stream_only_by_id(int device_id, bool enable)
 {
-       LOGI(">> enter");
+       LOGI("device_id[%d] enable[%d]", device_id, enable);
 
        return _set_media_stream_only(device_id, enable);
 }
@@ -404,7 +437,7 @@ int sound_manager_get_media_stream_only_by_id(int device_id, bool *enabled)
 {
        SM_ARG_CHECK(enabled);
 
-       LOGI(">> enter");
+       LOGI("device_id[%d]", device_id);
 
        return _get_media_stream_only(device_id, enabled);
 }
@@ -416,23 +449,28 @@ int sound_manager_create_virtual_stream(sound_stream_info_h stream_info, virtual
        sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
 
        SM_ARG_CHECK(stream_h);
+       SM_ARG_CHECK(virtual_stream);
 
-       LOGI(">> enter");
+       LOGI("stream_info[%p, type:%s]", stream_info, stream_h->stream_type);
 
        SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->vstream_mutex, SOUND_MANAGER_ERROR_INTERNAL);
 
        if (stream_h->vstream) {
-               LOGE("virtual stream was already created. stream_h(%p), vstream(%p)", stream_h, stream_h->vstream);
+               LOGE("virtual stream was already created. vstream(%p)", stream_h->vstream);
                SM_LEAVE_CRITICAL_SECTION(&stream_h->vstream_mutex);
                return SOUND_MANAGER_ERROR_INVALID_OPERATION;
        }
 
        ret = _create_virtual_stream(stream_h, &vstream_h);
-       if (ret == SOUND_MANAGER_ERROR_NONE)
+       if (ret == SOUND_MANAGER_ERROR_NONE) {
                *virtual_stream = stream_h->vstream = (virtual_sound_stream_h)vstream_h;
+               LOGI("virtual_stream[%p]", *virtual_stream);
+       }
 
        SM_LEAVE_CRITICAL_SECTION(&stream_h->vstream_mutex);
 
+       LOGI("ret[0x%x]", ret);
+
        return ret;
 }
 
@@ -445,7 +483,7 @@ int sound_manager_destroy_virtual_stream(virtual_sound_stream_h virtual_stream)
        SM_ARG_CHECK(vstream_h);
        SM_ARG_CHECK(vstream_h->stream_info);
 
-       LOGI(">> enter");
+       LOGI("virtual_stream[%p] stream_type[%s]", virtual_stream, vstream_h->stream_info->stream_type);
 
        vstream_mutex = &vstream_h->stream_info->vstream_mutex;
 
@@ -455,6 +493,8 @@ int sound_manager_destroy_virtual_stream(virtual_sound_stream_h virtual_stream)
 
        SM_LEAVE_CRITICAL_SECTION(vstream_mutex);
 
+       LOGI("ret[0x%x]", ret);
+
        return ret;
 }
 
@@ -467,7 +507,7 @@ int sound_manager_start_virtual_stream(virtual_sound_stream_h virtual_stream)
        SM_ARG_CHECK(vstream_h);
        SM_ARG_CHECK(vstream_h->stream_info);
 
-       LOGI(">> enter");
+       LOGI("virtual_stream[%p] stream_type[%s]", virtual_stream, vstream_h->stream_info->stream_type);
 
        vstream_mutex = &vstream_h->stream_info->vstream_mutex;
 
@@ -477,6 +517,8 @@ int sound_manager_start_virtual_stream(virtual_sound_stream_h virtual_stream)
 
        SM_LEAVE_CRITICAL_SECTION(vstream_mutex);
 
+       LOGI("ret[0x%x]", ret);
+
        return ret;
 }
 
@@ -489,7 +531,7 @@ int sound_manager_stop_virtual_stream(virtual_sound_stream_h virtual_stream)
        SM_ARG_CHECK(vstream_h);
        SM_ARG_CHECK(vstream_h->stream_info);
 
-       LOGI(">> enter");
+       LOGI("virtual_stream[%p] stream_type[%s]", virtual_stream, vstream_h->stream_info->stream_type);
 
        vstream_mutex = &vstream_h->stream_info->vstream_mutex;
 
@@ -499,6 +541,8 @@ int sound_manager_stop_virtual_stream(virtual_sound_stream_h virtual_stream)
 
        SM_LEAVE_CRITICAL_SECTION(vstream_mutex);
 
+       LOGI("ret[0x%x]", ret);
+
        return ret;
 }
 
@@ -511,7 +555,7 @@ int sound_manager_set_virtual_stream_volume(virtual_sound_stream_h virtual_strea
        SM_ARG_CHECK(vstream_h);
        SM_ARG_CHECK(vstream_h->stream_info);
 
-       LOGI(">> enter");
+       LOGI("virtual_stream[%p] ratio[%lf]", virtual_stream, ratio);
 
        vstream_mutex = &vstream_h->stream_info->vstream_mutex;
 
@@ -521,6 +565,8 @@ int sound_manager_set_virtual_stream_volume(virtual_sound_stream_h virtual_strea
 
        SM_LEAVE_CRITICAL_SECTION(vstream_mutex);
 
+       LOGI("ret[0x%x]", ret);
+
        return ret;
 }
 
@@ -666,7 +712,7 @@ int sound_manager_set_filter(sound_stream_type_e stream_type, sound_filter_e fil
        char *filter_str = NULL;
        char *filter_params_str = NULL;
 
-       LOGI(">> enter");
+       LOGI("stream_type[%d] filter[%d]", stream_type, filter);
 
        if (stream_type != SOUND_STREAM_TYPE_MEDIA) {
                LOGE("Not supported stream type(%d)", stream_type);
@@ -686,13 +732,11 @@ int sound_manager_unset_filter(sound_stream_type_e stream_type)
        int ret = SOUND_MANAGER_ERROR_NONE;
        char *stream_type_str = NULL;
 
-       LOGI(">> enter");
+       LOGI("stream_type[%d]", stream_type);
 
        if ((ret = _convert_stream_type(stream_type, &stream_type_str)) != SOUND_MANAGER_ERROR_NONE)
                return ret;
 
-       LOGI("stream_type[%s]", stream_type_str);
-
        return _convert_sound_manager_error_code(__func__, mm_sound_unset_filter(stream_type_str));
 }
 
@@ -704,13 +748,13 @@ int sound_manager_set_filter_preset(sound_stream_type_e stream_type, sound_filte
        char *filter_params_str = NULL;
        char *control_str = NULL;
 
-       LOGI(">> enter");
-
        if (stream_type != SOUND_STREAM_TYPE_MEDIA) {
                LOGE("Not supported stream type(%d)", stream_type);
                return SOUND_MANAGER_ERROR_NOT_SUPPORTED;
        }
 
+       LOGI("stream_type[%d] filter[%d] preset[%d]", stream_type, filter, preset);
+
        if ((ret = _check_valid_filter_preset(filter, preset)) != SOUND_MANAGER_ERROR_NONE)
                return ret;
        if ((ret = _convert_stream_type(stream_type, &stream_type_str)) != SOUND_MANAGER_ERROR_NONE)
@@ -731,7 +775,7 @@ int sound_manager_get_device_vendor_id(sound_device_h device, int *vendor_id)
        SM_ARG_CHECK(device);
        SM_ARG_CHECK(vendor_id);
 
-       LOGI(">> enter");
+       LOGI("device[%p]", device);
 
        if ((ret = mm_sound_get_device_type(device, &type)) != MM_ERROR_NONE)
                return _convert_sound_manager_error_code(__func__, ret);
@@ -743,6 +787,8 @@ int sound_manager_get_device_vendor_id(sound_device_h device, int *vendor_id)
 
        ret = mm_sound_get_device_vendor_id(device, vendor_id);
 
+       LOGI("vendor_id[%d]", *vendor_id);
+
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
@@ -754,7 +800,7 @@ int sound_manager_get_device_product_id(sound_device_h device, int *product_id)
        SM_ARG_CHECK(device);
        SM_ARG_CHECK(product_id);
 
-       LOGI(">> enter");
+       LOGI("device[%p]", device);
 
        if ((ret = mm_sound_get_device_type(device, &type)) != MM_ERROR_NONE)
                return _convert_sound_manager_error_code(__func__, ret);
@@ -766,6 +812,8 @@ int sound_manager_get_device_product_id(sound_device_h device, int *product_id)
 
        ret = mm_sound_get_device_product_id(device, product_id);
 
+       LOGI("product_id[%d]", *product_id);
+
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
@@ -777,32 +825,36 @@ int sound_manager_is_stream_on_device_by_id(sound_stream_info_h stream_info, int
        SM_ARG_CHECK(stream_h);
        SM_ARG_CHECK(is_on);
 
-       LOGI(">> enter");
+       LOGI("stream_info[%p, type:%s] device_id[%d]", stream_info, stream_h->stream_type, device_id);
 
        ret = mm_sound_is_stream_on_device_by_id(stream_h->pa_info.index, device_id, is_on);
 
+       LOGI("is_on[%d]", *is_on);
+
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
 int sound_manager_set_acm_master_mode(bool enable)
 {
-       LOGI(">> enter");
+       LOGI("enable[%d]", enable);
 
        return _set_acm_master_mode(enable);
 }
 
 int sound_manager_get_latest_stream_pid(int stream_type, unsigned int *pid)
 {
-       SM_ARG_CHECK(pid);
        SM_ARG_CHECK(stream_type >= 0);
+       SM_ARG_CHECK(pid);
 
-       LOGI(">> enter, stream_type(0x%x)", stream_type);
+       LOGI("stream_type[0x%x]", stream_type);
 
        return _get_latest_stream_pid(stream_type, pid);
 }
 
 int sound_manager_set_stream_preemptive_device(sound_stream_type_e stream_type, sound_device_io_direction_e io_direction, int device_id)
 {
+       LOGI("stream_type[%d] io_direction[%d] device_id[%d]", stream_type, io_direction, device_id);
+
        return _set_preemptive_device(stream_type, io_direction, device_id);
 }
 
@@ -810,5 +862,7 @@ int sound_manager_get_stream_preemptive_device(sound_stream_type_e stream_type,
 {
        SM_ARG_CHECK(in_device_id || out_device_id);
 
+       LOGI("stream_type[%d]", stream_type);
+
        return _get_preemptive_device(stream_type, in_device_id, out_device_id);
 }