[PATCH BlueZ 2/2] transport: Create media request before calling suspend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Creating the media request before suspend can result in
a situation where media_request_reply is not called as
the suspend action for a profile may not depend on the
callback of the stop operation.

This is the case for ASHA profile as devices are not
expected to acknowledge the receipt of a stop command.

Moving media_request_create before media_transport_suspend
should not change the behaviour of release.
---
 profiles/audio/transport.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index c5ae3a71b..dc4f8fea0 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -917,29 +917,29 @@ static DBusMessage *release(DBusConnection *conn, DBusMessage *msg,
 		if (g_str_equal(member, "Acquire")) {
 			media_request_reply(owner->pending, ECANCELED);
 			media_owner_remove(owner);
 		} else {
 			return btd_error_in_progress(msg);
 		}
 	}
 
 	transport_set_state(transport, TRANSPORT_STATE_SUSPENDING);
 
+	req = media_request_create(msg, id);
+	media_owner_add(owner, req);
+
 	id = media_transport_suspend(transport, owner);
 	if (id == 0) {
 		media_transport_remove_owner(transport);
 		return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
 	}
 
-	req = media_request_create(msg, id);
-	media_owner_add(owner, req);
-
 	return NULL;
 }
 
 static gboolean get_device(const GDBusPropertyTable *property,
 					DBusMessageIter *iter, void *data)
 {
 	struct media_transport *transport = data;
 	const char *path;
 
 	if (transport->device)
-- 
2.49.0





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux