tizenaudio-policy: Remove temporary codes and correct mistypo 85/138685/3
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 13 Jul 2017 08:05:46 +0000 (17:05 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 14 Jul 2017 07:59:40 +0000 (16:59 +0900)
[Version] 5.0.162
[Issue Type] Refactoring

Change-Id: Ibea5528b2aef5fd437c43c66d8649e6ebabececb
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/pulseaudio-modules-tizen.spec
src/module-tizenaudio-policy.c
src/stream-manager.h

index ab288e913114ad1a2faf5de6579f4683c0c1c9ef..113b2462463ab241d73f14e2868782ffc458d2fc 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          5.0.161
+Version:          5.0.162
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index 209ae2dc5f20f72a5364144bd80efba3e5232abe..c82fbc5591fbe3f7316e4b51aba52fcef3bbd062 100644 (file)
@@ -304,10 +304,11 @@ static void update_loopback_module(struct userdata *u, bool load) {
     pa_assert(u);
 
     if (load && u->loopback_args.sink && u->loopback_args.source) {
-        if (!u->loopback_args.latency_msec || !u->loopback_args.latency_msec) {
+        if (!u->loopback_args.latency_msec)
             u->loopback_args.latency_msec = LOOPBACK_DEFAULT_LATENCY_MSEC;
+        if (!u->loopback_args.adjust_sec)
             u->loopback_args.adjust_sec = LOOPBACK_DEFAULT_ADJUST_SEC;
-        }
+
         args = pa_sprintf_malloc("sink=%s source=%s latency_msec=%d adjust_time=%d",
                                  u->loopback_args.sink->name, u->loopback_args.source->name,
                                  u->loopback_args.latency_msec, u->loopback_args.adjust_sec);
@@ -455,11 +456,12 @@ static pa_hook_result_t select_proper_sink_or_source_hook_cb(pa_core *c, pa_stre
 
     if (!data->idx_avail_devices) {
         pa_log_error("[SELECT] available devices is NULL, set it to null sink/source");
-        if (data->stream_type == STREAM_SINK_INPUT)
-            *(data->proper_sink) = null_sink;
-        else
-            *(data->proper_source) = null_source;
-        return PA_HOOK_OK;
+        goto not_found;
+    }
+
+    if (IS_MANUAL_ROUTE_TYPE_SERIES(data->route_type) && !data->idx_manual_devices) {
+        pa_log_error("[SELECT] manual devices is NULL, set it to null sink/source");
+        goto not_found;
     }
 
     if (IS_AUTO_ROUTE_TYPE_SERIES(data->route_type)) {
@@ -530,7 +532,7 @@ static pa_hook_result_t select_proper_sink_or_source_hook_cb(pa_core *c, pa_stre
             }
         }
 
-    } else if (data->route_type == STREAM_ROUTE_TYPE_MANUAL && data->idx_manual_devices) {
+    } else if (data->route_type == STREAM_ROUTE_TYPE_MANUAL) {
         PA_IDXSET_FOREACH(device_type, data->idx_avail_devices, idx) {
             pa_log_info("[SELECT][MANUAL] avail_device[%u] for this role[%-16s]: type[%-16s]", idx, data->stream_role, device_type);
             if (!is_cached_device_connected(device_type, data->stream_type))
@@ -559,7 +561,7 @@ static pa_hook_result_t select_proper_sink_or_source_hook_cb(pa_core *c, pa_stre
             }
         }
 
-    } else if (data->route_type == STREAM_ROUTE_TYPE_MANUAL_EXT && data->idx_manual_devices) {
+    } else if (data->route_type == STREAM_ROUTE_TYPE_MANUAL_EXT) {
         PA_IDXSET_FOREACH(device_type, data->idx_avail_devices, idx) {
             pa_log_info("[SELECT][MANUAL_EXT] avail_device[%u] for this role[%-16s]: type[%-16s]", idx, data->stream_role, device_type);
             if (!is_cached_device_connected(device_type, data->stream_type))
@@ -610,7 +612,7 @@ static pa_hook_result_t select_proper_sink_or_source_hook_cb(pa_core *c, pa_stre
                         else {
                             if (((pa_sink_input*)(data->stream))->sink != sink)
                                 pa_sink_input_move_to(data->stream, sink, false);
-                            }
+                        }
 
                     } else if (data->stream_type == STREAM_SOURCE_OUTPUT) {
                         if ((source = pa_tz_device_get_source(device, DEVICE_ROLE_NORMAL))) {
@@ -628,6 +630,7 @@ static pa_hook_result_t select_proper_sink_or_source_hook_cb(pa_core *c, pa_stre
         }
     }
 
+not_found:
     if ((data->stream_type == STREAM_SINK_INPUT) ? !(*(data->proper_sink)) : !(*(data->proper_source))) {
         pa_log_warn("[SELECT] could not find a proper sink/source, set it to null sink/source");
         if (data->stream_type == STREAM_SINK_INPUT)
@@ -1051,7 +1054,7 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
             }
         }
 
-    } else if (data->route_type == STREAM_ROUTE_TYPE_MANUAL && data->idx_manual_devices) {
+    } else if (data->route_type == STREAM_ROUTE_TYPE_MANUAL) {
         uint32_t d_idx = 0;
 
         PA_IDXSET_FOREACH(device_type, data->idx_avail_devices, idx) {
@@ -1062,19 +1065,6 @@ static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_
                 pa_log_debug("  -- manual_device[%u] for this role[%-16s]: device_id(%u)", idx, data->stream_role, *device_id);
                 if (!(device = pa_device_manager_get_device_by_id(u->device_manager, *device_id)))
                     continue;
-                /* FIXME : This is temparary code, until App could give
-                 * proper BT-SCO device for call-voice */
-                if (IS_ROLE_COMMUNICATION(route_info.role) && pa_streq(device->type, DEVICE_TYPE_BT_SCO)) {
-                    pa_tz_device *sco_device;
-                    if ((sco_device = _get_sco_connected_device(u->device_manager)) == NULL) {
-                        pa_log_error("  ** could not find BT SCO");
-                        continue;
-                    }
-                    if (sco_device->id != *device_id) {
-                        pa_log_info("Redirecting this manual routing for call-voice to SCO device(%u)", sco_device->id);
-                        device = sco_device;
-                    }
-                }
                 dm_device_type = pa_tz_device_get_type(device);
                 if (!pa_streq(device_type, dm_device_type))
                     continue;
index 3e19b61e446fe574323aef5446cd7e10a23c8892..56ef0f8d8a56ed9856e0791840176f7b3388208d 100644 (file)
@@ -29,7 +29,7 @@
      (route_type_enum == STREAM_ROUTE_TYPE_AUTO_ALL))
 
 #define IS_MANUAL_ROUTE_TYPE_SERIES(route_type_enum) \
-    ((route_type_enum == STREAM_ROUTE_TYPE_MANUAL) || (route_type_enum == STREAM_ROUTE_TYPE_MAUAL_EXT))
+    ((route_type_enum == STREAM_ROUTE_TYPE_MANUAL) || (route_type_enum == STREAM_ROUTE_TYPE_MANUAL_EXT))
 
 #define IS_ROUTE_TYPE_FOR_EXTERNAL_DEV(route_type_str, route_type) \
     (route_type_str && !pa_atoi(route_type_str, (int32_t*)&route_type) && (route_type == STREAM_ROUTE_TYPE_MANUAL_EXT))