Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3953131pxj; Tue, 8 Jun 2021 02:53:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+5NkL1u6GsETeV9jF3r0FMQ6kP3X/7RQ86ebeDwKNoIFTkhL9/62d/0wCwKp9FFWUyt16 X-Received: by 2002:a17:907:98ae:: with SMTP id ju14mr3635665ejc.173.1623146001512; Tue, 08 Jun 2021 02:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623146001; cv=none; d=google.com; s=arc-20160816; b=Gw1/Gnwszneue/LJqDY0ZsrkoDt34Q3iKIW8h27Zko86AXpSOFPbWptNMkXUkE6E3H h/l/kE6eoT+b6r88uUAHd0c2uJT5Qo8N0z2aQBRD07xwVmseQJ1TVVSXZUMnEDwYhAPN dqzZn/lMgmAHmRsxbhvATWBSbDDg7WletFWVieN8Nbd8TWAKmkQRYghpIoUaQSI5AQCA GdkjOlkvvHSBcX/4U/qJ8vadTc1H/a/1j2/uTF3/TDzwz6iAeI1ubJcxgudJsxyLrum9 jSslLmR5P3TDKfIySMJPjnFYLaonFu0TPPga4jijZj2IbgU9svfGIHPu7bqdlGMhwwsS PB1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=OrBNYFduj1XHBQ8LPlwZCDXa65Yg0+QyXy7JbZf1uKQ=; b=PkIXzmG/uhkUxQw1wr7jmzr3tgZfJgHdTeMyWMyZi48QrhPUirUV9t7wqRUuJMgl10 50kUSKyk9eTLIjwJgpz1uo0icvZud0NALr5uLzNubST8RAacFiIkgBNqEduYH8yKOST6 kZSNfNF9EIOpOskIwfS3NXzrzvUpvznYeqRo4Ow+z/jPjg1ZVRRUUDQ0P1IS+BlS3Tdd EUoYWFB/NudXzwuMszhfwowRUJK2vUIrwITaGBm5OPRotoDPh2KlwW14943uIkjPLsqe uYwUshvQV6xE+EV6T7l+nVktm8ivpZJLdP6aCwHlxgq8OZrSldEY0z60JbhVHnuJtMwF 5Isg== 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 dn21si8561509edb.483.2021.06.08.02.52.45; Tue, 08 Jun 2021 02:53:21 -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 S230398AbhFHJwH (ORCPT + 99 others); Tue, 8 Jun 2021 05:52:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230222AbhFHJwE (ORCPT ); Tue, 8 Jun 2021 05:52:04 -0400 X-Greylist: delayed 39788 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 08 Jun 2021 02:50:09 PDT Received: from relay02.th.seeweb.it (relay02.th.seeweb.it [IPv6:2001:4b7a:2000:18::163]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2A42C061574 for ; Tue, 8 Jun 2021 02:50:09 -0700 (PDT) Received: from [10.0.20.3] (94-209-165-62.cable.dynamic.v4.ziggo.nl [94.209.165.62]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r1.th.seeweb.it (Postfix) with ESMTPSA id E17791F539; Tue, 8 Jun 2021 11:50:06 +0200 (CEST) Subject: Re: [PATCH BlueZ] Queue SetAbsoluteVolume if there is an in-progress one. To: Luiz Augusto von Dentz Cc: Sonny Sasaka , "linux-bluetooth@vger.kernel.org" References: <9d386692-4c1c-b262-bca2-cec3568dc579@somainline.org> From: Marijn Suijten Message-ID: Date: Tue, 8 Jun 2021 11:50:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Luiz, On 6/8/21 1:47 AM, Luiz Augusto von Dentz wrote: > Hi Marijn, > [..] >> We've been running into a similar issue with PulseAudio. There is no >> way to track a Set call for the Volume property back to the >> property-change notification, running into both jitter on quick >> successive volume changes and the inability to reflect peer hardware >> volume in case the peer rounds the requested volume to a coarser scale. >> This rounded value is supposedly returned from SetAbsoluteVolume >> according to AVRCP spec 1.6.2, section 6.13.2: >> >> The volume level which has actually been set on the TG is returned in >> the response. >> >> I would have proposed a new DBUS function SetAbsoluteVolume that accepts >> volume as sole argument, blocks until the peer replies, and returns the >> actual volume as per its namesake AVRCP command. This should address >> both issues. >> >> Note that it is also impossible to distinguish Volume property changes >> from an action invoked on the peer (ie. the user pressing physical >> buttons or using a volume slider on headphones) or the result of an >> earlier Set(Volume) call as these to my knowledge all happen async, may >> be intertwined, may involve rounding (on the peer) to make the resulting >> number different, etc. > > Yep, the volume may actually be rounded like you said, so Im not > really sure how we can queue because we will not be able to verify the > volume has been set properly, we could do a blocking call even in case > of setting as a property we only need to delay the call to > g_dbus_pending_property_success until we actually receive a response, > that said there maybe some impact on the user experience since if you > have the volume implemented with something like a slider it will not > move smoothly anymore, but I guess that is better than have it > flipping back and forth, well except that can still happens because > the volume can be changed on the device in the meantime but I guess > the client wont see those changes until the method returns if it is > blocking waiting for the reply, which means it will only see that the > value flipped to something else later when the signals are dispatched. The main use-case is software volume compensation for devices with limited granularity, for which we need to know exactly what is replied to AVRCP's SetAbsoluteVolume call. Delaying g_dbus_pending_property_success will only block the call longer but won't exactly let us know the resulting value. We can immediately Get the new property after (or try and relate the change notification to it), but there's nothing preventing a change on the device intervening. In that case we should discard requested volume (on the host) and software compensation, and take/display device volume as-is. This seems unfortunate as the AVRCP spec provides exactly the consistency we're looking for here. As for user experience it seems acceptable to make such a call block until the peer replies, if only for a much more predictable API. It is then up to the caller (ie. PulseAudio) to deal with that by disabling/blocking the slider, or scheduling the most recent volume update to be sent as soon as a reply is received (the DBus call returns). > > If you feel like that is acceptable I'm happy to review any patches in > that direction. > [..] > -- > Luiz Augusto von Dentz - Marijn