Check if manual device is set when starting virtual stream if the route type of the... 21/44921/2 accepted/tizen/mobile/20150730.074328 accepted/tizen/tv/20150730.074610 accepted/tizen/wearable/20150730.074810 submit/tizen/20150729.122952
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 29 Jul 2015 11:20:54 +0000 (20:20 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 29 Jul 2015 11:48:50 +0000 (20:48 +0900)
Add condition for the virutal stream.
Revise description for features in sound_manager_doc.h
Remove warning messages during compile.
Add Werror for compile option.

[Version] Release 0.3.15
[profile] Common
[Issue Type] Enhance code

Change-Id: Ic791206c8d9cc7d406cfb34dc446ce37a97b573e

CMakeLists.txt
doc/sound_manager_doc.h
include/sound_manager_private.h
packaging/capi-media-sound-manager.spec
src/sound_manager_internal.c
src/sound_manager_private.c

index e0b87d0..6231e5f 100644 (file)
@@ -47,8 +47,8 @@ FOREACH(flag ${${fw_name}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
 IF("${ARCH}" STREQUAL "arm")
index c614aba..a889178 100644 (file)
  * The Sound Manager has predefined sound sessions (media, alarm, notification, emergency, voip)
  *
  * @section CAPI_MEDIA_SOUND_MANAGER_MODULE_FEATURE Related Features
- * APIs for voip sound session are related with the following features:\n
+ * APIs for voip sound session and voip stream type are related with the following features:\n
  *  - http://tizen.org/feature/microphone\n
- *  - http://tizen.org/feature/sip.voip\n
  *
  * It is recommended to design feature related codes in your application for reliability.\n
  *
index 669c77b..26ba0b6 100644 (file)
@@ -131,6 +131,7 @@ typedef struct _stream_conf_info_s {
 typedef struct _manual_route_info_s {
        unsigned int route_in_devices[AVAIL_DEVICES_MAX];
        unsigned int route_out_devices[AVAIL_DEVICES_MAX];
+       bool is_set;
 } manual_route_info_s;
 
 typedef struct _sound_stream_info_s {
@@ -158,7 +159,7 @@ typedef struct _virtual_stream_info_s {
        pa_context *pa_context;
        pa_stream *pa_stream[SOUND_STREAM_DIRECTION_MAX];
        pa_proplist *pa_proplist;
-       stream_conf_info_s *stream_conf_info;
+       sound_stream_info_s *stream_info;
 } virtual_sound_stream_info_s;
 
 typedef enum {
index 96a4683..4e06888 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.3.14
+Version:    0.3.15
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 13aae4b..782f94e 100644 (file)
@@ -49,8 +49,6 @@ int sound_manager_create_stream_information_internal (sound_stream_type_internal
 int sound_manager_set_stream_routing_option (sound_stream_info_h stream_info, const char *name, int value)
 {
        int ret = MM_ERROR_NONE;
-       int i = 0;
-       bool need_to_apply = false;
        sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
 
        LOGI(">> enter");
@@ -141,7 +139,7 @@ int sound_manager_create_virtual_stream (sound_stream_info_h stream_info, virtua
                        pa_proplist_sets(vstream_h->pa_proplist, PA_PROP_MEDIA_ROLE, vstream_h->stream_type);
                        pa_proplist_setf(vstream_h->pa_proplist, PA_PROP_MEDIA_PARENT_ID, "%u", stream_h->index);
                        vstream_h->state = _VSTREAM_STATE_READY;
-                       vstream_h->stream_conf_info = &(stream_h->stream_conf_info);
+                       vstream_h->stream_info = stream_h;
                        *virtual_stream = (virtual_sound_stream_h)vstream_h;
                }
        } else {
@@ -191,10 +189,12 @@ int sound_manager_start_virtual_stream (virtual_sound_stream_h virtual_stream)
        SM_INSTANCE_CHECK(vstream_h);
        SM_STATE_CHECK(vstream_h, _VSTREAM_STATE_READY);
 
-       /* check route-type(auto/manual) and error handling as per the type */
-       if (vstream_h->stream_conf_info->route_type == STREAM_ROUTE_TYPE_MANUAL) {
-               /* TODO : check if the device info. is set when it comes to the manual route type */
-               /* if no, return error */
+       if (vstream_h->stream_info->stream_conf_info.route_type == STREAM_ROUTE_TYPE_MANUAL) {
+               /* check if the manual route info. is set when it comes to the manual route type */
+               if (vstream_h->stream_info->manual_route_info.is_set == false) {
+                       ret = MM_ERROR_SOUND_INVALID_STATE;
+                       goto ERROR;
+               }
        }
 
        /* fill up with default value */
@@ -204,9 +204,9 @@ int sound_manager_start_virtual_stream (virtual_sound_stream_h virtual_stream)
        pa_channel_map_init_auto(&maps, ss.channels, PA_CHANNEL_MAP_ALSA);
 
        /* check direction of this stream */
-       if (vstream_h->stream_conf_info->avail_in_devices[0] != NULL)
+       if (vstream_h->stream_info->stream_conf_info.avail_in_devices[0] != NULL)
                io_direction |= SOUND_STREAM_DIRECTION_INPUT;
-       if (vstream_h->stream_conf_info->avail_out_devices[0] != NULL)
+       if (vstream_h->stream_info->stream_conf_info.avail_out_devices[0] != NULL)
                io_direction |= SOUND_STREAM_DIRECTION_OUTPUT;
 
        /* LOCK the pa_threaded_mainloop */
@@ -218,6 +218,7 @@ int sound_manager_start_virtual_stream (virtual_sound_stream_h virtual_stream)
                        if(vstream_h->pa_stream[i] == NULL) {
                                LOGE("failed to pa_stream_new_with_proplist()");
                                pa_ret = pa_context_errno(vstream_h->pa_context);
+                               ret = MM_ERROR_SOUND_INTERNAL;
                                goto ERROR_WITH_UNLOCK;
                        }
                        pa_stream_set_state_callback(vstream_h->pa_stream[i], _pa_stream_state_cb, vstream_h);
@@ -227,6 +228,7 @@ int sound_manager_start_virtual_stream (virtual_sound_stream_h virtual_stream)
                                if (pa_ret < 0) {
                                        LOGE("failed to pa_stream_connect_playback()");
                                        pa_ret = pa_context_errno(vstream_h->pa_context);
+                                       ret = MM_ERROR_SOUND_INTERNAL;
                                        goto ERROR_WITH_UNLOCK;
                                }
                        } else if ((i + 1) == SOUND_STREAM_DIRECTION_INPUT) {
@@ -234,6 +236,7 @@ int sound_manager_start_virtual_stream (virtual_sound_stream_h virtual_stream)
                                if (pa_ret < 0) {
                                        LOGE("failed to pa_stream_connect_record()");
                                        pa_ret = pa_context_errno(vstream_h->pa_context);
+                                       ret = MM_ERROR_SOUND_INTERNAL;
                                        goto ERROR_WITH_UNLOCK;
                                }
                        }
@@ -256,7 +259,11 @@ int sound_manager_start_virtual_stream (virtual_sound_stream_h virtual_stream)
 
        /* UNLOCK the pa_threaded_mainloop */
        pa_threaded_mainloop_unlock(vstream_h->pa_mainloop);
-       goto SUCCESS;
+
+       LOGI("<< leave : ret(%p)", ret);
+
+       return __convert_sound_manager_error_code(__func__, ret);
+
 ERROR_WITH_UNLOCK:
        /* UNLOCK the pa_threaded_mainloop */
        pa_threaded_mainloop_unlock(vstream_h->pa_mainloop);
@@ -268,10 +275,8 @@ ERROR_WITH_UNLOCK:
                }
        }
        LOGE("pa_ret(%d)", pa_ret);
-       ret = MM_ERROR_SOUND_INTERNAL;
-SUCCESS:
-       LOGI("<< leave : ret(%p)", ret);
 
+ERROR:
        return __convert_sound_manager_error_code(__func__, ret);
 }
 
index da4eced..6fd3fdf 100644 (file)
@@ -641,6 +641,8 @@ int __set_manual_route_info (unsigned int index, manual_route_info_s *info)
                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_INVALID_STATE;
+               } else {
+                       info->is_set = true;
                }
                g_variant_unref(result);
        }
@@ -653,7 +655,6 @@ int __set_manual_route_info (unsigned int index, manual_route_info_s *info)
 int __set_route_option (unsigned int index, const char *name, int value)
 {
        int ret = MM_ERROR_NONE;
-       int i = 0;
 
        GVariant *result = NULL;
        GDBusConnection *conn = NULL;