Skip to contentSkip to conversation

a2dp timing

Bluez-devel Brad Midgley 3 participants 11 messages Mar 25, 2005 – Apr 5, 2005 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hi

We've had problems with a2dp timing that I've been ignoring.

For one, a2play crams frames into the headset just as fast as it can. Sometimes this is too fast. So we need to clock it so things are staggered properly. Does the SBC encoder give us a clue about timing between frames?

Second, if the headset wanders out of range, the player stops and starts up where it left off when the headset is back. If we're pacing things properly, we need to drop frames instead when this happens. I'm thinking if it results in a legal SBC stream that I'll drop entire SBC frames in the main loop with something like:

	frame_len = read_header(fd, &sbc_info);
	bytes_read = read(fd, killbuffer, frame_len);

Are there other timing issues I need to think about? Does it get so messy that I need to watch jitter? I can only vaguely remember this stuff from my networking classes...

Brad

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#1 lore raw

Hi Brad,

Quoted 6 lines

We've had problems with a2dp timing that I've been ignoring.

For one, a2play crams frames into the headset just as fast as it can. Sometimes this is too fast. So we need to clock it so things are staggered properly. Does the SBC encoder give us a clue about timing between frames?

it would be really great to get a FTS or CATC trace from the HP headphone and the iPAQ for example.

In the case of an ALSA plugin, we may simple use the timing of the ALSA system itself. However it would be great if the SBC encoder would also calculate the time of the PCM fragment.

Quoted 8 lines

Second, if the headset wanders out of range, the player stops and starts up where it left off when the headset is back. If we're pacing things properly, we need to drop frames instead when this happens. I'm thinking if it results in a legal SBC stream that I'll drop entire SBC frames in the main loop with something like:

	frame_len = read_header(fd, &sbc_info);
	bytes_read = read(fd, killbuffer, frame_len);

And then you need to sleep some time before reading/dropping the next SBC frame.

Quoted 3 lines

Are there other timing issues I need to think about? Does it get so messy that I need to watch jitter? I can only vaguely remember this stuff from my networking classes...

I don't think that this will be needed, but we will see.

Regards

Marcel

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#2 lore raw
Quoted 2 lines · Marcel Holtmann

it would be really great to get a FTS or CATC trace from the HP headphone and the iPAQ for example.

Please tell me how to do it. I will be happy to help. However I don't have the bluesoleil stack....

--=20
Bien =E0 vous - Best regards,
Guylhem P. Aznar

--=20
*@externe.net http://externe.n=
et
P=E9rim=E9/Deprecated: @oeil.qc.ca, @metalab.unc.edu, @ibiblio.org, @7=
un.org
GPG: 92EB37C1 DD11C9C9 20519D01 E8FA1B11 42975AF7 http://externe.net/pubk=
ey

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#3 lore raw

Hi Guylhem,

Quoted 5 lines
Quoted 2 lines

it would be really great to get a FTS or CATC trace from the HP headphone and the iPAQ for example.

Please tell me how to do it. I will be happy to help. However I don't have the bluesoleil stack....

do you have the Frontline FTS4BT or the CATC Merlin II sniffer?

Regards

Marcel

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#4 lore raw
Quoted 3 lines · Marcel Holtmann
Quoted 1 line

However I don't have the bluesoleil stack....

=20
do you have the Frontline FTS4BT or the CATC Merlin II sniffer?

Looks like it's dedicated hardware - nope. I though some software sniffing was possible (ala tcpdump with hcidump)

--=20
Bien =E0 vous - Best regards,
Guylhem P. Aznar

--=20
*@externe.net http://externe.n=
et
P=E9rim=E9/Deprecated: @oeil.qc.ca, @metalab.unc.edu, @ibiblio.org, @7=
un.org
GPG: 92EB37C1 DD11C9C9 20519D01 E8FA1B11 42975AF7 http://externe.net/pubk=
ey

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#5 lore raw

Hi Guylhem,

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

However I don't have the bluesoleil stack....

do you have the Frontline FTS4BT or the CATC Merlin II sniffer?

Looks like it's dedicated hardware - nope. I though some software sniffing was possible (ala tcpdump with hcidump)

not for air sniffing and that is what you actually need in this case.

Regards

Marcel

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#6 lore raw

btlog anyone? Re: [Bluez-devel] a2dp timing

In reply to Guylhem Aznar

Guylhem

I suspect this is a dead end, but maybe someone on the list has access to btlog to sniff the traffic headed out the pocketpc:

http://66.45.42.84/Support/bTW_CE_faq.asp
http://66.45.42.84/Support/btw_ce_DK_index.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcecomm5/html/wce50howHowToCaptureLogDataUsingBTLogTool.asp

Brad

Quoted 10 lines · Marcel Holtmann
Quoted 4 lines
Quoted 2 lines

However I don't have the bluesoleil stack....

do you have the Frontline FTS4BT or the CATC Merlin II sniffer?

Looks like it's dedicated hardware - nope. I though some software sniffing was possible (ala tcpdump with hcidump)

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#7 lore raw
In reply to Marcel Holtmann

Marcel

Quoted 3 lines

In the case of an ALSA plugin, we may simple use the timing of the ALSA system itself. However it would be great if the SBC encoder would also calculate the time of the PCM fragment.

ok, I will look at the plugin again. I was discouraged before by the complexity and by the fact that a lot of alsa clients won't let you choose a userspace plugin device (and even with those that do, you have to remember and type in an alsa device name to reach a userspace plugin)

Quoted 5 lines
Quoted 2 lines
	frame_len = read_header(fd, &sbc_info);
	bytes_read = read(fd, killbuffer, frame_len);

And then you need to sleep some time before reading/dropping the next SBC frame.

of course from the plugin, these won't be read() calls, they will be calls into the sbc lib.

brad

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#8 lore raw

Hi Brad,

Quoted 8 lines
Quoted 3 lines

In the case of an ALSA plugin, we may simple use the timing of the ALSA system itself. However it would be great if the SBC encoder would also calculate the time of the PCM fragment.

ok, I will look at the plugin again. I was discouraged before by the complexity and by the fact that a lot of alsa clients won't let you choose a userspace plugin device (and even with those that do, you have to remember and type in an alsa device name to reach a userspace plugin)

the flag for that is there, but the ALSA core does not use it. Seems like I need to remind Takashi to add it.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
	frame_len = read_header(fd, &sbc_info);
	bytes_read = read(fd, killbuffer, frame_len);

And then you need to sleep some time before reading/dropping the next SBC frame.

of course from the plugin, these won't be read() calls, they will be calls into the sbc lib.

In case of the plugin you can simply drop the PCM fragment.

Regards

Marcel

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#9 lore raw

Marcel

FYI, I found alsa-lib post-1.0.8 has fixed up the plugin api so plugins really can be built standalone. The plugins were moved to a different cvs project "alsa-plugins" and the api changed in the process.

I changed our reference plugin to be based on the new oss plugin. I will work on the a2dp source side of things here. It looks much more straightforward now.

I suppose we could implement a2dp sink as well, but I don't think connections can be initiated by a sink--it has to listen for the source to make the connection.

I'm keeping the cvs code up to date in case anyone wants to look (in btsco/bt)

On a more pragmatic note, I sold my bluetake to a friend so it won't be as easy to try things on it. I bought one of the iTech sets so hopefully development can go well with the new headset.

Brad

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

maintainer
#10 lore raw

Hi Brad,

Quoted 3 lines

FYI, I found alsa-lib post-1.0.8 has fixed up the plugin api so plugins really can be built standalone. The plugins were moved to a different cvs project "alsa-plugins" and the api changed in the process.

I know and actually the utils CVS already contains a plugin for SBC over RFCOMM. Was a simple proof-of-concept thing.

Quoted 3 lines

On a more pragmatic note, I sold my bluetake to a friend so it won't be as easy to try things on it. I bought one of the iTech sets so hopefully development can go well with the new headset.

I think we really need the Logitech/HP headphone for further development and so if anyone wants to support this, do a PayPal donation and then I will buy one for Brad and me.

Regards

Marcel

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel