jancona / android-on-freerunner

Automatically exported from code.google.com/p/android-on-freerunner
1 stars 1 forks source link

Audio via bluetooth doesn't work. #31

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Pair bt headset
2. Try to playback
3. Audio is only routed to speakers or minijack output.

What is the expected output? What do you see instead?
If bt headset is paired, audio should be routed to it somehow.

What version of the product are you using? On what operating system?
Latest.

Please provide any additional information below.
Brian Code commited "Temporarily remove A2DP support as it conflicts with
playing any audio"
http://gitorious.org/android-on-freerunner/platform_frameworks_base/commit/dc2b3
4943be7f14590f897d2e195318d947dd166

I tested this uncommented last night, and everything went nonresponsive,
only got a debug from adb which is attached to my post.

Original issue reported on code.google.com by jokr.nil...@gmail.com on 7 Oct 2009 at 11:53

Attachments:

GoogleCodeExporter commented 9 years ago
@serdar

New bugreport attached, summary:

10-07 21:01:48.404 D/BT HSHFP(  907): SDP request returned 1 (1534 ms)
10-07 21:01:48.419 I/BT HSHFP(  907): Created RFCOMM socket fd 40.
10-07 21:01:48.419 I/BT HSHFP(  907): async connect is in progress (Operation 
now in
progress)
10-07 21:01:49.139 I/BT HSHFP(  907): Successful RFCOMM socket connect.
10-07 21:01:49.139 D/BT HSHFP(  907): RFCOMM connection attempt took 719 ms
10-07 21:01:49.139 D/BT HSHFP(  907): Rfcomm connected
10-07 21:01:49.139 D/BT HSHFP(  907): Headset state 1 -> 2, result = 1
10-07 21:01:49.339 D/TrackingPatternView(  852): width=480 textureWidth=120
10-07 21:01:49.589 W/BT HSHFP(  907): RFCOMM poll() returned  success (1), but 
with
an unexpected revents bitmask: 0x10
10-07 21:01:49.589 I/Bluetooth HeadsetBase(  907): headset read error 5
10-07 21:01:49.589 D/BT HSHFP(  907): Headset state 2 -> 0, result = 0
10-07 21:01:50.094 D/TrackingPatternView(  852): width=480 textureWidth=120
10-07 21:01:50.694 I/ARMAssembler(  852): generated
scanline__00000177:03515104_00000A01_00000000 [ 67 ipp] (105 ins) at
[0x1f16e0:0x1f1884] in 0 ns
10-07 21:01:50.964 D/dalvikvm(  907): GC freed 4161 objects / 253008 bytes in 
1062ms
10-07 21:01:54.419 D/BluetoothA2dpService(  852): Auto-connecting A2DP to sink
00:16:93:00:07:B8
10-07 21:01:54.419 D/BluetoothA2dpService(  852): connectSink(00:16:93:00:07:B8)
10-07 21:01:54.439 D/BluetoothA2dpService(  852): new bluez sink: 
00:16:93:00:07:B8
(/org/bluez/audio/device0)
10-07 21:01:54.474 D/BluetoothA2dpService(  852): state 00:16:93:00:07:B8
(/org/bluez/audio/device0) 0->1
10-07 21:01:56.379 W/InputManagerService(  852): Window already focused, 
ignoring
focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@436f5c38
10-07 21:01:56.564 D/BluetoothA2dpService(  852): state 00:16:93:00:07:B8
(/org/bluez/audio/device0) 1->2
10-07 21:02:02.389 D/dalvikvm(  852): GC freed 5440 objects / 237568 bytes in 
241ms

Original comment by jokr.nil...@gmail.com on 7 Oct 2009 at 9:17

Attachments:

GoogleCodeExporter commented 9 years ago
Here's a new bugreport, this time with only the patch and these commented as 
they were:
# LOCAL_SRC_FILES += A2dpAudioInterface.cpp
# LOCAL_SHARED_LIBRARIES += liba2dp

Original comment by jokr.nil...@gmail.com on 8 Oct 2009 at 12:34

Attachments:

GoogleCodeExporter commented 9 years ago
Hello,
I can pair with bluetooth headset but during call can't hear nothing. Where is 
the 
problem?

Original comment by alessand...@gmail.com on 11 Jan 2010 at 1:12

GoogleCodeExporter commented 9 years ago
Hello there,
I think I fixed the problem, at least it works on my freerunner phone + Android 
cupcake. (I just called my family using BT headset)

There are two main modifications:
1, AudioHardwareALSA.cpp[h]
   when talking with bluetooth headset, an input stream must be opened.
2, asound.conf
   device for bluetooth must be 1, not 0.

you can refer to attached files for detail.
BTW, 
   to simplify AudioHardwareALSA (make me read&understand eaiser), I deleted code related to volume control. so this modification can't change volume when playing audio.
   but I think it's not a problem for you guys to recover that. :)

ZHANG Yi
2010-10-25

Original comment by raizh...@gmail.com on 25 Oct 2010 at 11:50

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Zhang Yi,

Thanks for your contribution!

Could you try to create diff/patch files using Git?

This allows us to review the changes you've made and validate the patch.

Thanks again for your work.

Regards,

Niels.

Original comment by niels.he...@gmail.com on 25 Oct 2010 at 1:29

GoogleCodeExporter commented 9 years ago
Niels,
attached two patches.
one for asound.conf, the other for alsa_sound.
Hope it works. 

Regards,
ZHANG Yi

Original comment by raizh...@gmail.com on 26 Oct 2010 at 3:46

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Zhang Yi,

Just locally applied the patch on the alsa_sound and asound.conf sources. Could 
you beautify your code to get rid of the whitespace warnings listed below?

Thanks,

Niels.

alsa_sound_0001-solved-bluetooth-headset-no-sound-issue.patch:54: trailing 
whitespace.
        mInput->setDevice(mMode, routes); 

alsa_sound_0001-solved-bluetooth-headset-no-sound-issue.patch:70: space before 
tab in indent.
    if (mInput) {

alsa_sound_0001-solved-bluetooth-headset-no-sound-issue.patch:71: trailing 
whitespace.
        mInput->setDevice(mMode, routes);    

alsa_sound_0001-solved-bluetooth-headset-no-sound-issue.patch:72: space before 
tab in indent.
        }

alsa_sound_0001-solved-bluetooth-headset-no-sound-issue.patch:92: trailing 
whitespace.
    bluetooth = true; 

warning: squelched 1 whitespace error
warning: 6 lines add whitespace errors

asound_conf_0001-solved-bluetooth-headset-no-sound-issue.patch:32: new blank 
line at EOF.
+
warning: 1 line adds whitespace errors.

Original comment by niels.he...@gmail.com on 26 Oct 2010 at 9:56

GoogleCodeExporter commented 9 years ago
Niels,
ok, attached new patch for alsa_sound.

but don't know how to modify asound.conf for the whitespace erros since no 
warning on my system when I testing the patch.

Zhang Yi

Original comment by raizh...@gmail.com on 27 Oct 2010 at 9:09

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Zhang Yi,

Thanks for cleaning.

For the asound.conf file, I believe it's a matter of removing the empty blank 
line at the end of the file.

Could you clean that one too?

Should the asound.conf patch be applied to 
external/bleuz/utils/audio/asound.conf and 
vendor/neo/freerunner/etc/asound.conf or just one of these?

Thanks,

Niels.

Original comment by niels.he...@gmail.com on 27 Oct 2010 at 11:14

GoogleCodeExporter commented 9 years ago
Niels,
attached new patch for asound.conf.
the patch is only for vendor/neo/freerunner/etc/asound.conf

Yi.

Original comment by raizh...@gmail.com on 27 Oct 2010 at 12:28

Attachments:

GoogleCodeExporter commented 9 years ago
Zhang Yi,

Compilation went fine here, formatting is OK and you've confirmed this resolves 
the sound issue. I believe the patches are ready to be reviewed by Jim for 
applying to the AoF sources.

Thanks for you work so far!

Jim,

Can you check if these patches can be applied?

Thanks.

Original comment by niels.he...@gmail.com on 27 Oct 2010 at 8:41

GoogleCodeExporter commented 9 years ago
Hi Zhang Yi,

I was getting ready to apply your patches, but I had a couple of questions:

In asound.conf, you changed "pcm.AndroidRecord_Microphone" to 
"pcm.AndroidRecord" Is that change necessary for the fix, or is it part of 
something else you were working on?
In AudioHardwareALSA.cpp, method AudioStreamInALSA::AudioStreamInALSA, your 
patch changes the latency and bufferSize in StreamDefaults _defaults. Again, 
are those changes part of your fix?

Since I don't have a good way to test this and I'm unfamiliar with the code, I 
just want to make sure we're only changing things that are necessary.

Thanks for your contribution!

Original comment by scarhill on 31 Oct 2010 at 2:13

GoogleCodeExporter commented 9 years ago
for this bug, it's not necessary for changing "pcm.AndroidRecord_Microphone" to 
"pcm.AndroidRecord", but I think "pcm.AndroidRecord" is more reasonable.
also, change on latency and bufferSize are not necessary, but more reasonable.

Yi

Original comment by raizh...@gmail.com on 1 Nov 2010 at 1:51

GoogleCodeExporter commented 9 years ago
Committed to cupcake and cupcake-sd branches. Thanks Yi!

Original comment by scarhill on 5 Nov 2010 at 2:56

GoogleCodeExporter commented 9 years ago
Great work Yi, I can confirm that your audio bluetooth update works for making 
and receiving calls via a bluetooth headset.  The fix doesn't seem to have 
worked for playing media files through a bluetooth A2DP headset.

Original comment by noel.sal...@gmail.com on 12 Nov 2010 at 5:44

GoogleCodeExporter commented 9 years ago
Noel,
Thanks for the information.
A2DP using ACL not SCO, so this fix is not for A2DP headset.

Original comment by raizh...@gmail.com on 12 Nov 2010 at 10:07

GoogleCodeExporter commented 9 years ago
Yi

Thanks for the clarification.

Noel

Original comment by noel.sal...@gmail.com on 13 Nov 2010 at 1:28