Use hardware volume on BT headset/speaker |
|||
Issue descriptionBackground on volume type: - Using software volume means that Chrome OS audio server scales the PCM data by a volume factor before send to BT headset/speaker. - Using hardware volume means Chrome OS audio server sends original PCM data, and the BT headset/speaker itself alters the output sound volume. There are a few ways to change hardware volume, like press a physical button from headset/speaker, or Chromebook to send AT command (HFP) or set abs volume command (AVRCP, A2DP). Currently on Chrome OS we use software volume for both HFP and A2DP. The reason is that choosing different volume type on profiles (for example, hardware volume on HFP + soft volume on A2DP) could cause unacceptable volume gap when switch between HFP and A2DP on certain headsets. http://crosbug.com/p/36923 With AVRCP support, CRAS will have the ability to set hardware volume for A2DP headset(of better experience), synchronize the behavior that user presses physical button on headset, and loose the restriction of using software volume on HFP. There are various types of BT headset, of different support level of HFP/A2DP/ARCP. After all cases considered, the rule will be to use hardware volume if and only it headset supports AVRCP and BT headset supports absolute volume, otherwise stick to the old rule to use software volume for both HFP and A2DP. Besides the above rule, there is a delay at when we know the connected BT headset supports absolute volume. Based on my experiment, it's usually a short while after A2DP is connected, and media transport's 'volume' property will be set accordingly. This bug will be used to track the CRAS side change to better integrate BT headset volume function. With below requirements: - Passively detect the capability of connected BT headset, by monitor transport's 'volume' property. - Dynamically change the software_volume_needed flag on hfp/a2dp/bt iodev. - synchronize the software_volume_needed flag between hfp/a2dp/bt iodev. - Handle the transition from using software volume to hardware volume
,
Apr 25 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/adhd/+/f96a10e395815823130ecc9f162b23b4bb4471f9 commit f96a10e395815823130ecc9f162b23b4bb4471f9 Author: Hsin-Yu Chao <hychao@chromium.org> Date: Fri Apr 22 08:24:32 2016 CRAS: bt_io - Clean up the use of software_volume_needed flag Currently for bluetooth audio software volume is used, no matter what profile(HFP, A2DP) is used. In future when AVRCP is supported and remote headset supports absolute volume, we'll be able to use hardware volume on both HFP and A2DP. This change cleans up related code so that only the parent bt_iodev cares about the software_volume_needed flag, and can delegate the volume adjust task to each profile iodev when this flag is unset. BUG= chromium:605035 TEST=Playback in A2DP and record in HFP, adjust volume can work. Change-Id: I662597f8b08c100bfb4ad9539380f9e24e13952d Reviewed-on: https://chromium-review.googlesource.com/340341 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Hsinyu Chao <hychao@chromium.org> [modify] https://crrev.com/f96a10e395815823130ecc9f162b23b4bb4471f9/cras/src/server/cras_a2dp_iodev.c [modify] https://crrev.com/f96a10e395815823130ecc9f162b23b4bb4471f9/cras/src/tests/hfp_iodev_unittest.cc [modify] https://crrev.com/f96a10e395815823130ecc9f162b23b4bb4471f9/cras/src/server/cras_bt_io.c
,
May 25 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/adhd/+/fe893eec58b3cf3dcec71b3d5f2c814aa0cb7d9e commit fe893eec58b3cf3dcec71b3d5f2c814aa0cb7d9e Author: Hsin-Yu Chao <hychao@chromium.org> Date: Fri Apr 29 07:32:30 2016 CRAS: bt_device - Update hardware volume reported by headset This change hooks volume change events from both AVRCP and HFP to iodev layer and then signal to Chrome. Also with this change the hardware volume is enabled if and only if the BT headset reports a valid transport volume, the use_hardware_volume flag will be set accordingly. BUG= chromium:605035 TEST=Test with Plantronics Edge headset, verify pressing the volume button on device could reflect to Chrome OS. and changing volume from Chrome OS keyboard will affect the sound from headset. Test with Jabra Easycall headset, which doesn't support AVRCP, can still change its volume from UI and keyboard by software volume. Change-Id: I65a9fd496e42ebd480a50edfb2d521d64cc30571 Reviewed-on: https://chromium-review.googlesource.com/341954 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Chinyue Chen <chinyue@chromium.org> [modify] https://crrev.com/fe893eec58b3cf3dcec71b3d5f2c814aa0cb7d9e/cras/src/server/cras_bt_device.h [modify] https://crrev.com/fe893eec58b3cf3dcec71b3d5f2c814aa0cb7d9e/cras/src/server/cras_hfp_slc.c [modify] https://crrev.com/fe893eec58b3cf3dcec71b3d5f2c814aa0cb7d9e/cras/src/server/cras_hfp_slc.h [modify] https://crrev.com/fe893eec58b3cf3dcec71b3d5f2c814aa0cb7d9e/cras/src/server/cras_bt_device.c [modify] https://crrev.com/fe893eec58b3cf3dcec71b3d5f2c814aa0cb7d9e/cras/src/server/cras_bt_transport.c [modify] https://crrev.com/fe893eec58b3cf3dcec71b3d5f2c814aa0cb7d9e/cras/src/tests/hfp_slc_unittest.cc [modify] https://crrev.com/fe893eec58b3cf3dcec71b3d5f2c814aa0cb7d9e/cras/src/tests/bt_device_unittest.cc [modify] https://crrev.com/fe893eec58b3cf3dcec71b3d5f2c814aa0cb7d9e/cras/src/server/cras_hfp_ag_profile.c
,
May 25 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/adhd/+/d6ba8e31ac15c1e5c5403aa790597857e3380da8 commit d6ba8e31ac15c1e5c5403aa790597857e3380da8 Author: Hsin-Yu Chao <hychao@chromium.org> Date: Fri Jan 22 03:29:05 2016 CRAS: a2dp_iodev - Implement set volume callback When AVRCP is supported, CRAS will be able to adjust device's hardware volume for A2DP output through the media transport API provided by BlueZ, instead of using software volume. Implement the set_volume of a2dp_iodev, and a later commit will use this set volume path under certain condition. BUG= chromium:605035 TEST=Apply full patch set, and test with Plantronics Edge headset. Press volume up/down key on keyboard, verify the volume changes accordingly. Change-Id: I4c567a951c4e4b5f24ccf3b20f32e9b646feb747 Reviewed-on: https://chromium-review.googlesource.com/340862 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Chinyue Chen <chinyue@chromium.org> [modify] https://crrev.com/d6ba8e31ac15c1e5c5403aa790597857e3380da8/cras/src/server/cras_a2dp_iodev.c [modify] https://crrev.com/d6ba8e31ac15c1e5c5403aa790597857e3380da8/cras/src/server/cras_bt_transport.h [modify] https://crrev.com/d6ba8e31ac15c1e5c5403aa790597857e3380da8/cras/src/tests/a2dp_iodev_unittest.cc [modify] https://crrev.com/d6ba8e31ac15c1e5c5403aa790597857e3380da8/cras/src/server/cras_bt_transport.c
,
May 25 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/adhd/+/c6162bcc6625f3ba6d3ec921cceed625f6793083 commit c6162bcc6625f3ba6d3ec921cceed625f6793083 Author: Hsin-Yu Chao <hychao@chromium.org> Date: Thu Apr 21 09:24:18 2016 CRAS: bt_device - Add use_hardware_volume flag Add a flag to cras_bt_device to indicate it's okay to use device's hardware volume instead of relies on CRAS to scale audio in software. This is a preparation change to add new flag. Later commits will use this flag to control enabling hardware volume, and also set this flag base on the capability reported by BT headset/speaker. BUG= chromium:605035 TEST=None. Since the flags is not used yet. Change-Id: I784ebeee8cace78f73c2c050a2615169d0c6b7cf Reviewed-on: https://chromium-review.googlesource.com/340866 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Chinyue Chen <chinyue@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> [modify] https://crrev.com/c6162bcc6625f3ba6d3ec921cceed625f6793083/cras/src/server/cras_bt_device.c [modify] https://crrev.com/c6162bcc6625f3ba6d3ec921cceed625f6793083/cras/src/server/cras_bt_device.h
,
May 25 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromiumos/third_party/adhd/+/b75c3140f279d4cb038c64e9034f66dca45d302f commit b75c3140f279d4cb038c64e9034f66dca45d302f Author: Hsin-Yu Chao <hychao@chromium.org> Date: Mon Jan 18 03:10:59 2016 CRAS: bt_player - Create bt player in CRAS BlueZ provides media player dbus API for applications to interact with bluetooth headsets/speakers through AVRCP. This change introduces cras_bt_player module using this player API. With the presence of this player object, bluetoothd will start reporting the volume property of cras_bt_transport, which is what we care about. The detail of player capabilities and media events handling will not affect normal usage at all, and future commits will use them for AVRCP qualification. BUG= chromium:605035 TEST=Check debug log to verify CRAS player is registered. Change-Id: I78356fc8e290b64d6d45c5c0a08d70899e090662 Reviewed-on: https://chromium-review.googlesource.com/340861 Commit-Ready: Hsinyu Chao <hychao@chromium.org> Tested-by: Hsinyu Chao <hychao@chromium.org> Reviewed-by: Chinyue Chen <chinyue@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> [modify] https://crrev.com/b75c3140f279d4cb038c64e9034f66dca45d302f/cras/src/server/cras_server.c [add] https://crrev.com/b75c3140f279d4cb038c64e9034f66dca45d302f/cras/src/server/cras_bt_player.c [add] https://crrev.com/b75c3140f279d4cb038c64e9034f66dca45d302f/cras/src/server/cras_bt_player.h [modify] https://crrev.com/b75c3140f279d4cb038c64e9034f66dca45d302f/cras/src/Makefile.am [modify] https://crrev.com/b75c3140f279d4cb038c64e9034f66dca45d302f/cras/src/server/cras_bt_constants.h [modify] https://crrev.com/b75c3140f279d4cb038c64e9034f66dca45d302f/cras/src/server/cras_bt_manager.c
,
May 26 2016
,
May 26 2016
M53 has the required CRAS changes. Let's use issue 599104 to track the rest of the work. |
|||
►
Sign in to add a comment |
|||
Comment 1 by bugdroid1@chromium.org
, Apr 25 2016