All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Alsa plugin fix
@ 2007-10-07 18:54 Fabien Chevalier
  2007-10-08  0:22 ` [Bluez-devel] " Brad Midgley
  0 siblings, 1 reply; 8+ messages in thread
From: Fabien Chevalier @ 2007-10-07 18:54 UTC (permalink / raw)
  To: Brad Midgley, Johan Hedberg, luiz.dentz, Marcel Holtmann
  Cc: BlueZ development

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

All,

I've spent most of my afternoon fixing the support for my favorite media 
player, the descendant of XMMS : audacious. :-)

Audacious was almost working except for a *very* annoying bug (in our 
side :-( ). It would
eventually stop playing at the end of each song, which meant i would 
have to manually select the next song and hit play again... not very 
funny :-(

Now it looks it works perfectly (didn't have time to check that in 
details, but that should be fixed as soon i tomorrow, after i would
have spent the most part of the day listening to music with Audacious ;-) )

The patch is fairly simple, it implements the delay() call to make sure 
we change the pcm state to the XRUN state whenever the hw_ptr moves
on top of appl_ptr.

Anybody to review it and commit to CVS ?

Cheers,

Fabien

[-- Attachment #2: plugin-xun-fix.diff --]
[-- Type: text/plain, Size: 1391 bytes --]

Index: pcm_bluetooth.c
===================================================================
--- pcm_bluetooth.c	(révision 74)
+++ pcm_bluetooth.c	(copie de travail)
@@ -764,6 +764,25 @@
 	return ret;
 }
 
+static int bluetooth_playback_delay(snd_pcm_ioplug_t *io, 
+				snd_pcm_sframes_t *delayp)
+{
+	DBG("");
+
+	/* This updates io->hw_ptr value using pointer() function */
+	snd_pcm_hwsync(io->pcm);
+ 	
+	*delayp = io->appl_ptr - io->hw_ptr;
+	if ((io->state == SND_PCM_STATE_RUNNING) && (*delayp < 0)) {
+		io->callback->stop(io);
+		io->state = SND_PCM_STATE_XRUN;
+		*delayp = 0;
+	}
+	/* This should never fail, ALSA API is really not
+	prepared to handle a non zero return value */
+	return 0;
+}
+
 static snd_pcm_ioplug_callback_t bluetooth_hsp_playback = {
 	.start			= bluetooth_playback_start,
 	.stop			= bluetooth_playback_stop,
@@ -774,6 +793,7 @@
 	.transfer		= bluetooth_hsp_write,
 	.poll_descriptors	= bluetooth_playback_poll_descriptors,
 	.poll_revents		= bluetooth_playback_poll_revents,
+	.delay			= bluetooth_playback_delay,
 };
 
 static snd_pcm_ioplug_callback_t bluetooth_hsp_capture = {
@@ -798,6 +818,7 @@
 	.transfer		= bluetooth_a2dp_write,
 	.poll_descriptors	= bluetooth_playback_poll_descriptors,
 	.poll_revents		= bluetooth_playback_poll_revents,
+	.delay			= bluetooth_playback_delay,
 };
 
 static snd_pcm_ioplug_callback_t bluetooth_a2dp_capture = {

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

* Re: [Bluez-devel] [PATCH] Alsa plugin fix
  2007-10-07 18:54 [PATCH] Alsa plugin fix Fabien Chevalier
@ 2007-10-08  0:22 ` Brad Midgley
  2007-10-08  8:01   ` Fabien Chevalier
  0 siblings, 1 reply; 8+ messages in thread
From: Brad Midgley @ 2007-10-08  0:22 UTC (permalink / raw)
  To: BlueZ development

Fabien,

I noticed the same problem with xmms, but it works great now. I
committed your fix.

thanks
Brad

On 10/7/07, Fabien Chevalier <fabchevalier@free.fr> wrote:
> All,
>
> I've spent most of my afternoon fixing the support for my favorite media
> player, the descendant of XMMS : audacious. :-)
>
> Audacious was almost working except for a *very* annoying bug (in our
> side :-( ). It would
> eventually stop playing at the end of each song, which meant i would
> have to manually select the next song and hit play again... not very
> funny :-(
>
> Now it looks it works perfectly (didn't have time to check that in
> details, but that should be fixed as soon i tomorrow, after i would
> have spent the most part of the day listening to music with Audacious ;-)=
 )
>
> The patch is fairly simple, it implements the delay() call to make sure
> we change the pcm state to the XRUN state whenever the hw_ptr moves
> on top of appl_ptr.
>
> Anybody to review it and commit to CVS ?
>
> Cheers,
>
> Fabien
>
> Index: pcm_bluetooth.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- pcm_bluetooth.c     (r=E9vision 74)
> +++ pcm_bluetooth.c     (copie de travail)
> @@ -764,6 +764,25 @@
>         return ret;
>  }
>
> +static int bluetooth_playback_delay(snd_pcm_ioplug_t *io,
> +                               snd_pcm_sframes_t *delayp)
> +{
> +       DBG("");
> +
> +       /* This updates io->hw_ptr value using pointer() function */
> +       snd_pcm_hwsync(io->pcm);
> +
> +       *delayp =3D io->appl_ptr - io->hw_ptr;
> +       if ((io->state =3D=3D SND_PCM_STATE_RUNNING) && (*delayp < 0)) {
> +               io->callback->stop(io);
> +               io->state =3D SND_PCM_STATE_XRUN;
> +               *delayp =3D 0;
> +       }
> +       /* This should never fail, ALSA API is really not
> +       prepared to handle a non zero return value */
> +       return 0;
> +}
> +
>  static snd_pcm_ioplug_callback_t bluetooth_hsp_playback =3D {
>         .start                  =3D bluetooth_playback_start,
>         .stop                   =3D bluetooth_playback_stop,
> @@ -774,6 +793,7 @@
>         .transfer               =3D bluetooth_hsp_write,
>         .poll_descriptors       =3D bluetooth_playback_poll_descriptors,
>         .poll_revents           =3D bluetooth_playback_poll_revents,
> +       .delay                  =3D bluetooth_playback_delay,
>  };
>
>  static snd_pcm_ioplug_callback_t bluetooth_hsp_capture =3D {
> @@ -798,6 +818,7 @@
>         .transfer               =3D bluetooth_a2dp_write,
>         .poll_descriptors       =3D bluetooth_playback_poll_descriptors,
>         .poll_revents           =3D bluetooth_playback_poll_revents,
> +       .delay                  =3D bluetooth_playback_delay,
>  };
>
>  static snd_pcm_ioplug_callback_t bluetooth_a2dp_capture =3D {
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Bluez-devel mailing list
> Bluez-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluez-devel
>
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] [PATCH] Alsa plugin fix
  2007-10-08  0:22 ` [Bluez-devel] " Brad Midgley
@ 2007-10-08  8:01   ` Fabien Chevalier
  2007-10-08 13:40     ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 8+ messages in thread
From: Fabien Chevalier @ 2007-10-08  8:01 UTC (permalink / raw)
  To: Brad Midgley; +Cc: BlueZ development

> Fabien,
> 
> I noticed the same problem with xmms, but it works great now. I
> committed your fix.

Thanks !

Btw, maybe we should put Audacious on the HOWTO/Audiodevices pages and 
recommand its usage instead of XMMS/BMP, which both seem to have been 
abandonned ?

Fabien

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] [PATCH] Alsa plugin fix
  2007-10-08  8:01   ` Fabien Chevalier
@ 2007-10-08 13:40     ` Luiz Augusto von Dentz
  2007-10-08 14:09       ` Fabien Chevalier
  0 siblings, 1 reply; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2007-10-08 13:40 UTC (permalink / raw)
  To: BlueZ development

Hi,

On 10/8/07, Fabien Chevalier <fabchevalier@free.fr> wrote:
> > Fabien,
> >
> > I noticed the same problem with xmms, but it works great now. I
> > committed your fix.
>
> Thanks !
>
> Btw, maybe we should put Audacious on the HOWTO/Audiodevices pages and
> recommand its usage instead of XMMS/BMP, which both seem to have been
> abandonned ?

It doen't hurt to leave xmms in there since it is just a few lines to
explain how to
enable its support, we just need to mark it as not recommended and include
Audacious as a recommended player along with gstreamer based ones.

btw, great work!

-- =

Luiz Augusto von Dentz
Engenheiro de Computa=E7=E3o

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] [PATCH] Alsa plugin fix
  2007-10-08 13:40     ` Luiz Augusto von Dentz
@ 2007-10-08 14:09       ` Fabien Chevalier
  2007-10-08 16:53         ` Marcel Holtmann
  0 siblings, 1 reply; 8+ messages in thread
From: Fabien Chevalier @ 2007-10-08 14:09 UTC (permalink / raw)
  To: BlueZ development


>> Btw, maybe we should put Audacious on the HOWTO/Audiodevices pages and
>> recommand its usage instead of XMMS/BMP, which both seem to have been
>> abandonned ?
> 
> It doen't hurt to leave xmms in there since it is just a few lines to
> explain how to
> enable its support, we just need to mark it as not recommended and include
> Audacious as a recommended player along with gstreamer based ones.

Hello Luiz,

I 100% agree with you. :-)

Cheers,

Fabien

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] [PATCH] Alsa plugin fix
  2007-10-08 14:09       ` Fabien Chevalier
@ 2007-10-08 16:53         ` Marcel Holtmann
  2007-10-08 19:14           ` [Bluez-devel] Socket concurrency / first tests Olivier Le Pogam
  2007-10-09  8:04           ` [Bluez-devel] [PATCH] Alsa plugin fix Fabien Chevalier
  0 siblings, 2 replies; 8+ messages in thread
From: Marcel Holtmann @ 2007-10-08 16:53 UTC (permalink / raw)
  To: BlueZ development

Hi Fabien,

> I 100% agree with you. :-)

you know that you can edit the wiki by yourself ;)

Regards

Marcel



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* [Bluez-devel] Socket concurrency / first tests
  2007-10-08 16:53         ` Marcel Holtmann
@ 2007-10-08 19:14           ` Olivier Le Pogam
  2007-10-09  8:04           ` [Bluez-devel] [PATCH] Alsa plugin fix Fabien Chevalier
  1 sibling, 0 replies; 8+ messages in thread
From: Olivier Le Pogam @ 2007-10-08 19:14 UTC (permalink / raw)
  To: BlueZ development

Hello,

I have been working on socket concurrency tests in the last days, i.e. 
opening RFCOMM sockets to a maximum number of remote devices (mobile phones 
in this case). I have used a usual "connect" with blocking sockets - 
socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM). Each connection is 
performed to a different mobile phone, I have a row of phones on my desk :)

I'm using a 2.6.22.12 kernel with BlueZ 3.20 libs/utils, and from 1 to 4 
bluetooth dongles (Bt 2.0 EDR USB 2.0, an USB 2.0 hub connected to an USB 
2.0 port). "passkey-agent --default 0000 &" running.

1) With one bluetooth dongle only : I can successfully open up to 7 
concurrent connections to 7 mobile phones, then a sleep(60), then close the 
socket. I simply create one process for each connect() to each device and 
launch them all as fast as possible. It's working fine except :
- when one mobile host is down (I have intentionally switched one off) then 
all next "connect" are delayed, and usually lead to a "connection timeout" 
or "operation now in progress" when leaving the "connect".
- when a pairing is required it is about the same, all the rest seems 
delayed.

2) With more dongles, trying to perform (still at the same time) a connect() 
to one phone on hci0, another on hci1 etc ... up to hci3 (i.e. only 4 
connects to 4 devices), I always get connections errors, and the first 
connection try seems to get a lot of time.

I will certainly come back tomorrow with some hcidumps, but basically I have 
the feeling that some operations are blocking, and I also wonder about the 
blocking connect() timeout, which sometimes makes connect() exit with a 
E_INPROGRESS or a connection timeout -in my opinion- a bit too quickly.

If someone could help me in my investigations it would be really great !!

Best regards,
Oli 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] [PATCH] Alsa plugin fix
  2007-10-08 16:53         ` Marcel Holtmann
  2007-10-08 19:14           ` [Bluez-devel] Socket concurrency / first tests Olivier Le Pogam
@ 2007-10-09  8:04           ` Fabien Chevalier
  1 sibling, 0 replies; 8+ messages in thread
From: Fabien Chevalier @ 2007-10-09  8:04 UTC (permalink / raw)
  To: BlueZ development

Hi Marcel,

> Hi Fabien,
> 
>> I 100% agree with you. :-)
> 
> you know that you can edit the wiki by yourself ;)
> 

Sure, just wanted to make sure you guys would agree before to make the 
changes :-)

Cheers,

Fabien

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

end of thread, other threads:[~2007-10-09  8:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-07 18:54 [PATCH] Alsa plugin fix Fabien Chevalier
2007-10-08  0:22 ` [Bluez-devel] " Brad Midgley
2007-10-08  8:01   ` Fabien Chevalier
2007-10-08 13:40     ` Luiz Augusto von Dentz
2007-10-08 14:09       ` Fabien Chevalier
2007-10-08 16:53         ` Marcel Holtmann
2007-10-08 19:14           ` [Bluez-devel] Socket concurrency / first tests Olivier Le Pogam
2007-10-09  8:04           ` [Bluez-devel] [PATCH] Alsa plugin fix Fabien Chevalier

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.