Skip to contentSkip to conversation

A2DP Profile Certification

Bluez-devel Frédéric DALLEAU 3 participants 11 messages May 30, 2006 – Jun 21, 2006 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hi Brad,

I've just read the "Profile ICS for A2DP" that provides information on =

what is mandatory in order to get this profile certified.
We are only concerned about A2DP Source features and the ICS requires =

the following.

- Initiate Connection Establishment,
- Initiate Start Streaming,
- Initiate Connection Release,
- Start Audio Stream,
- SBC encoder,
- Accept Connection Establishment,
- Accept Start Streaming,
- Accept Connection Release.

- An entry must also appear in SDP records.

The five first points are already provided by the bluetooth-alsa plugin. Do you have an idea of what can be done in order to satisfy the other =

requirements?

Thank you,
Fr=E9d=E9ric

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#1 lore raw

Fr=E9d=E9ric

Quoted 3 lines

- Accept Connection Establishment,
- Accept Start Streaming,
- Accept Connection Release.

see a2recv for these. it implements the a2dp sink. there is not any sort of special connection with alsa for this, but i'm not sure it makes sense since this runs more like a daemon and just sends any audio that comes in to the speakers.

Quoted 1 line

- An entry must also appear in SDP records.

sdptool add A2SNK

brad

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#2 lore raw

Hi brad,

We must be very careful here : The ICS says the Source must accept =

connection establishment, this is different from the sink role because =

the source will accept the connection and then send its audio stream!

As you said, I'm not sure it makes sense, and I can't figure how to test =

it. But I believe a typical scenario would be the following :

- you listen a2dp music from your pc (source) on the headphone (sink).
- someone call your mobile.
- you answer the call so the headphone tell the source to stop a2dp.
- while you talk, the source send audio data to /dev/null.
- when you hangup, the headphone will tell your computer to send the =

music again.

Fr=E9d=E9ric

Brad Midgley a =E9crit :

Quoted 27 lines

Fr=E9d=E9ric

=

Quoted 6 lines

- Accept Connection Establishment,
- Accept Start Streaming,
- Accept Connection Release.
=

see a2recv for these. it implements the a2dp sink. there is not any sort of special connection with alsa for this, but i'm not sure it makes sense since this runs more like a daemon and just sends any audio that comes in to the speakers.

=

Quoted 4 lines

- An entry must also appear in SDP records.
=

sdptool add A2SNK

Quoted 10 lines

brad

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
=

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#3 lore raw

Fr=E9d=E9ric

Quoted 5 lines

We must be very careful here : The ICS says the Source must accept =

connection establishment, this is different from the sink role because =

the source will accept the connection and then send its audio stream!

ok. yes, we're missing a lot of stuff here that we need to handle.

we need to use "sdptool add A2SRC" to advertise the source. we need to listen for new connections and keep listening on the control connection during playback (maybe in another thread)

the alsa plugin can't just block audio writes when the stream is stopped. most alsa clients do not have a separate transmission thread, so the ui will lock up. the way to handle it is to use dbus to tell the audio app to pause if possible.

there is a lot of overlap with avrcp here, so we should make it easy to work that in too.

brad

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#4 lore raw

Hi Brad,

Quoted 10 lines
Quoted 3 lines

We must be very careful here : The ICS says the Source must accept connection establishment, this is different from the sink role because the source will accept the connection and then send its audio stream!

ok. yes, we're missing a lot of stuff here that we need to handle.

we need to use "sdptool add A2SRC" to advertise the source. we need to listen for new connections and keep listening on the control connection during playback (maybe in another thread)

Quoted 7 lines

the alsa plugin can't just block audio writes when the stream is stopped. most alsa clients do not have a separate transmission thread, so the ui will lock up. the way to handle it is to use dbus to tell the audio app to pause if possible.

there is a lot of overlap with avrcp here, so we should make it easy to work that in too.

it might be a good idea to integrate everything into a deamon and only have a stupid ALSA plugin that sends us the PCM data.

Regards

Marcel

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#5 lore raw
In reply to Brad Midgley

Fr=E9d=E9ric,

Quoted 8 lines
Quoted 5 lines

We must be very careful here : The ICS says the Source must accept =

connection establishment, this is different from the sink role because =

the source will accept the connection and then send its audio stream!

=

ok. yes, we're missing a lot of stuff here that we need to handle.

I put code in a2play so it will listen on the control link for suspend/resume from a2dp headset (*if* you use -p for pthreads). This should be a decent model for getting it into the alsa plugin if you want to look at that.

This is how we find out a combo headset is taking a voice call.

Frankly it may be messy getting those signals to the media player. It would be easier to make the alsa plugin just throw away audio it gets while the set wants things suspended.

We're still missing something here... we don't listen for new control connections from the set. You could look at a2recv.c for code that will listen for new connections. This will be more complicated since you may want to use dbus to start up the media player in response.

Brad

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#6 lore raw

Hi brad,

Quoted 7 lines

I put code in a2play so it will listen on the control link for suspend/resume from a2dp headset (*if* you use -p for pthreads). This should be a decent model for getting it into the alsa plugin if you want to look at that.
=

I will have a look by the end of the week.

Quoted 4 lines

This is how we find out a combo headset is taking a voice call.
=

I noticed that my headset stopped streaming when pressing the main =

button and didn't get back playing after pressing the button again. Is that what you mean?

Quoted 6 lines

Frankly it may be messy getting those signals to the media player. It would be easier to make the alsa plugin just throw away audio it gets while the set wants things suspended.
=

Yes for sure, and it's not bad IMHO, you would not like your speaker do =

some sound if you answer a phone call!

Quoted 7 lines

We're still missing something here... we don't listen for new control connections from the set. You could look at a2recv.c for code that will listen for new connections. This will be more complicated since you may want to use dbus to start up the media player in response.
=

I was wondering how to generate such connections? Simply switch on the =

headset? Any ideas?

Fr=E9d=E9ric.

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#7 lore raw

Fr=E9d=E9ric

Quoted 7 lines
Quoted 2 lines

This is how we find out a combo headset is taking a voice call.
=

I noticed that my headset stopped streaming when pressing the main =

button and didn't get back playing after pressing the button again. Is that what you mean?

yes this should cover that scenario.

Quoted 8 lines
Quoted 5 lines

We're still missing something here... we don't listen for new control connections from the set. You could look at a2recv.c for code that will listen for new connections. This will be more complicated since you may want to use dbus to start up the media player in response.

I was wondering how to generate such connections? Simply switch on the =

headset? Any ideas?

the play button on an avrcp set? i was surprised to find when I ran "sdptool add AVRTG" then avrecv that the play button did not cause the set to connect to avrecv. maybe it's really trying to start up a one of these plain a2dp connection (or maybe not doing anything :)

brad

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#8 lore raw

Hi brad

Quoted 6 lines

"sdptool add AVRTG" then avrecv that the play button did not cause the set to connect to avrecv. maybe it's really trying to start up a one of these plain a2dp connection (or maybe not doing anything :)
=

Yes, sdptool add A2SRC followed by hcidump shows an incoming connection!

I suppose the following log shows there is no L2CAP listening socket on =

PSM 25.

Quoted 1 line

ACL data: handle 43 flags 0x02 dlen 12

    L2CAP(s): Connect req: psm 25 scid 0x0040

< ACL data: handle 43 flags 0x02 dlen 16
L2CAP(s): Connect rsp: dcid 0x0000 scid 0x0040 result 2 status 0
Connection refused - PSM not supported

Quoted 3 lines

HCI Event: Number of Completed Packets (0x13) plen 5 HCI Event: Remote Name Req Complete (0x07) plen 255 HCI Event: Disconn Complete (0x05) plen 4

Fr=E9d=E9ric.

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#9 lore raw
In reply to Frédéric DALLEAU

Hi brad,

I've been looking at what you did in a2play.

Quoted 11 lines
Quoted 7 lines

I put code in a2play so it will listen on the control link for suspend/resume from a2dp headset (*if* you use -p for pthreads). This should be a decent model for getting it into the alsa plugin if you want to look at that.
=

I will have a look by the end of the week.
=

I used -p options but I have some problems :
When reading /dev/rtc, I always read 0x8C0 and I only get 50 read per =

sec. If you strip the low byte, it's 8 ticks but the sbc data is 23 ms =

long (190 ticks). So decreasing the tick count to 0 nefore sending data =

takes nearly one second and I have intermittent sound. I fixed it by =

commenting out the "while(ticks <=3D 0)" line, I also tried smaller rtc =

frequency without success. Why not use gettimeofday?

Quoted 9 lines
Quoted 2 lines

This is how we find out a combo headset is taking a voice call.

noticed that my headset stopped streaming when pressing the main =

button and didn't get back playing after pressing the button again. Is that what you mean?
=

I don't receive control commands when doing this. What model do you use?

Quoted 7 lines
Quoted 7 lines

We're still missing something here... we don't listen for new control connections from the set. You could look at a2recv.c for code that will listen for new connections. This will be more complicated since you may want to use dbus to start up the media player in response.
=

Quoted 6 lines

I was wondering how to generate such connections? Simply switch on the =

headset? Any ideas?
=

Last but not least, I receive the frame sent by the headset but it is a =

2 byte "0x00 0x01". Is does not look like a stream_cmd. And only one of =

my heasets sends data.

plus the weather is bad, sad day...

Fr=E9d=E9ric.

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#10 lore raw

Fr=E9d=E9ric

Quoted 1 line

frequency without success. Why not use gettimeofday?

Yeah... I would like to change the rtc stuff to gettimeofday and usleep.

Quoted 1 line

I don't receive control commands when doing this. What model do you use?

I've only tried it with an itech r35. I have a bluetake iphono mini kicking around somewhere that I intend to try.

I keep an avrecv running whenever I do stuff like this just in case the set is trying to use that route.

Quoted 8 lines

Last but not least, I receive the frame sent by the headset but it is a =

2 byte "0x00 0x01". Is does not look like a stream_cmd. And only one of =

my heasets sends data.
=

plus the weather is bad, sad day...

So you wrote code to listen on psm 25?

I think the best way to test that part of things is to have a2play run in a listen mode when it's executed without a bt addr.

Brad

All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D107521&bid=3D248729&dat=3D1=
21642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel