From: George Kiagiadakis <george.kiagiadakis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Cc: George Kiagiadakis <george.kiagiadakis@collabora.com>
Subject: [PATCH BlueZ 3/5] player: Fix NumberOfItems never being updated on SetBrowsedPlayer
Date: Fri, 21 Aug 2026 22:34:47 +0300 [thread overview]
Message-ID: <20260821193449.1336263-4-george.kiagiadakis@collabora.com> (raw)
In-Reply-To: <20260821193449.1336263-1-george.kiagiadakis@collabora.com>
media_player_total_items_complete() discarded the count reported by the
player unless a D-Bus request happened to be pending:
if (folder == NULL || folder->msg == NULL)
return;
Of the paths reaching it, only media_player_change_folder_complete()
still holds a pending message. The count was therefore applied on
ChangeFolder and dropped everywhere else, notably on
media_player_set_folder(), which avrcp calls on SetBrowsedPlayer, that
is precisely when the count is first learned.
The guard reads as copy-paste from the four *_complete() functions
above it. Those need a pending message because they send a reply. This
one only refreshes a property, so there is no request to correlate it
with.
f17d3a2c3 replaced an unconditional emit in media_player_change_scope()
with one deferred into this completion whenever the total_items
callback is present, and the guard then swallowed it. The AVRCP
controller always registers that callback, so NumberOfItems has not
been refreshed on SetBrowsedPlayer since. That commit states the
intent itself: "On response, emit PropertyChanged for 'NumberOfItems'
property".
Note the count is still applied to whatever mp->scope is at completion
time rather than to the folder it was requested for.
media_player_change_scope() sets the scope before asking, so the common
case is right, but a second scope change in flight misattributes it.
Fixes: f17d3a2c3b0d ("audio/avrcp: Add support for GetTotalNumberOfItems")
Assisted-by: Claude:claude-opus-5 valgrind
---
profiles/audio/player.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index fa3810a7f..7c5ea5b62 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -753,7 +753,7 @@ void media_player_total_items_complete(struct media_player *mp,
{
struct media_folder *folder = mp->scope;
- if (folder == NULL || mp->msg == NULL)
+ if (folder == NULL)
return;
if (folder->number_of_items != num_of_items) {
--
2.54.0 (Apple Git-157)
next prev parent reply other threads:[~2026-08-21 19:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 19:34 [PATCH BlueZ 0/5] player: Fix crash and related defects around the pending request George Kiagiadakis
2026-08-21 19:34 ` [PATCH BlueZ 1/5] player: Fix crash on MediaItem1.Play() without a browsing scope George Kiagiadakis
2026-08-21 20:38 ` player: Fix crash and related defects around the pending request bluez.test.bot
2026-08-21 19:34 ` [PATCH BlueZ 2/5] player: Answer pending request when the player is destroyed George Kiagiadakis
2026-08-21 19:34 ` George Kiagiadakis [this message]
2026-08-21 19:34 ` [PATCH BlueZ 4/5] player: Report EBUSY from a busy Search() George Kiagiadakis
2026-08-21 19:34 ` [PATCH BlueZ 5/5] unit/test-media-player: Add media player tests George Kiagiadakis
2026-08-24 20:40 ` [PATCH BlueZ 0/5] player: Fix crash and related defects around the pending request patchwork-bot+bluetooth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260821193449.1336263-4-george.kiagiadakis@collabora.com \
--to=george.kiagiadakis@collabora.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.