Exemple #1
0
static guint suspend_gateway(struct media_transport *transport,
						struct media_owner *owner)
{
	struct audio_device *device = transport->device;
	static int id = 1;

	if (!owner) {
		gateway_unlock(device, GATEWAY_LOCK_READ | GATEWAY_LOCK_WRITE);
		transport->in_use = FALSE;
		return 0;
	}

	gateway_suspend_stream(device);
	gateway_unlock(device, GATEWAY_LOCK_READ | GATEWAY_LOCK_WRITE);
	g_idle_add(gateway_suspend_complete, owner);
	return id++;
}
static gboolean gateway_suspend_complete(gpointer user_data)
{
	struct media_owner *owner = user_data;
	struct media_transport *transport = owner->transport;
	struct audio_device *device = transport->device;

	/* Release always succeeds */
	if (owner->pending) {
		owner->pending->id = 0;
		media_request_reply(owner->pending, transport->conn, 0);
		media_owner_remove(owner);
	}

	gateway_unlock(device, GATEWAY_LOCK_READ | GATEWAY_LOCK_WRITE);
	transport->in_use = FALSE;
	media_transport_remove(transport, owner);
	return FALSE;
}