media-session: always check if session is busy

Also check if the session is busy if we explicitly provided the
target session id to join.
This commit is contained in:
Wim Taymans 2018-06-27 11:11:35 +02:00
parent 2fe392dd30
commit 6e92dbbe23

View file

@ -422,13 +422,14 @@ static int find_session(void *data, struct session *sess)
if (strcmp(str, find->media_class) != 0) if (strcmp(str, find->media_class) != 0)
return 0; return 0;
if ((find->exclusive && sess->busy) || sess->exclusive) {
pw_log_debug("module %p: session in use", impl);
return 0;
}
plugged = sess->plugged; plugged = sess->plugged;
} }
if ((find->exclusive && sess->busy) || sess->exclusive) {
pw_log_debug("module %p: session in use", impl);
return 0;
}
pw_log_debug("module %p: found session '%d' %" PRIu64, impl, pw_log_debug("module %p: found session '%d' %" PRIu64, impl,
sess->id, plugged); sess->id, plugged);
@ -515,6 +516,7 @@ static int handle_autoconnect(struct impl *impl, struct pw_node *node,
find.impl = impl; find.impl = impl;
find.sess = NULL; find.sess = NULL;
find.plugged = 0;
find.exclusive = exclusive; find.exclusive = exclusive;
spa_list_for_each(session, &impl->session_list, l) spa_list_for_each(session, &impl->session_list, l)
find_session(&find, session); find_session(&find, session);