Enhance pcm dump, add prefix for bt routing option, use explicit route-type condition 08/120008/3 accepted/tizen_common accepted/tizen_ivi accepted/tizen_mobile accepted/tizen_tv accepted/tizen_wearable accepted/tizen/common/20170329.172554 accepted/tizen/ivi/20170329.222742 accepted/tizen/mobile/20170329.222547 accepted/tizen/tv/20170329.222654 accepted/tizen/unified/20170329.222802 accepted/tizen/wearable/20170329.222718 submit/tizen/20170329.121135
authorHyunseok Lee <hs7388.lee@samsung.com>
Tue, 10 Jan 2017 00:57:29 +0000 (09:57 +0900)
committerJeongho Mok <jho.mok@samsung.com>
Tue, 28 Mar 2017 07:58:19 +0000 (16:58 +0900)
[Version] 5.0.143
[Profile] Common
[Issue Type] Enhancement

Change-Id: Ic2b20daf32062c600b4052f4ed0bdfcd2efdd77e

packaging/pulseaudio-modules-tizen.spec
src/device-manager.c
src/module-tizenaudio-policy.c
src/stream-manager.c
src/stream-manager.h

index ac5fc7d..5fe479e 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          5.0.142
+Version:          5.0.143
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index 8d771b4..efec5c8 100644 (file)
@@ -428,28 +428,28 @@ static pa_dbus_method_handler method_handlers[METHOD_HANDLER_MAX] = {
         .receive_cb = handle_get_connected_device_list },
     [METHOD_HANDLER_IS_STREAM_ON_DEVICE] = {
         .method_name = "IsStreamOnDevice",
-        .receive_cb = handle_is_stream_on_device},
+        .receive_cb = handle_is_stream_on_device },
     [METHOD_HANDLER_GET_BT_A2DP_STATUS] = {
         .method_name = "GetBTA2DPStatus",
         .receive_cb = handle_get_bt_a2dp_status },
     [METHOD_HANDLER_LOAD_SINK] = {
         .method_name = "LoadSink",
-        .receive_cb = handle_load_sink},
+        .receive_cb = handle_load_sink },
     [METHOD_HANDLER_UNLOAD_SINK] = {
         .method_name = "UnloadSink",
-        .receive_cb = handle_unload_sink},
+        .receive_cb = handle_unload_sink },
     [METHOD_HANDLER_UNLOAD_SINK_WITH_DEVICE_STRING] = {
         .method_name = "UnloadSinkWithDeviceString",
-        .receive_cb = handle_unload_sink_with_device_string},
+        .receive_cb = handle_unload_sink_with_device_string },
     [METHOD_HANDLER_GET_DEVICE_STRING] = {
         .method_name = "GetDeviceString",
-        .receive_cb = handle_get_device_string},
+        .receive_cb = handle_get_device_string },
     [METHOD_HANDLER_DUMP_DEVICE_LIST] = {
         .method_name = "DumpDeviceList",
-        .receive_cb = handle_dump_device_list},
+        .receive_cb = handle_dump_device_list },
     [METHOD_HANDLER_STATUS_TEST] = {
         .method_name = "TestStatusChange",
-        .receive_cb = handle_test_device_status_change},
+        .receive_cb = handle_test_device_status_change },
 };
 
 #endif
index f1b6dc3..f057674 100644 (file)
@@ -96,12 +96,8 @@ struct userdata;
 
 /* PCM Dump */
 #define PA_DUMP_INI_DEFAULT_PATH                SYSCONFDIR"/multimedia/mmfw_audio_pcm_dump.ini" /* SYSCONFDIR is defined at .spec */
-#define PA_DUMP_INI_TEMP_PATH                   "/opt/system/mmfw_audio_pcm_dump.ini"
+#define PA_DUMP_INI_TEMP_PATH                   "/home/owner/media/mmfw_audio_pcm_dump.ini"
 #define PA_DUMP_VCONF_KEY                       "memory/private/sound/pcm_dump"
-#define PA_DUMP_PLAYBACK_DECODER_OUT            0x00000001
-#define PA_DUMP_PLAYBACK_RESAMPLER_IN           0x00000008
-#define PA_DUMP_PLAYBACK_RESAMPLER_OUT          0x00000010
-#define PA_DUMP_CAPTURE_ENCODER_IN              0x80000000
 
 typedef enum _device_type {
     DEVICE_BUILTIN_SPEAKER,
@@ -194,19 +190,23 @@ static void __load_dump_config(struct userdata *u)
         }
     }
 
-    vconf_dump |= iniparser_getboolean(dict, "pcm_dump:decoder_out", 0) ? PA_DUMP_PLAYBACK_DECODER_OUT : 0;
-    vconf_dump |= iniparser_getboolean(dict, "pcm_dump:resampler_in", 0) ? PA_DUMP_PLAYBACK_RESAMPLER_IN : 0;
-    vconf_dump |= iniparser_getboolean(dict, "pcm_dump:resampler_out", 0) ? PA_DUMP_PLAYBACK_RESAMPLER_OUT : 0;
-    vconf_dump |= iniparser_getboolean(dict, "pcm_dump:encoder_in", 0) ? PA_DUMP_CAPTURE_ENCODER_IN : 0;
-    u->core->dump_sink = (bool)iniparser_getboolean(dict, "pcm_dump:pa_sink", 0);
-    u->core->dump_sink_input = (bool)iniparser_getboolean(dict, "pcm_dump:pa_sink_input", 0);
-    u->core->dump_source = (bool)iniparser_getboolean(dict, "pcm_dump:pa_source", 0);
-    u->core->dump_source_output = (bool)iniparser_getboolean(dict, "pcm_dump:pa_source_output", 0);
+    vconf_dump |= iniparser_getboolean(dict, "pcm_dump:decoder_out", 0) ? PA_PCM_DUMP_GST_DECODER_OUT : 0;
+    vconf_dump |= iniparser_getboolean(dict, "pcm_dump:resampler_in", 0) ? PA_PCM_DUMP_GST_RESAMPLER_IN : 0;
+    vconf_dump |= iniparser_getboolean(dict, "pcm_dump:resampler_out", 0) ? PA_PCM_DUMP_GST_RESAMPLER_OUT : 0;
+    vconf_dump |= iniparser_getboolean(dict, "pcm_dump:gst_audio_sink", 0) ? PA_PCM_DUMP_GST_AUDIO_SINK_IN : 0;
+    vconf_dump |= iniparser_getboolean(dict, "pcm_dump:pa_stream_write", 0) ? PA_PCM_DUMP_PA_STREAM_WRITE : 0;
+    u->core->pcm_dump |= (bool)iniparser_getboolean(dict, "pcm_dump:pa_sink_input", 0) ? PA_PCM_DUMP_PA_SINK_INPUT : 0;
+    u->core->pcm_dump |= (bool)iniparser_getboolean(dict, "pcm_dump:pa_sink", 0) ? PA_PCM_DUMP_PA_SINK : 0;
+    u->core->pcm_dump |= (bool)iniparser_getboolean(dict, "pcm_dump:pa_source", 0) ? PA_PCM_DUMP_PA_SOURCE : 0;
+    u->core->pcm_dump |= (bool)iniparser_getboolean(dict, "pcm_dump:pa_source_output", 0) ? PA_PCM_DUMP_PA_SOURCE_OUTPUT : 0;
+    vconf_dump |= iniparser_getboolean(dict, "pcm_dump:pa_stream_read", 0) ? PA_PCM_DUMP_PA_STREAM_READ : 0;
+    vconf_dump |= iniparser_getboolean(dict, "pcm_dump:gst_audio_src", 0) ? PA_PCM_DUMP_GST_AUDIO_SRC_OUT : 0;
+    vconf_dump |= iniparser_getboolean(dict, "pcm_dump:encoder_in", 0) ? PA_PCM_DUMP_GST_ENCODER_IN : 0;
 
     iniparser_freedict(dict);
 
-    if (vconf_set_int(PA_DUMP_VCONF_KEY, vconf_dump)) {
-        pa_log_warn("vconf_set_int %s=%x failed", PA_DUMP_VCONF_KEY, vconf_dump);
+    if (vconf_set_int(PA_PCM_DUMP_VCONF_KEY, vconf_dump)) {
+        pa_log_warn("vconf_set_int %s=%x failed", PA_PCM_DUMP_VCONF_KEY, vconf_dump);
     }
 }
 
@@ -388,7 +388,7 @@ static bool skip_device(const char *stream_role, const char *device_type)
         return false;
     }
 
-    if (!sound_on && pa_streq(stream_role, STREAM_ROLE_RINGTONE_CALL) && pa_streq(device_type, DEVICE_TYPE_SPEAKER)) {
+    if (!sound_on && IS_ROLE_RINGTONE(stream_role) && pa_streq(device_type, DEVICE_TYPE_SPEAKER)) {
         pa_log_info("sound status is 0 with ringtone-call stream, skip built-in speaker");
         return true;
     }
@@ -945,8 +945,8 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
 
                             if (get_bt_property(u->device_manager, &is_wb, &is_nrec) == 0) {
                                 pa_log_info("bt property : wideband(%d), nrec(%d)", is_wb, is_nrec);
-                                _update_bt_route_option(u->hal_interface, route_info.role, "wideband", (int)is_wb);
-                                _update_bt_route_option(u->hal_interface, route_info.role, "nrec", (int)is_nrec);
+                                _update_bt_route_option(u->hal_interface, route_info.role, "bt-wideband", (int)is_wb);
+                                _update_bt_route_option(u->hal_interface, route_info.role, "bt-nrec", (int)is_nrec);
                             } else
                                 pa_log_warn("Failed to get property for wideband / nrec....");
                         } else {
index de28fc9..1337e52 100644 (file)
@@ -2681,7 +2681,7 @@ static void fill_device_info_to_hook_data(pa_stream_manager *m, void *hook_data,
             }
             select_data->idx_avail_devices = avail_devices;
             select_data->origins_from_new_data = is_new_data;
-            if (si->route_type >= STREAM_ROUTE_TYPE_MANUAL) {
+            if (si->route_type == STREAM_ROUTE_TYPE_MANUAL || si->route_type == STREAM_ROUTE_TYPE_MANUAL_EXT) {
                 if (is_new_data)
                     p_idx = pa_proplist_gets(GET_STREAM_NEW_PROPLIST(stream, type), PA_PROP_MEDIA_PARENT_ID);
                 else
@@ -2726,7 +2726,7 @@ static void fill_device_info_to_hook_data(pa_stream_manager *m, void *hook_data,
                pa_log_warn("  -- could not get the parent id of this stream, but keep going...");
 
             route_data->idx_avail_devices = avail_devices;
-            if (si->route_type >= STREAM_ROUTE_TYPE_MANUAL) {
+            if (si->route_type == STREAM_ROUTE_TYPE_MANUAL || si->route_type == STREAM_ROUTE_TYPE_MANUAL_EXT) {
                 if (sp) {
                     route_data->idx_manual_devices = (type == STREAM_SINK_INPUT) ? (sp->idx_route_out_devices) : (sp->idx_route_in_devices);
                     route_data->idx_streams = (type == STREAM_SINK_INPUT) ? (sp->idx_sink_inputs) : (sp->idx_source_outputs);
@@ -2833,7 +2833,7 @@ BREAK_WITH_FREE:
             hook_call_route_data.stream_role = role;
             CONVERT_TO_DEVICE_ROLE(hook_call_route_data.stream_role, hook_call_route_data.device_role);
             fill_device_info_to_hook_data(m, &hook_call_route_data, command, type, s, is_new_data);
-            if (hook_call_route_data.route_type >= STREAM_ROUTE_TYPE_MANUAL) {
+            if (hook_call_route_data.route_type == STREAM_ROUTE_TYPE_MANUAL || hook_call_route_data.route_type == STREAM_ROUTE_TYPE_MANUAL_EXT) {
                 if (hook_call_route_data.idx_manual_devices && !pa_idxset_size(hook_call_route_data.idx_manual_devices)) {
                     pa_log_warn("no manual device for this type(%d)", type);
                     hook_call_route_data.stream = NULL;
@@ -4064,7 +4064,7 @@ static pa_hook_result_t device_connection_changed_hook_cb(pa_core *c, pa_tz_devi
     /* If the route type of the stream is not manual, notify again */
     if (m->cur_highest_priority.source_output && (device_direction & DM_DEVICE_DIRECTION_IN)) {
         if (!get_route_type(m->cur_highest_priority.source_output, STREAM_SOURCE_OUTPUT, false, &route_type)) {
-            if (route_type < STREAM_ROUTE_TYPE_MANUAL) {
+            if (route_type != STREAM_ROUTE_TYPE_MANUAL && route_type != STREAM_ROUTE_TYPE_MANUAL_EXT) {
                 if (use_internal_codec) {
                     PA_IDXSET_FOREACH(s, m->cur_highest_priority.source_output->source->outputs, s_idx) {
                         if (!data->is_connected && !get_route_type(s, STREAM_SOURCE_OUTPUT, false, &route_type) &&
@@ -4088,7 +4088,7 @@ static pa_hook_result_t device_connection_changed_hook_cb(pa_core *c, pa_tz_devi
     }
     if (m->cur_highest_priority.sink_input && (device_direction & DM_DEVICE_DIRECTION_OUT)) {
         if (!get_route_type(m->cur_highest_priority.sink_input, STREAM_SINK_INPUT, false, &route_type)) {
-            if (route_type < STREAM_ROUTE_TYPE_MANUAL) {
+            if (route_type != STREAM_ROUTE_TYPE_MANUAL && route_type != STREAM_ROUTE_TYPE_MANUAL_EXT) {
                 if (use_internal_codec) {
                     PA_IDXSET_FOREACH(s, m->cur_highest_priority.sink_input->sink->inputs, s_idx) {
                         if (!data->is_connected && !get_route_type(s, STREAM_SINK_INPUT, false, &route_type) &&
index 6c07d0c..f56214b 100644 (file)
@@ -37,6 +37,9 @@
       (stream_role && (pa_streq(stream_role, STREAM_ROLE_CALL_VOICE) || pa_streq(stream_role, STREAM_ROLE_CALL_VIDEO) || \
                        pa_streq(stream_role, STREAM_ROLE_VOIP) || pa_streq(stream_role, STREAM_ROLE_RINGBACKTONE_CALL)))
 
+#define IS_ROLE_RINGTONE(stream_role) \
+      (pa_streq(stream_role, STREAM_ROLE_RINGTONE_CALL) || pa_streq(stream_role, STREAM_ROLE_RINGTONE_VOIP))
+
 #define CONVERT_TO_DEVICE_ROLE(x_stream_role, x_device_role) \
 do { \
     pa_assert(x_stream_role); \
@@ -59,6 +62,7 @@ do { \
 #define STREAM_ROLE_MEDIA               "media"
 #define STREAM_ROLE_RINGTONE_CALL       "ringtone-call"
 #define STREAM_ROLE_RINGBACKTONE_CALL   "ringbacktone-call"
+#define STREAM_ROLE_RINGTONE_VOIP       "ringtone-voip"
 #define STREAM_ROLE_CALL_VOICE          "call-voice"
 #define STREAM_ROLE_CALL_VIDEO          "call-video"
 #define STREAM_ROLE_VOIP                "voip"