Fix abort case in CAudioSessionHandler::unregisterSound() and revise error. 01/90801/1 accepted/tizen/3.0/common/20161114.105149 accepted/tizen/3.0/ivi/20161028.123026 accepted/tizen/3.0/mobile/20161015.032301 accepted/tizen/3.0/mobile/20161028.122310 accepted/tizen/3.0/tv/20161016.003428 accepted/tizen/3.0/tv/20161028.122616 accepted/tizen/3.0/wearable/20161015.080335 accepted/tizen/3.0/wearable/20161028.122822 accepted/tizen/common/20161005.165516 accepted/tizen/ivi/20161007.003937 accepted/tizen/mobile/20161007.003732 accepted/tizen/tv/20161007.003827 accepted/tizen/wearable/20161007.003904 submit/tizen/20161005.055916 submit/tizen_3.0/20161028.062323 submit/tizen_3.0/20161028.082323 submit/tizen_3.0_common/20161104.104000 submit/tizen_3.0_mobile/20161015.000000 submit/tizen_3.0_tv/20161015.000000 submit/tizen_3.0_wearable/20161015.000000
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 4 Oct 2016 08:49:04 +0000 (17:49 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 4 Oct 2016 09:06:44 +0000 (18:06 +0900)
Since the __mId member can be initial value(-1) when this function is called from onSignal() in
CAudioIO.cpp, it should not throw an error even if the value is under 0.

[Version] 0.3.44
[Profile] Common
[Issue Type] Bug Fix

Change-Id: I02548ee2df164bd253bb9744537b1c490ff5b244
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-audio-io.spec
src/cpp/CAudioSessionHandler.cpp

index 83f869f..30ee55e 100644 (file)
@@ -1,6 +1,6 @@
 Name:           capi-media-audio-io
 Summary:        An Audio Input & Audio Output library in Tizen Native API
-Version:        0.3.43
+Version:        0.3.44
 Release:        0
 Group:          Multimedia/API
 License:        Apache-2.0
index 382a07f..d8fe72a 100644 (file)
@@ -221,7 +221,7 @@ void CAudioSessionHandler::initialize() throw(CAudioError) {
             unsigned int subscribe_id;
             int errorCode = mm_sound_subscribe_signal(MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS, &subscribe_id, __sound_pcm_signal_cb, static_cast<void*>(this));
             if (errorCode != MM_ERROR_NONE) {
-                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_POLICY_BLOCKED, "Failed mm_sound_subscribe_signal() err:0x%x", errorCode);
+                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed mm_sound_subscribe_signal() err:0x%x", errorCode);
             }
 
             __mSubscribeId = (int)subscribe_id;
@@ -360,7 +360,7 @@ void CAudioSessionHandler::registerSound() throw(CAudioError) {
 
             errorCode = mm_sound_focus_get_id(&__mId);
             if (errorCode != MM_ERROR_NONE) {
-                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_POLICY_BLOCKED, "Failed mm_sound_focus_get_id() err:0x%x", errorCode);
+                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed mm_sound_focus_get_id() err:0x%x", errorCode);
             }
 
             // Register focus callback
@@ -370,7 +370,7 @@ void CAudioSessionHandler::registerSound() throw(CAudioError) {
                                                 __sound_pcm_focus_cb,
                                                 static_cast<void*>(this));
             if (errorCode != MM_ERROR_NONE) {
-                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_POLICY_BLOCKED, "Failed mm_sound_register_focus_for_session() err:0x%x", errorCode);
+                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed mm_sound_register_focus_for_session() err:0x%x", errorCode);
             }
 
             __focusIdCountInc();
@@ -380,7 +380,7 @@ void CAudioSessionHandler::registerSound() throw(CAudioError) {
             // Register focus watch callback
             errorCode = mm_sound_set_focus_watch_callback_for_session(getpid(), FOCUS_FOR_BOTH, __sound_pcm_focus_watch_cb, static_cast<void*>(this), &__mId);
             if (errorCode < 0) {
-                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_POLICY_BLOCKED, "Failed mm_sound_set_focus_watch_callback_for_session() err:0x%x", errorCode);
+                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed mm_sound_set_focus_watch_callback_for_session() err:0x%x", errorCode);
             }
 
             __focusIdCountInc();
@@ -395,18 +395,14 @@ void CAudioSessionHandler::unregisterSound() throw(CAudioError) {
         THROW_ERROR_MSG(CAudioError::EError::ERROR_NOT_INITIALIZED, "Doesn't initialize CAudioSessionHandler");
     }
 
-    if (__mUseFocus == true) {
-        if (__mId < 0) {
-            THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_POLICY_BLOCKED, "Did not register [id:%d]", __mId);
-        }
-
+    if (__mUseFocus == true && __mId >= 0) {
         int errorCode = 0;
 
         if (__isFocusRequired(__mMultimediaSession, __mOptions)) {
             // Unregister focus callback
             errorCode = mm_sound_unregister_focus(__mId);
             if (errorCode != MM_ERROR_NONE) {
-                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_POLICY_BLOCKED, "Failed mm_sound_unregister_focus() err:0x%x", errorCode);
+                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed mm_sound_unregister_focus() err:0x%x", errorCode);
             }
 
             __focusIdCountDec();
@@ -417,7 +413,7 @@ void CAudioSessionHandler::unregisterSound() throw(CAudioError) {
             // Unregister focus watch callback.
             errorCode = mm_sound_unset_focus_watch_callback(__mId);
             if (errorCode < 0) {
-                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_POLICY_BLOCKED, "Failed mm_sound_unset_focus_watch_callback() err:0x%x", errorCode);
+                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed mm_sound_unset_focus_watch_callback() err:0x%x", errorCode);
             }
 
             __focusIdCountDec();
@@ -453,7 +449,7 @@ void CAudioSessionHandler::updateStop() throw(CAudioError) {
         if (__mId >= 0) {
             int ret = mm_sound_release_focus(__mId, FOCUS_FOR_BOTH, "audio-io release focus");
             if (ret != MM_ERROR_NONE) {
-                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_POLICY_BLOCKED, "Failed mm_sound_release_focus() err:0x%x", ret);
+                THROW_ERROR_MSG_FORMAT(CAudioError::EError::ERROR_FAILED_OPERATION, "Failed mm_sound_release_focus() err:0x%x", ret);
             }
             AUDIO_IO_LOGD("Focus released successfully [id:%d]", __mId);
         }