avs-device-sdk icon indicating copy to clipboard operation
avs-device-sdk copied to clipboard

No volume control over BT for Iphone as there is no media syc property to set like some Android phones (Samsumg Galaxy A70)

Open mohitbansal19 opened this issue 5 years ago • 19 comments

Briefly summarize your issue:

With AVS-SDK 1.14.0

What is the expected behavior?

There should control of volume over BT with Iphone. Some Android phones have Media sync property and when this property is "Enable" we cannot control volume over BT. On Media sync "Disable", we can control volume over BT. But for Iphone there is no option of Media Sync disable/enable.

What behavior are you observing?

No volume control over BT with Iphone

Provide the steps to reproduce the issue, if applicable:

  1. Configure Alexa
  2. Pair with Iphone
  3. Make connection with BT
  4. Play some music over BT
  5. Up/Down volume
  6. Observe no volume control over BT

Tell us about your environment:

AVS SDK Version 1.14.0 Cross Compiled to run on below Hardware. PulseAudio Bluetooth

What version of the AVS Device SDK are you using?

1.14.0

Tell us what hardware you're using:

Other: Hardware: Samsung Artik 305 Secure Board ARH: ARMv7

Tell us about your OS (Type & version):

Linux, Ubuntu 16.04 Linux artik 4.4.71-UNRELEASED #1 SMP PREEMPT Tue Aug 20 18:39:35 IST 2019 armv7l armv7l armv7l GNU/Linux

Logs after press volume up/down with Iphone

Below are the logs with this situation:-

2019-08-06 00:13:44.555 [ f] 5 BlueZDeviceManager:propertiesChangedCallback 2019-08-06 00:13:44.556 [ f] 7 BlueZDeviceManager:Properties changed:objectPath=/org/bluez/hci0/dev_74_8D_08_75_06_30/fd1 2019-08-06 00:13:44.556 [ f] 9 BlueZDeviceManager:Details:=('org.bluez.MediaTransport1', {'Volume': <uint16 38>}, @as []) 2019-08-06 00:13:44.557 [ f] 7 BlueZDeviceManager:onMediaStreamPropertyChanged:path=/org/bluez/hci0/dev_74_8D_08_75_06_30/fd1 2019-08-06 00:13:44.573 [ f] 5 BlueZDeviceManager:onMediaStreamPropertyChanged:mediaStreamUuid=0000110b-0000-1000-8000-00805f9b34fb 2019-08-06 00:13:44.573 [ f] 5 BlueZDeviceManager:mediaTransportStateUnchanged:action=ignoringCallback

alexa_iphone_volume.log

mohitbansal19 avatar Aug 22 '19 09:08 mohitbansal19

Hi @mohitbansal19, thanks for bringing this to our attention. We will look into this and get back to you ASAP. Thanks!

kclchan avatar Aug 23 '19 21:08 kclchan

Hi @kclchan is there any update on this issue please?

irfankhanharman avatar Aug 27 '19 18:08 irfankhanharman

Hi @kclchan do we support Absolute Volume control in Alexa BT code ?

indrachatterjee86 avatar Aug 29 '19 12:08 indrachatterjee86

Hello @kclchan Adding further information about bluez stack:

Bluez Stack version: 5.42.0 A2DP version: 1.3 AVRCP Version: 1.5

indrachatterjee86 avatar Sep 04 '19 17:09 indrachatterjee86

Hi, the SDK's reference implementation uses PulseAudio for volume control. It appears currently that the PulseAudio BlueZ plugin does not natively support Absolute Volume. However, these messages are being sent by BlueZ. One way to implement this behavior is to create a component that receives and responds to the volume change DBus message. This message looks like:

signal time=1568162287.873064 sender=:1.3 -> destination=(null destination) serial=985 path=/org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX/fd2; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.bluez.MediaTransport1"
   array [
      dict entry(
         string "Volume"
         variant             uint16 9
      )
   ]
   array [
   ]

You can then sync the output volume in your application. You can take a look at BlueZDeviceManager for an example of how to subscribe to DBus messages.

Alternatively, another possibility is to create a patch to the PulseAudio BlueZ plugin to support this, but this is outside the scope of the SDK's support.

kjkh avatar Sep 13 '19 06:09 kjkh

Thank you @kjkh. This information is helpful.

indrachatterjee86 avatar Sep 15 '19 04:09 indrachatterjee86

Hello @kjkh

It is observed that, when Alexa (AVS SDK) Process is not running and Bluetooth audio is streamed using bluetooth daemon service (with plugin = a2dp) and pulse audio, we are able to control volume, with Iphone and other android phones which have Media Sync enabled.

##Below is the output of Pulse audio sources

Source #3 State: RUNNING Name: bluez_source.A0_4E_A7_73_51_BE.a2dp_source Description: HKcontroller’s iPhone Driver: module-bluez5-device.c Sample Specification: s16le 2ch 44100Hz Channel Map: front-left,front-right Owner Module: 16 Mute: no Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB balance 0.00 Base Volume: 65536 / 100% / 0.00 dB Monitor of Sink: n/a Latency: 135511 usec, configured 135294 usec Flags: HARDWARE DECIBEL_VOLUME LATENCY Properties: bluetooth.protocol = "a2dp_source" device.description = "HKcontroller’s iPhone" device.string = "A0:4E:A7:73:51:BE" device.api = "bluez" device.class = "sound" device.bus = "bluetooth" device.form_factor = "phone" bluez.path = "/org/bluez/hci0/dev_A0_4E_A7_73_51_BE" bluez.class = "0x7a020c" bluez.alias = "HKcontroller’s iPhone" device.icon_name = "audio-card-bluetooth" Ports: phone-input: Phone (priority: 0, available) Active Port: phone-input Formats: pcm

##ps aux | grep bluetooth root 3827 0.0 0.6 5316 3176 ? Ss 08:54 0:00 /usr/lib/bluetooth/bluetoothd --plugin=a2dp

##ps aux | grep pulse pulse 2376 6.1 1.4 97836 7252 ? S<sl 08:51 0:40 /usr/local/bin/pulseaudio --system --daemonize=no --disallow-exit

##pactl list short 0 module-udev-detect 1 module-alsa-card device_id="0" name="platform-sound" card_name="alsa_card.platform-sound" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1" 2 module-esound-protocol-unix 3 module-native-protocol-unix 4 module-default-device-restore 5 module-rescue-streams 6 module-always-sink 7 module-suspend-on-idle 8 module-position-event-sounds ##9 module-bluetooth-discover ##10 module-bluez5-discover ##11 module-bluetooth-policy ##16 module-bluez5-device path=/org/bluez/hci0/dev_A0_4E_A7_73_51_BE autodetect_mtu=0 0 alsa_output.platform-sound.stereo-fallback module-alsa-card.c s16le 2ch 48000Hz SUSPENDED 0 alsa_output.platform-sound.stereo-fallback.monitor module-alsa-card.c s16le 2ch 48000Hz SUSPENDED 46 protocol-native.c pactl 0 alsa_card.platform-sound module-alsa-card.c 3 bluez_card.A0_4E_A7_73_51_BE module-bluez5-device.c

When Alexa Process is running, then Bluetooth Modules are not loaded in Pulse Audio and A2DP plugin is removed from Bluetooth.

This is the output when , bluetooth modules are not loaded in PulseAudio ##pactl list short 0 module-udev-detect 1 module-alsa-card device_id="0" name="platform-sound" card_name="alsa_card.platform-sound" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes card_properties="module-udev-detect.discovered=1" 2 module-esound-protocol-unix 3 module-native-protocol-unix 4 module-default-device-restore 5 module-rescue-streams 6 module-always-sink 7 module-suspend-on-idle 8 module-position-event-sounds 0 alsa_output.platform-sound.stereo-fallback module-alsa-card.c s16le 2ch 48000Hz IDLE 0 alsa_output.platform-sound.stereo-fallback.monitor module-alsa-card.c s16le 2ch 48000Hz IDLE 1 protocol-native.c pactl 0 alsa_card.platform-sound module-alsa-card.c

Do you feel that we have an issue with BlueZ plugin in our System ?

indrachatterjee86 avatar Sep 25 '19 09:09 indrachatterjee86

HI @indrachatterjee86,

The default implementation of BlueZ/PulseAudio used by the avs-sdk does not currently support absolute volume changes over bluetooth. We have an issue in our internal tracking system to add support for absolute volume.

samcoult avatar Sep 26 '19 16:09 samcoult

@indrachatterjee86,

Are you compiling with -DBLUETOOTH_BLUEZ_PULSEAUDIO_OVERRIDE_ENDPOINTS=ON? This cmake parameter causes the PulseAudio Bluetooth modules to be unloaded and reloaded by the SDK. Are you seeing any errors in the SDK logs regarding reloading the PulseAudio Bluetooth modules?

kjkh avatar Sep 26 '19 23:09 kjkh

Hi @kjkh Yes, we are compiling with -DBLUETOOTH_BLUEZ_PULSEAUDIO_OVERRIDE_ENDPOINTS=ON. As per your suggestion one thing that we found in SDK logs that PulseAudio Bluetooth modules "unloaded" logs are there but there are no logs (neither success nor failure) for reloaded the modules. Below are the filtered logs of PulseAudio and I am also attaching the complete logs for the same.

49:2019-08-06 00:00:11.223 [ 1] 5 PulseAudioBluetoothInitializer:create 50:2019-08-06 00:00:11.224 [ 1] 5 PulseAudioBluetoothInitializer:init 441:2019-08-06 00:00:11.817 [ 1] 5 PulseAudioBluetoothInitializer:onEventFired 445:2019-08-06 00:00:11.821 [ 6] 5 PulseAudioBluetoothInitializer:run 451:2019-08-06 00:00:11.855 [ 6] 5 PulseAudioBluetoothInitializer:onStateChanged 452:2019-08-06 00:00:11.855 [ 6] 5 PulseAudioBluetoothInitializer:setStateAndNotify 453:2019-08-06 00:00:11.906 [ 13] 5 PulseAudioBluetoothInitializer:onStateChanged 454:2019-08-06 00:00:11.906 [ 13] 5 PulseAudioBluetoothInitializer:setStateAndNotify 455:2019-08-06 00:00:11.920 [ 13] 5 PulseAudioBluetoothInitializer:onStateChanged 456:2019-08-06 00:00:11.920 [ 13] 5 PulseAudioBluetoothInitializer:setStateAndNotify 457:2019-08-06 00:00:11.920 [ 13] 5 PulseAudioBluetoothInitializer:onStateChanged 458:2019-08-06 00:00:11.921 [ 13] 5 PulseAudioBluetoothInitializer:setStateAndNotify 460:2019-08-06 00:00:11.932 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound 461:2019-08-06 00:00:11.933 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound:name=module-udev-detect 462:2019-08-06 00:00:11.933 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound 463:2019-08-06 00:00:11.933 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound:name=module-alsa-card 464:2019-08-06 00:00:11.933 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound 465:2019-08-06 00:00:11.933 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound:name=module-esound-protocol-unix 466:2019-08-06 00:00:11.933 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound 467:2019-08-06 00:00:11.934 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound:name=module-native-protocol-unix 468:2019-08-06 00:00:11.934 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound 469:2019-08-06 00:00:11.934 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound:name=module-default-device-restore 470:2019-08-06 00:00:11.934 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound 471:2019-08-06 00:00:11.934 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound:name=module-rescue-streams 472:2019-08-06 00:00:11.934 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound 473:2019-08-06 00:00:11.934 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound:name=module-always-sink 474:2019-08-06 00:00:11.934 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound 475:2019-08-06 00:00:11.934 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound:name=module-suspend-on-idle 476:2019-08-06 00:00:11.934 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound 477:2019-08-06 00:00:11.934 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound:name=module-position-event-sounds 478:2019-08-06 00:00:11.934 [ 13] 9 PulseAudioBluetoothInitializer:onModuleFound 479:2019-08-06 00:00:11.934 [ 13] 0 PulseAudioBluetoothInitializer:onModuleFound::endOfList 480:2019-08-06 00:00:11.934 [ 6] 0 PulseAudioBluetoothInitializer:run:success=bluetoothModulesUnloaded 482:2019-08-06 00:00:11.935 [ 6] 5 PulseAudioBluetoothInitializer:cleanup 483:2019-08-06 00:00:11.935 [ 6] 5 PulseAudioBluetoothInitializer:onStateChanged 484:2019-08-06 00:00:11.935 [ 6] 5 PulseAudioBluetoothInitializer:setStateAndNotify 485:2019-08-06 00:00:11.943 [ 6] 0 PulseAudioBluetoothInitializer:cleanup::cleanupCompleted

Thanks & Regards, Mohit Bansal

alexa_iphone_volume.log

mohitbansal19 avatar Sep 28 '19 04:09 mohitbansal19

Hi @mohitbansal19,

Apologies for the delayed response. Have you made any progress in getting the PulseAudio Bluetooth modules to reload?

kjkh avatar Oct 21 '19 18:10 kjkh

Hello @kjkh

Sorry for delay in response. Me and the team got engaged in different activities and we could not make much progress on this.

My Last observations: We could load PulseAudio Bluetooth Modules via AVS SDK Code, this can be seen using command "pactl list short". But this did not help much with volume control for iPhones , and we observed that ALexa looses control over BT i.e. both BT music and AVS music plays simultaneously.

We did not debug further on this yet.

indrachatterjee86 avatar Oct 28 '19 14:10 indrachatterjee86

If both BT music and AVS music are playing concurrently, it means that the SDK is not currently managing Bluetooth playback. The PulseAudioBluetoothInitializer will initialize the PulseAudio Bluetooth modules in a way such that the Bluetooth audio will be routed through. In the logs you have sent, it looks like the modules have been unloaded, but not reloaded. I am not seeing any further logs indicating loading failed, was the class modified in some way?

kjkh avatar Nov 05 '19 01:11 kjkh

I am closing this issue due to inactivity. Please feel free to re-open it if it has been closed in error.

kclchan avatar Feb 22 '20 00:02 kclchan

Hi @kclchan We tested this issue with latest v1.18 and issue still persist in SDK. Please let us know is there any plan to fix this issue in SDK?

Thanks Mohit

mohitbansal19 avatar Mar 20 '20 12:03 mohitbansal19

Hi @mohitbansal19,

In order for the AVS SDK process to control Bluetooth focus with the BlueZ/PulseAudio implementation, the BT audio should be routed through to the SDK. In previous discussions, there appeared to be issues with automated module loading and unloading. Can you please attach logs so we can verify this?

kjkh avatar Apr 03 '20 16:04 kjkh

Logs has been attached for the same.

Thanks Mohit Bansal alexaLogs.txt

mohitbansal19 avatar Apr 13 '20 09:04 mohitbansal19

Hi @mohitbansal19, Could you please also provide logs with Android as this would help us further in the investigation.

mvelegon-amzn avatar May 08 '20 20:05 mvelegon-amzn

Hi Team,

Replying on behalf of @mohitbansal19 team, As requested PFA logs with android. Please let me know if something else is required. alexa_android_logs.txt

Regards, Ajay

ajaythakur-dev avatar Jun 24 '20 10:06 ajaythakur-dev