All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] A2DP: signaling channel never closed
@ 2006-07-26 22:55 Sebastien Henrio
  2006-07-27  0:43 ` Brad Midgley
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Henrio @ 2006-07-26 22:55 UTC (permalink / raw)
  To: bluez-devel

[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]

Hi all,

I found a bad behaviour in alsa-plugin: signaling channel is never
closed. So if remote device doesn't close it (and It's recommended to
keep it opened), alsa plugin will open a new signaling channel for
each connection, until remote device isnot able to accept any new
L2CAP connection.

to reproduce the bug, you must have a device that doesn't close the
signaling channel and then simply press STOP and PLAY several times on
XMMS using alsa plugin....

So I just close signaling channel before doing a free of a2dp
structure. another fix can be to use the signaling channel for next
connection

In this patch I also add the parsing of sbc parameters (bitpool, sub
band and block len).

I think it's important to merge signaling patch in CVS.

adding the ability to configure the codec is of course less important.


I found also another bug and I don't know how to solve it.  When you
use XMMS with alsa output plugin (or other apps like amarok...) when I
do a brutal disconnection of the SNK after several seconds xmms (or
amarok) uses 100% of my cpu I have some idea but I don't know how to
fiw it

Best regards
Sebastien

[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 1916 bytes --]

Index: pcm_a2dp.c
===================================================================
RCS file: /cvsroot/bluetooth-alsa/btsco/alsa-plugins/pcm_a2dp.c,v
retrieving revision 1.13
diff -r1.13 pcm_a2dp.c
977,979d976
< 	a2dp->sbc.subbands = 8; // safe default
< 	a2dp->sbc.blocks = 16; // safe default
< 	a2dp->sbc.bitpool = 32; // recommended value 53, safe default is 32
1212a1210,1212
> 	if (a2dp->control_sk > fileno(stderr))
> 		close(a2dp->control_sk);
> 
1345a1346,1347
> 	long bitpool = -1,subbnd = -1, blklen = -1;
> 
1380a1383,1410
> 		if (!strcmp(id, "sbc_bitpool")) {
> 			if ((err = snd_config_get_integer(n, &bitpool )) < 0 &&
> 					( bitpool < 0 || 254 < bitpool))  {
>                                 SNDERR("The field for bitpool must be an unsigned integer");
>                                 return err;
>                         }
> 			continue;
> 		}
> 
> 		if (!strcmp(id, "sbc_blklen")) {
> 			if ((err = snd_config_get_integer(n, &blklen)) < 0 &&
> 					( blklen != 4 && blklen != 8 && blklen != 12 && blklen != 16)) {
> 				SNDERR("The field for blocklen must be either 4, 8, 12 or 16");
> 				return err;
> 			}
> 			continue;
> 		}
> 
> 		if (!strcmp(id, "sbc_subband")) {
> 			if ((err = snd_config_get_integer(n, &subbnd)) < 0 &&
> 				 ( subbnd != 4 && subbnd != 8)) {
> 				SNDERR("The field for subband must be either 4 or 8");
> 				return err;
> 			}
> 			continue;
> 		}
> 
> 
1428a1459,1477
> 	a2dp->sbc.subbands = 8; // safe default
> 	a2dp->sbc.blocks = 16; // safe default
> 	a2dp->sbc.bitpool = 32; // recommended value 53, safe default is 32
> 
> 	if (bitpool != -1){
> 		DBG("sbc : bitpool %d" , (int)bitpool);
> 		a2dp->sbc.bitpool = (int)bitpool;
> 	}
> 
> 	if (blklen != -1){
> 		DBG("sbc : subbands %d" , (int)subbnd);
> 		a2dp->sbc.subbands = (int)subbnd;
> 	}
> 
> 	if (blklen != -1){
> 		DBG("sbc : blklen %d" , (int)blklen);
> 		a2dp->sbc.blocks = (int)blklen;
> 	}
> 

[-- Attachment #3: Type: text/plain, Size: 348 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Bluez-devel] A2DP: signaling channel never closed
  2006-07-26 22:55 [Bluez-devel] A2DP: signaling channel never closed Sebastien Henrio
@ 2006-07-27  0:43 ` Brad Midgley
  2006-07-28 13:25   ` Sebastien Henrio
  0 siblings, 1 reply; 4+ messages in thread
From: Brad Midgley @ 2006-07-27  0:43 UTC (permalink / raw)
  To: BlueZ development

Sebastien

I'm glad you came across this. Would you mind resending the patch using
the output from
 diff -u
so it's easier to read and apply?

Which headset did you observe the problem on?

thanks
Brad

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Bluez-devel] A2DP: signaling channel never closed
  2006-07-27  0:43 ` Brad Midgley
@ 2006-07-28 13:25   ` Sebastien Henrio
  2006-07-28 22:05     ` Brad Midgley
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Henrio @ 2006-07-28 13:25 UTC (permalink / raw)
  To: BlueZ development; +Cc: Sebastien HENRIO

[-- Attachment #1: Type: text/plain, Size: 902 bytes --]

Hi Brad,

sorry for the patch, you can find in attachement the new patch in the
correct format

Best Regards
Sebastien

Brad Midgley wrote:
> Sebastien
> 
> I'm glad you came across this. Would you mind resending the patch using
> the output from
>  diff -u
> so it's easier to read and apply?
> 
> Which headset did you observe the problem on?
> 
> thanks
> Brad
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
> 


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 2587 bytes --]

Index: pcm_a2dp.c
===================================================================
RCS file: /cvsroot/bluetooth-alsa/btsco/alsa-plugins/pcm_a2dp.c,v
retrieving revision 1.13
diff -u -r1.13 pcm_a2dp.c
--- pcm_a2dp.c	12 Jul 2006 05:47:07 -0000	1.13
+++ pcm_a2dp.c	28 Jul 2006 12:58:26 -0000
@@ -974,9 +974,6 @@
 
 	a2dp->sbc.rate = io->rate;
 	a2dp->sbc.channels = io->channels;
-	a2dp->sbc.subbands = 8; // safe default
-	a2dp->sbc.blocks = 16; // safe default
-	a2dp->sbc.bitpool = 32; // recommended value 53, safe default is 32
 
 	return 0;
 }
@@ -1210,6 +1207,9 @@
 	if (a2dp->sk > fileno(stderr))
 		close(a2dp->sk);
 
+	if (a2dp->control_sk > fileno(stderr))
+		close(a2dp->control_sk);
+
 	sbc_finish(&a2dp->sbc);
 
 	free(a2dp);
@@ -1343,6 +1343,8 @@
 	snd_config_iterator_t i, next;
 	bdaddr_t src, dst;
 	int err, n, pos = -1, use_rfcomm = 0;
+	long bitpool = -1,subbnd = -1, blklen = -1;
+
 
 	DBG("name %s mode %d", name, mode);
 
@@ -1378,6 +1380,34 @@
 			continue;
 		}
 
+		if (!strcmp(id, "sbc_bitpool")) {
+			if ((err = snd_config_get_integer(n, &bitpool )) < 0 &&
+					( bitpool < 0 || 254 < bitpool))  {
+                                SNDERR("The field for bitpool must be an unsigned integer");
+                                return err;
+                        }
+			continue;
+		}
+
+		if (!strcmp(id, "sbc_blklen")) {
+			if ((err = snd_config_get_integer(n, &blklen)) < 0 &&
+					( blklen != 4 && blklen != 8 && blklen != 12 && blklen != 16)) {
+				SNDERR("The field for blocklen must be either 4, 8, 12 or 16");
+				return err;
+			}
+			continue;
+		}
+
+		if (!strcmp(id, "sbc_subband")) {
+			if ((err = snd_config_get_integer(n, &subbnd)) < 0 &&
+				 ( subbnd != 4 && subbnd != 8)) {
+				SNDERR("The field for subband must be either 4 or 8");
+				return err;
+			}
+			continue;
+		}
+
+
 		if (!strcmp(id, "use_rfcomm")) {
 			if ((err = snd_config_get_bool(n)) < 0) {
                                 SNDERR("The field use_rfcomm must be a boolean type");
@@ -1426,6 +1456,25 @@
 		bacpy(&a2dp->dst, &dst);
 		a2dp->use_rfcomm = use_rfcomm;
 	}
+	a2dp->sbc.subbands = 8; // safe default
+	a2dp->sbc.blocks = 16; // safe default
+	a2dp->sbc.bitpool = 32; // recommended value 53, safe default is 32
+
+	if (bitpool != -1){
+		DBG("sbc : bitpool %d" , (int)bitpool);
+		a2dp->sbc.bitpool = (int)bitpool;
+	}
+
+	if (blklen != -1){
+		DBG("sbc : subbands %d" , (int)subbnd);
+		a2dp->sbc.subbands = (int)subbnd;
+	}
+
+	if (blklen != -1){
+		DBG("sbc : blklen %d" , (int)blklen);
+		a2dp->sbc.blocks = (int)blklen;
+	}
+
 
 	a2dp_unlock();
 

[-- Attachment #3: Type: text/plain, Size: 348 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Bluez-devel] A2DP: signaling channel never closed
  2006-07-28 13:25   ` Sebastien Henrio
@ 2006-07-28 22:05     ` Brad Midgley
  0 siblings, 0 replies; 4+ messages in thread
From: Brad Midgley @ 2006-07-28 22:05 UTC (permalink / raw)
  To: BlueZ development

Sebastien

> sorry for the patch, you can find in attachement the new patch in the
> correct format

It all looks good and I applied it. I don't have whatever headset shows
this problem so you'll have to cvs update to make sure it merged
properly with Fr=E9d=E9ric's patches.

Brad



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE=
VDEV
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-07-28 22:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-26 22:55 [Bluez-devel] A2DP: signaling channel never closed Sebastien Henrio
2006-07-27  0:43 ` Brad Midgley
2006-07-28 13:25   ` Sebastien Henrio
2006-07-28 22:05     ` Brad Midgley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.