Diff between f5827e9deb712bfb5b649685ccc1a22a13e8314a and 2986404e1f1324c8f798b1085751824ca21491de

Changed Files

File Additions Deletions Status
profiles/audio/device.c +3 -2 modified

Full Patch

diff --git a/profiles/audio/device.c b/profiles/audio/device.c
index 11e1455..5423645 100644
--- a/profiles/audio/device.c
+++ b/profiles/audio/device.c
@@ -172,7 +172,7 @@ static void disconnect_cb(struct btd_device *btd_dev, gboolean removal,
 
 	device_remove_control_timer(dev);
 
-	if (dev->control)
+	if (dev->control && priv->avctp_state != AVCTP_STATE_DISCONNECTED)
 		avrcp_disconnect(dev);
 
 	if (dev->sink && priv->sink_state != SINK_STATE_DISCONNECTED)
@@ -243,7 +243,8 @@ static void device_sink_cb(struct audio_device *dev,
 	case SINK_STATE_DISCONNECTED:
 		if (dev->control) {
 			device_remove_control_timer(dev);
-			avrcp_disconnect(dev);
+			if (priv->avctp_state != AVCTP_STATE_DISCONNECTED)
+				avrcp_disconnect(dev);
 		}
 
 		device_set_state(dev, AUDIO_STATE_DISCONNECTED);