set device_item for sink/source of externel device before notification 91/48891/2
authorMok Jeongho <jho.mok@samsung.com>
Thu, 1 Oct 2015 08:21:03 +0000 (17:21 +0900)
committerMok Jeongho <jho.mok@samsung.com>
Fri, 2 Oct 2015 08:41:45 +0000 (17:41 +0900)
[Version] Release 5.0.42
[Profile] Common
[Issue Type] Fix bug

Change-Id: I0e40f71c473cb84abb1d6e31341ca1366a7c49ac

packaging/pulseaudio-modules-tizen.spec
src/device-manager.c

index 4aeec97e67fd4342679ed9a0c367c62bb2663e39..c7bb3e1518118bb22b686bed5e356c247e51826f 100644 (file)
@@ -4,7 +4,7 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Improved Linux sound server
 Version:          5.0
-Release:          41
+Release:          42
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
 URL:              http://pulseaudio.org
index dac853021a50166fd740ba46643bf6b5e3d01ce0..2f0e509b2df90b3466126e43293c96d9f47fecde 100644 (file)
@@ -1426,10 +1426,44 @@ static int _device_list_remove_device(pa_idxset *device_list, dm_device *device_
     return 0;
 }
 
+static pa_sink* _device_profile_get_sink(dm_device_profile *profile_item, const char *role) {
+    pa_sink *sink;
+
+    if (!profile_item || !role || !device_role_is_valid(role)) {
+        pa_log_error("Invalid Parameter");
+        return NULL;
+    }
+
+    if (!profile_item->playback_devices) {
+        pa_log_error("No playback devices");
+        return NULL;
+    }
+
+    sink = pa_hashmap_get(profile_item->playback_devices, role);
+    return sink;
+}
+
+static pa_source* _device_profile_get_source(dm_device_profile *profile_item, const char *role) {
+    pa_source *source;
+
+    if (!profile_item || !role || !device_role_is_valid(role)) {
+        pa_log_error("Invalid Parameter");
+        return NULL;
+    }
 
+    if (!profile_item->capture_devices) {
+        pa_log_error("No capture devices");
+        return NULL;
+    }
+
+    source = pa_hashmap_get(profile_item->capture_devices, role);
+    return source;
+}
 
 static dm_device* create_device_item(const char *device_type, const char *name, dm_device_profile *profile_item, pa_device_manager *dm) {
     dm_device *device_item = NULL;
+    pa_sink *sink = NULL;
+    pa_source *source = NULL;
 
     pa_assert(device_type);
     pa_assert(profile_item);
@@ -1451,6 +1485,13 @@ static dm_device* create_device_item(const char *device_type, const char *name,
 
     _device_item_add_profile(device_item, profile_item, NULL, dm);
     _device_list_add_device(dm->device_list, device_item, dm);
+
+    // just for external device
+    if ((sink = _device_profile_get_sink(profile_item, DEVICE_ROLE_NORMAL)))
+        sink->device_item = device_item;
+    if ((source = _device_profile_get_source(profile_item, DEVICE_ROLE_NORMAL)))
+        source->device_item = device_item;
+
     notify_device_connection_changed(device_item, TRUE, dm);
 
     return device_item;