fixup! stream-manager-dbus: Add direction argument to the DBus method - set preferred... 16/210616/1
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 23 Jul 2019 02:51:44 +0000 (11:51 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 23 Jul 2019 02:51:44 +0000 (11:51 +0900)
Change-Id: If70a0a2410bc15ee6d77cbb4438e92dfce560fa9
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
src/stream-manager-dbus.c

index 9491a90..7df7710 100644 (file)
@@ -772,12 +772,14 @@ static void handle_set_stream_preferred_device(DBusConnection *conn, DBusMessage
         } else {
             /* If the request is for a different device type,
              * check the previous device role and move streams to default role if needed. */
-            prev_device = pa_device_manager_get_device(m->dm, prev_device_type);
-            new_device = pa_hashmap_first((direction == STREAM_DIRECTION_OUT) ?
-                                    prev_device->playback_devices : prev_device->capture_devices);
-            device_props = (direction == STREAM_DIRECTION_OUT) ? PA_SINK(new_device)->proplist : PA_SOURCE(new_device)->proplist;
-            pa_log_debug("may move stream[%u] to default role: [%s][%s -> %s]",
-                    stream_index, prev_device_type, prev_device_role, pa_proplist_gets(device_props, PA_PROP_DEVICE_ROLE));
+            if ((prev_device = pa_device_manager_get_device(m->dm, prev_device_type)))
+                new_device = pa_hashmap_first((direction == STREAM_DIRECTION_OUT) ?
+                                        prev_device->playback_devices : prev_device->capture_devices);
+            if (new_device) {
+                device_props = (direction == STREAM_DIRECTION_OUT) ? PA_SINK(new_device)->proplist : PA_SOURCE(new_device)->proplist;
+                pa_log_debug("may move stream[%u] to default role: [%s][%s -> %s]",
+                        stream_index, prev_device_type, prev_device_role, pa_proplist_gets(device_props, PA_PROP_DEVICE_ROLE));
+            }
         }
         if (new_device) {
             if (direction == STREAM_DIRECTION_OUT)