Skip to contentSkip to conversation

avrcp: Fix unregister AVRCP player

PATCH Applied Huang-Huang Bao 2 participants 4 messages May 20, 2021 – May 22, 2021 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 avrcp: Fix unregister AVRCP player

'notify_addressed_player_changed()' expected to be called with 'player->changed_id' set to a non-zero value.

    player->changed_id = g_idle_add(notify_addressed_player_changed,
                                    player);

And 'avrcp_player_event()' relies on 'player->changed_id' to perform Addressed Player Changed notification. However, 'avrcp_unregister_player()' calls 'notify_addressed_player_changed()' without adding it to the main loop and set 'player->changed_id'. To indicate addreddsed player changed for both scenarios, we set 'player->changed_id' to 1 at the head of 'notify_addressed_player_changed()'.

Fixes https://github.com/bluez/bluez/issues/142

---
 profiles/audio/avrcp.c | 6 ++++++
 1 file changed, 6 insertions(+)
profiles/audio/avrcp.c +6 -0
index 58d30b24d..ef721e17b 100644
@@ -1794,6 +1794,12 @@ static gboolean notify_addressed_player_changed(gpointer user_data)
 				};
 	uint8_t i;
 
+	/*
+	 * Set changed_id to an non-zero value to indicate addreddsed player
+	 * changed.
+	 */
+	player->changed_id = 1;
+
 	avrcp_player_event(player, AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED, NULL);
 
 	/*

--
2.31.1

#1 lore raw

Hi,

Seems the test bot failed to send mail, but all tests for this patch did passed though, see https://github.com/BluezTestBot/bluez/pull/824/checks?check_run_id=2628653346.

Should I resend the patch to make test bot re-run the tests and resend result mail?

Regards,
Bao

Quoted 39 lines · Huang-Huang Bao

'notify_addressed_player_changed()' expected to be called with 'player->changed_id' set to a non-zero value.

     player->changed_id = g_idle_add(notify_addressed_player_changed,
                                     player);

And 'avrcp_player_event()' relies on 'player->changed_id' to perform Addressed Player Changed notification. However, 'avrcp_unregister_player()' calls 'notify_addressed_player_changed()' without adding it to the main loop and set 'player->changed_id'. To indicate addreddsed player changed for both scenarios, we set 'player->changed_id' to 1 at the head of 'notify_addressed_player_changed()'.

Fixes https://github.com/bluez/bluez/issues/142

---
  profiles/audio/avrcp.c | 6 ++++++
  1 file changed, 6 insertions(+)
profiles/audio/avrcp.c +6 -1
index 58d30b24d..ef721e17b 100644
@@ -1794,6 +1794,12 @@ static gboolean notify_addressed_player_changed(gpointer user_data)
  				};
  	uint8_t i;
 
+	/*
+	 * Set changed_id to an non-zero value to indicate addreddsed player
+	 * changed.
+	 */
+	player->changed_id = 1;
+
  	avrcp_player_event(player, AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED, NULL);
 
  	/*
--

2.31.1

maintainer Applied
#2 lore raw
In reply to Huang-Huang Bao

Hi Huang-Huang,

Quoted 38 lines · Huang-Huang Bao

'notify_addressed_player_changed()' expected to be called with 'player->changed_id' set to a non-zero value.

    player->changed_id = g_idle_add(notify_addressed_player_changed,
                                    player);

And 'avrcp_player_event()' relies on 'player->changed_id' to perform Addressed Player Changed notification. However, 'avrcp_unregister_player()' calls 'notify_addressed_player_changed()' without adding it to the main loop and set 'player->changed_id'. To indicate addreddsed player changed for both scenarios, we set 'player->changed_id' to 1 at the head of 'notify_addressed_player_changed()'.

Fixes https://github.com/bluez/bluez/issues/142

---
 profiles/audio/avrcp.c | 6 ++++++
 1 file changed, 6 insertions(+)
profiles/audio/avrcp.c +6 -1
index 58d30b24d..ef721e17b 100644
@@ -1794,6 +1794,12 @@ static gboolean notify_addressed_player_changed(gpointer user_data)
                                };
        uint8_t i;
 
+       /*
+        * Set changed_id to an non-zero value to indicate addreddsed player
+        * changed.
+        */
+       player->changed_id = 1;
+
        avrcp_player_event(player, AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED, NULL);
 
        /*
--
Quoted 1 line

2.31.1

Applied, thanks.

Signature · 1 line
Luiz Augusto von Dentz
#3 lore raw

Hi, Luiz

Oh, what a timing, thanks!

Quoted 43 lines · Luiz Augusto von Dentz

Hi Huang-Huang,

Quoted 37 lines · Huang-Huang Bao

'notify_addressed_player_changed()' expected to be called with 'player->changed_id' set to a non-zero value.

     player->changed_id = g_idle_add(notify_addressed_player_changed,
                                     player);

And 'avrcp_player_event()' relies on 'player->changed_id' to perform Addressed Player Changed notification. However, 'avrcp_unregister_player()' calls 'notify_addressed_player_changed()' without adding it to the main loop and set 'player->changed_id'. To indicate addreddsed player changed for both scenarios, we set 'player->changed_id' to 1 at the head of 'notify_addressed_player_changed()'.

Fixes https://github.com/bluez/bluez/issues/142

---
  profiles/audio/avrcp.c | 6 ++++++
  1 file changed, 6 insertions(+)
profiles/audio/avrcp.c +6 -1
index 58d30b24d..ef721e17b 100644
@@ -1794,6 +1794,12 @@ static gboolean notify_addressed_player_changed(gpointer user_data)
                                 };
         uint8_t i;
 
+       /*
+        * Set changed_id to an non-zero value to indicate addreddsed player
+        * changed.
+        */
+       player->changed_id = 1;
+
         avrcp_player_event(player, AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED, NULL);
 
         /*
--
Quoted 1 line

2.31.1

Applied, thanks.