From: Sangchul Lee Date: Thu, 25 Jun 2020 08:41:55 +0000 (+0900) Subject: Fix to return valid error type X-Git-Tag: submit/tizen/20200626.085752~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=56667e2b8599f9a67662c2f96f91068824ce8d00;p=platform%2Fcore%2Fapi%2Fsound-manager.git Fix to return valid error type Codes returning mm-common error type are fixed. [Version] 0.6.13 [Issue Type] Bug fix Change-Id: Ie78b573617f46cfbeefb5bf6cdc3aa08979a8872 Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-sound-manager.spec b/packaging/capi-media-sound-manager.spec index c13d102..9c5708c 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.12 +Version: 0.6.13 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/sound_manager.c b/src/sound_manager.c index 0d28bbf..d1af457 100644 --- a/src/sound_manager.c +++ b/src/sound_manager.c @@ -190,7 +190,7 @@ int sound_manager_destroy_stream_information(sound_stream_info_h stream_info) } SM_LEAVE_CRITICAL_SECTION(&stream_h->vstream_mutex); - SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_state_mutex, MM_ERROR_SOUND_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_state_mutex, SOUND_MANAGER_ERROR_INTERNAL); ret = _destroy_pa_connection_and_unregister_focus(stream_h); SM_LEAVE_CRITICAL_SECTION(&stream_h->focus_state_mutex); if (ret == SOUND_MANAGER_ERROR_NONE) @@ -333,8 +333,8 @@ int sound_manager_acquire_focus(sound_stream_info_h stream_info, sound_stream_fo } if (!is_focus_cb_thread) { - SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_cb_mutex, MM_ERROR_SOUND_INTERNAL); - SM_ENTER_CRITICAL_SECTION_WITH_UNLOCK_AND_RETURN(&stream_h->focus_state_mutex, &stream_h->focus_cb_mutex, MM_ERROR_SOUND_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_cb_mutex, SOUND_MANAGER_ERROR_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_UNLOCK_AND_RETURN(&stream_h->focus_state_mutex, &stream_h->focus_cb_mutex, SOUND_MANAGER_ERROR_INTERNAL); } else { /* If it is inside of the watch cb and if the previous request of this process has not been finished yet, * the focus state mutex could be still locked. Therefore, it returns error here. */ @@ -342,7 +342,7 @@ int sound_manager_acquire_focus(sound_stream_info_h stream_info, sound_stream_fo LOGE("It is not allowed in watch cb thread during the previous request has not been finished yet"); return _convert_sound_manager_error_code(__func__, MM_ERROR_SOUND_INVALID_OPERATION); } - SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_state_mutex, MM_ERROR_SOUND_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_state_mutex, SOUND_MANAGER_ERROR_INTERNAL); } if (stream_h->acquired_focus & focus_mask) { @@ -393,8 +393,8 @@ int sound_manager_release_focus(sound_stream_info_h stream_info, sound_stream_fo return _convert_sound_manager_error_code(__func__, ret); if (!is_focus_cb_thread) { - SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_cb_mutex, MM_ERROR_SOUND_INTERNAL); - SM_ENTER_CRITICAL_SECTION_WITH_UNLOCK_AND_RETURN(&stream_h->focus_state_mutex, &stream_h->focus_cb_mutex, MM_ERROR_SOUND_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_cb_mutex, SOUND_MANAGER_ERROR_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_UNLOCK_AND_RETURN(&stream_h->focus_state_mutex, &stream_h->focus_cb_mutex, SOUND_MANAGER_ERROR_INTERNAL); } else { /* If it is inside of the watch cb and if the previous request of this process has not been finished yet, * the focus state mutex could be still locked. Therefore, it returns error here. */ @@ -402,7 +402,7 @@ int sound_manager_release_focus(sound_stream_info_h stream_info, sound_stream_fo LOGE("It is not allowed in watch cb thread during the previous request has not been finished yet"); return _convert_sound_manager_error_code(__func__, MM_ERROR_SOUND_INVALID_OPERATION); } - SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_state_mutex, MM_ERROR_SOUND_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_state_mutex, SOUND_MANAGER_ERROR_INTERNAL); } if (!(stream_h->acquired_focus & focus_mask)) { @@ -464,8 +464,8 @@ int sound_manager_acquire_focus_all(sound_stream_info_h stream_info, int sound_b } if (!is_focus_cb_thread) { - SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_cb_mutex, MM_ERROR_SOUND_INTERNAL); - SM_ENTER_CRITICAL_SECTION_WITH_UNLOCK_AND_RETURN(&stream_h->focus_state_mutex, &stream_h->focus_cb_mutex, MM_ERROR_SOUND_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_cb_mutex, SOUND_MANAGER_ERROR_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_UNLOCK_AND_RETURN(&stream_h->focus_state_mutex, &stream_h->focus_cb_mutex, SOUND_MANAGER_ERROR_INTERNAL); } else { /* If it is inside of the watch cb and if the previous request of this process has not been finished yet, * the focus state mutex could be still locked. Therefore, it returns error here. */ @@ -473,7 +473,7 @@ int sound_manager_acquire_focus_all(sound_stream_info_h stream_info, int sound_b LOGE("It is not allowed in watch cb thread during the previous request has not been finished yet"); return _convert_sound_manager_error_code(__func__, MM_ERROR_SOUND_INVALID_OPERATION); } - SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_state_mutex, MM_ERROR_SOUND_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_state_mutex, SOUND_MANAGER_ERROR_INTERNAL); } if (is_focus_cb_thread && (stream_h->prev_acquired_focus > stream_h->acquired_focus)) { @@ -523,8 +523,8 @@ int sound_manager_release_focus_all(sound_stream_info_h stream_info, int sound_b return _convert_sound_manager_error_code(__func__, ret); if (!is_focus_cb_thread) { - SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_cb_mutex, MM_ERROR_SOUND_INTERNAL); - SM_ENTER_CRITICAL_SECTION_WITH_UNLOCK_AND_RETURN(&stream_h->focus_state_mutex, &stream_h->focus_cb_mutex, MM_ERROR_SOUND_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_cb_mutex, SOUND_MANAGER_ERROR_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_UNLOCK_AND_RETURN(&stream_h->focus_state_mutex, &stream_h->focus_cb_mutex, SOUND_MANAGER_ERROR_INTERNAL); } else { /* If it is inside of the watch cb and if the previous request of this process has not been finished yet, * the focus state mutex could be still locked. Therefore, it returns error here. */ @@ -532,7 +532,7 @@ int sound_manager_release_focus_all(sound_stream_info_h stream_info, int sound_b LOGE("It is not allowed in watch cb thread during the previous request has not been finished yet"); return _convert_sound_manager_error_code(__func__, MM_ERROR_SOUND_INVALID_OPERATION); } - SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_state_mutex, MM_ERROR_SOUND_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_state_mutex, SOUND_MANAGER_ERROR_INTERNAL); } if (is_focus_cb_thread && (stream_h->prev_acquired_focus < stream_h->acquired_focus)) { @@ -576,7 +576,7 @@ int sound_manager_get_focus_state(sound_stream_info_h stream_info, sound_stream_ LOGI(">> enter"); - SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_state_mutex, MM_ERROR_SOUND_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_RETURN(&stream_h->focus_state_mutex, SOUND_MANAGER_ERROR_INTERNAL); if (state_for_playback) *state_for_playback = ((stream_h->acquired_focus & SOUND_STREAM_FOCUS_FOR_PLAYBACK) ? (SOUND_STREAM_FOCUS_STATE_ACQUIRED) : (SOUND_STREAM_FOCUS_STATE_RELEASED)); diff --git a/src/sound_manager_internal.c b/src/sound_manager_internal.c index eb6054f..7780dbd 100644 --- a/src/sound_manager_internal.c +++ b/src/sound_manager_internal.c @@ -558,7 +558,7 @@ int sound_manager_set_virtual_stream_volume(virtual_sound_stream_h virtual_strea vstream_mutex = &vstream_h->stream_info->vstream_mutex; - SM_ENTER_CRITICAL_SECTION_WITH_RETURN(vstream_mutex, MM_ERROR_SOUND_INTERNAL); + SM_ENTER_CRITICAL_SECTION_WITH_RETURN(vstream_mutex, SOUND_MANAGER_ERROR_INTERNAL); ret = _set_virtual_stream_volume(vstream_h, ratio);