Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3564002pxb; Wed, 13 Oct 2021 08:29:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywlFymcsUjIAjYbIkMW2MdsjLapf5dGdflbHija7/cI7JtHMhGu86CliPuM0GXJYpgdndc X-Received: by 2002:a17:906:69d6:: with SMTP id g22mr140070ejs.429.1634138991065; Wed, 13 Oct 2021 08:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634138991; cv=none; d=google.com; s=arc-20160816; b=Gy2rAFcWkeoDx41eWMgDtiB1Fa9IKADwA0Eh9xZGE6EYcWkjv4L2aJrGjKc5PcnGoL KqhNn9C+BF+bMV3Okn9gNSYKO2Bxo6MjIcZWlIDHG2OvawsB/jFrwMC5tB+TL5VxbeUV lmUDe3Ro2/kqjdTgTY598Z/iWJ4g4j52hGYJFg3GCjicikfoBwEI5Y1QEDfPXa1WcOss pAO7OrR11LjvDg6S9ZmL3Xm41eh5ujzPiCuPK+xsQCYJzZja2jklU8iy5ba3bTEYcww4 7zDEac5Xr9ui9VbPCt1DzDbxzV5/WR7O938GWBy2LvxfoWoHKjCptLJoIeYrQ99k2EyK u7Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=LBPT/TvMondGTYt2/Lrzqkelh4cpC79TeGMh8TH06sw=; b=tC5BbTGoJOrouqUj86Sv3um1OSpILYMrBk0DWsXjY8FReOg2jqHccWfOl2Vblw8PRn GAJBF+QmH9P4c3t2WH8X8dPhmB/DbYpXKrSD8YUJdroXDJdX/Ia03I6a/nxzoF+MxkiD roP465xxaGegvoKxCYx/3MTonQC/wCNdC9OdJP528tI66GZDrXvcn33k3lfBNNZVgBzR eVHB8BlLjhqGYB2OC9HlsbUJws2DjTlL00psusfQcbhJ43KYABtcLLSrqdSq5zKiWe1w gg8MxviR2TV7U60es4MlHELiRAnqpy9w4R/H7Vgra9zQGSHpnsHV1+2abHDKmsCWONkk 3yZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g23si21414012ejk.552.2021.10.13.08.28.43; Wed, 13 Oct 2021 08:29:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229777AbhJMP3C (ORCPT + 99 others); Wed, 13 Oct 2021 11:29:02 -0400 Received: from mout01.posteo.de ([185.67.36.141]:34023 "EHLO mout01.posteo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229653AbhJMP3C (ORCPT ); Wed, 13 Oct 2021 11:29:02 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 32578240026 for ; Wed, 13 Oct 2021 17:26:56 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4HTxGR1NbTz6tmF; Wed, 13 Oct 2021 17:26:55 +0200 (CEST) Message-ID: <2a183e606205246ae64422c274275eb1caa2ada5.camel@iki.fi> Subject: Re: [PATCH BlueZ] avrcp: keep track of last volume, and use as transport init_volume From: Pauli Virtanen To: Marijn Suijten Cc: linux-bluetooth@vger.kernel.org Date: Wed, 13 Oct 2021 15:26:54 +0000 In-Reply-To: <20211012215115.ypzc55dd5enwscis@SoMainline.org> References: <097b7a889f73ea9cee42b9a0c99683a1d7ee8069.camel () iki ! fi> <20211012215115.ypzc55dd5enwscis@SoMainline.org> Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Marijn, ti, 2021-10-12 kello 23:51 +0200, Marijn Suijten kirjoitti: > > On 2021-10-12 20:35:17, Pauli Virtanen wrote: > > [..] > > There's also something confusing in the code in current master > > branch: why are avrcp_handle_set_volume and avrcp_volume_changed > > setting the volume on local target->player, which I thought is a BlueZ > > as TG thing? > > If I remember correctly you can also have a player with BlueZ as CT > which is basically a passthrough representing the "actual player" on the > other end of the connection? In these routines (which are called on RegisterNotification response, and SetAbsoluteVolume response, so BlueZ as CT), the player is from target_get_player, so it's one of the RegisterPlayer() players for Bluez as TG. There's indeed a separate set of "proxy" players in  session->controller->players, but their avrcp_player_cb is NULL and don't have set_volume defined or appear as TG players. > > I see that df7d3fa50023 ("audio/avrcp: Always update transport volume > > regardless of player") moved most of what player->set_volume does to > > the callbacks, and the player volumes seem to be currently used only to > > provide initial volume for transports. The volume probably should be > > stored elsewhere than in local players? > > Going off of memory without looking at the codebase, it probably makes > sense to move volume out of the players and into the device entirely as > a single source-of-truth representing the currently known volume value > of the peer.  That might solve these issues (ie. no player available in > the linked commit) and get rid of a bunch of edgecases?  That's probably > overlooking some major dependencies though, but it'd be great if you > could look into that direction. > > In addition I don't know if AVRCP volume is "local" to an entire device > or just a single transport "within" that device. From my current reading of the spec, there's no correspondence to audio transports. One might understand it so that volume is specific to a certain player on TG, but as TG is supposedly sink, it's sounds like it intended to be a single device volume. > > [..] > > Caching in struct avrcp session doesn't have these problems, but > > df7d3fa50023 mentions there's some issue with avrcp session appearing > > late. I'll need to think a bit how to fix this. > > I don't remember there being no avrcp session yet, but you're probably > referring to 4b6153b0501c ("audio/transport: supply volume on transport > init") instead? Sorry, yes, I meant 4b6153b0501c. Best, Pauli