Add error case returning SOUND_MANAGER_ERROR_NO_DATA for sound_manager_get_sound_type API 82/54682/5 accepted/tizen/mobile/20151219.044030 accepted/tizen/tv/20151219.044458 accepted/tizen/wearable/20151219.044738 submit/tizen/20151218.084826
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 17 Dec 2015 06:44:07 +0000 (15:44 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 18 Dec 2015 08:45:01 +0000 (17:45 +0900)
In case of the stream_info made with SOUND_STREAM_TYPE_EMERGENCY, it'll return SOUND_MANAGER_ERROR_NO_DATA.
Because there is no sound_type_e matched to this stream_info.

[Version] Release 0.3.36
[profile] Common
[Issue Type] modification

Change-Id: I1eead535cfe934a3d0b5a533a27b498db6857bc7
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/sound_manager.h
packaging/capi-media-sound-manager.spec
src/sound_manager.c
test/sound_manager_test.c

index 7cc7a1b6dff17b599539e9a13920afc45824c7cc..406f2416980725fe1de74bfe4ec56a95d0b9317a 100644 (file)
@@ -785,11 +785,15 @@ int sound_manager_get_focus_reacquisition(sound_stream_info_h stream_info, bool
  * @since_tizen 3.0
  * @param[in]  stream_info     The handle of stream information
  * @param[out] sound_type      The sound type
-  *
+ *
+ * @remarks    In case of the stream_info made with #SOUND_STREAM_TYPE_EMERGENCY, it'll return #SOUND_MANAGER_ERROR_NO_DATA.\n
+ *     Because there is no sound_type_e matched to this stream_info.
+ *
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
  * @pre Call sound_manager_create_stream_information() before calling this function.
  * @see sound_manager_create_stream_information()
  * @see sound_manager_destroy_stream_information()
index d5ae2be17ccb1bc89d9a27c0af452f73c2ae878e..1825eb0c9e9ddc51921b3dfab8ecbde00865b7d2 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.3.35
+Version:    0.3.36
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 2e808dce722b7f2bd97d1a4c2731ffa0841fa03e..2beb77089a8d302b10cc7a54adcd9e2acd97a591 100644 (file)
@@ -382,7 +382,12 @@ int sound_manager_get_sound_type(sound_stream_info_h stream_info, sound_type_e *
        SM_INSTANCE_CHECK(stream_h);
        SM_NULL_ARG_CHECK(sound_type);
 
-       ret = _convert_sound_type_to_enum(stream_h->stream_conf_info.volume_type, sound_type);
+       if (stream_h->stream_conf_info.volume_type == NULL)
+               ret = MM_ERROR_SOUND_NO_DATA;
+       else {
+               ret = _convert_sound_type_to_enum(stream_h->stream_conf_info.volume_type, sound_type);
+               LOGI("sound type(%d)", *sound_type);
+       }
 
        LOGI("<< leave : sound type(%d)", *sound_type);
 
index 3af3e53f2b84bce8b0ad794d3391a6d15928d7a6..301627c585076f544480205b2ad2b019d57c43d9 100644 (file)
@@ -381,7 +381,7 @@ static void displaymenu()
        else if (g_menu_state == CURRENT_STATUS_UNSET_DEVICE_INFO_CHANGED_CB)
                g_print("*** press enter to unset device information changed cb\n");
        else if (g_menu_state == CURRENT_STATUS_CREATE_STREAM_INFO)
-               g_print("*** input stream type to create stream information (0:media, 1:alarm, 2:notification, 3:ringtone-call, 4:voice-call, 5:voip, 6:media-ext-only)\n");
+               g_print("*** input stream type to create stream information\n(0:media, 1:system, 2:alarm, 3:notification, 4:emergency, 5:ringtone-call, 6:voice-call, 7:voip, 8:media-ext-only)\n");
        else if (g_menu_state == CURRENT_STATUS_ADD_DEVICE_FOR_STREAM_ROUTING)
                g_print("*** input device type to add (0:built-in mic, 1:built-in spk, 2:built-in rcv, 3:audio-jack, 4:bt)\n");
        else if (g_menu_state == CURRENT_STATUS_REMOVE_DEVICE_FOR_STREAM_ROUTING)
@@ -989,22 +989,28 @@ static void interpret(char *cmd)
                case 0: /* media */
                        type = SOUND_STREAM_TYPE_MEDIA;
                        break;
-               case 1: /* alarm */
+               case 1: /* system */
+                       type = SOUND_STREAM_TYPE_SYSTEM;
+                       break;
+               case 2: /* alarm */
                        type = SOUND_STREAM_TYPE_ALARM;
                        break;
-               case 2: /* notification */
+               case 3: /* notification */
                        type = SOUND_STREAM_TYPE_NOTIFICATION;
                        break;
-               case 3: /* ringtone for call*/
+               case 4: /* emergency */
+                       type = SOUND_STREAM_TYPE_EMERGENCY;
+                       break;
+               case 5: /* ringtone for call*/
                        type = SOUND_STREAM_TYPE_RINGTONE_CALL;
                        break;
-               case 4: /* voice call */
+               case 6: /* voice call */
                        type = SOUND_STREAM_TYPE_VOICE_CALL;
                        break;
-               case 5: /* voip */
+               case 7: /* voip */
                        type = SOUND_STREAM_TYPE_VOIP;
                        break;
-               case 6: /* media only for external devices */
+               case 8: /* media only for external devices */
                        type = SOUND_STREAM_TYPE_MEDIA_EXTERNAL_ONLY;
                        break;
                default: