Diff between 1439c6546d0889fbfba5ed184cf34fc4e9f5126c and 283dc309af89c26f1b1c20780cde7ffd6e2f8f7e

Changed Files

File Additions Deletions Status
profiles/audio/avrcp.c +4 -2 modified
profiles/audio/player.c +7 -4 modified

Full Patch

diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index b8cc8f6..84860c8 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -1844,6 +1844,8 @@ static gboolean avrcp_get_element_attributes_rsp(struct avctp *conn,
 
 	avrcp_parse_attribute_list(player, &pdu->params[1], count);
 
+	avrcp_get_play_status(session);
+
 	return FALSE;
 }
 
@@ -2006,6 +2008,8 @@ static gboolean avrcp_get_item_attributes_rsp(struct avctp *conn,
 
 	avrcp_parse_attribute_list(player, &pdu->params[2], count);
 
+	avrcp_get_play_status(session);
+
 	return FALSE;
 }
 
@@ -2182,8 +2186,6 @@ static void avrcp_track_changed(struct avrcp *session,
 		avrcp_get_item_attributes(session, uid);
 	} else
 		avrcp_get_element_attributes(session);
-
-	avrcp_get_play_status(session);
 }
 
 static void avrcp_setting_changed(struct avrcp *session,
diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index 7295235..82b579f 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -792,13 +792,16 @@ void media_player_set_duration(struct media_player *mp, uint32_t duration)
 
 	DBG("%u", duration);
 
-	value = g_strdup_printf("%u", duration);
+	/* Only update duration if track exists */
+	if (g_hash_table_size(mp->track) == 0)
+		return;
 
+	/* Ignore if duration is already set */
 	curval = g_hash_table_lookup(mp->track, "Duration");
-	if (g_strcmp0(curval, value) == 0) {
-		g_free(value);
+	if (curval != NULL)
 		return;
-	}
+
+	value = g_strdup_printf("%u", duration);
 
 	g_hash_table_replace(mp->track, g_strdup("Duration"), value);