Skip to contentSkip to conversation

Small patch to a2dpd

Bluez-devel Frédéric DALLEAU 4 participants 14 messages Aug 23, 2006 – Sep 7, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Brad,

Latest patch : Default daemon logfile is /dev/null. Try to open an l2cap socket with short timeout before doing sdp_connect that can last very long. Also a script called a2dpair that wrap hcitool and passkey-agent as an effort to simplify pairing and a2dpd setup :D What about Matthew's patches? I plan to move to getopt and cleanup indent and traces so having them integrated first would be better as there are new options.

Frédéric

? .deps
? .libs
? Makefile
? Makefile.in
? a2play
? a2recv
? aclocal.m4
? autom4te.cache
? avrecv
? avsnd
? btsco
? btsco2
? config.guess
? config.h
? config.h.in
? config.log
? config.status
? config.sub
? configure
? depcomp
? install-sh
? libtool
? missing
? stamp-h1
? alsa-plugins/.deps
? alsa-plugins/.libs
? alsa-plugins/Makefile
? alsa-plugins/Makefile.in
? alsa-plugins/a2dp_ipc.lo
? alsa-plugins/a2dp_timer.lo
? alsa-plugins/a2dpd
? alsa-plugins/ctl_a2dpd.lo
? alsa-plugins/ctl_sco.lo
? alsa-plugins/libasound_module_ctl_a2dpd.la
? alsa-plugins/libasound_module_ctl_sco.la
? alsa-plugins/libasound_module_pcm_a2dp.la
? alsa-plugins/libasound_module_pcm_a2dpd.la
? alsa-plugins/libasound_module_pcm_sco.la
? alsa-plugins/pcm_a2dp.lo
? alsa-plugins/pcm_a2dpd.lo
? alsa-plugins/pcm_sco.lo
? avdtp/.deps
? avdtp/.libs
? avdtp/Makefile
? avdtp/Makefile.in
? avdtp/avtest
? sbc/.deps
? sbc/.libs
? sbc/Makefile
? sbc/Makefile.in
? sbc/rcplay
? sbc/sbcdec
? sbc/sbcenc
? sbc/sbcinfo
Index: alsa-plugins/a2dpair
===================================================================
RCS file: alsa-plugins/a2dpair

a2dpair new file +129 -0
diff -N alsa-plugins/a2dpair
@@ -0,0 +1,129 @@
+#!/bin/sh
+
+#
+# Discovery
+#
+echo "Discovery in progress..."
+I=0
+SCANFILE=/tmp/hci_scan
+declare -a ARRAYADDR
+declare -a ARRAYNAME
+
+# We need this file because else there is a problem with arrays in shell
+# The while loop is run in a subshell
+hcitool scan > $SCANFILE
+
+while read BTADDR BTDESC ; do
+	if expr match "$BTADDR" "..:..:..:..:..:.." > /dev/null ; then
+		# Truc
+		echo "$I) [$BTADDR] $BTDESC" 
+		I=`expr $I + 1`
+		ARRAYADDR[$I]="$BTADDR"
+		ARRAYNAME[$I]="$BTDESC"
+	fi
+done < $SCANFILE
+rm -f $SCANFILE
+
+if [ $I -le 0 ] ; then
+	echo "Found $I devices"
+	exit -1
+fi
+
+#
+# Device selection
+#
+SELECTION=
+I=`expr $I - 1`
+while [ -z $SELECTION ] || [ $SELECTION -gt $I ] ; do
+	echo "Choose device (0-$I)"
+	read SELECTION
+done
+# sh uses 1 based arrays
+SELECTION=`expr $SELECTION + 1`
+ADDRESS=${ARRAYADDR[$SELECTION]}
+NAME=${ARRAYNAME[$SELECTION]}
+#
+# Pairing
+#
+echo "Pair device (y/N)?"
+read CANPAIR
+
+if [ "$CANPAIR" = "y" ] ; then
+	
+	# Device passkey
+	SELECTION=
+	while [ -z $SELECTION ] ; do
+		echo "Enter passkey for $NAME"
+		read SELECTION
+	done
+	PASSKEY=$SELECTION
+	
+	# Prefetch password
+	sudo echo "Pairing in progress..."
+	
+	# passkey agent
+	if sudo passkey-agent --default $PASSKEY & PASSPID=$! ; then
+	
+		#echo "Registered passkey-agent pid=$PASSPID"
+	
+		# pairing
+		ANYTEXTISFAILURE=`sudo hcitool cc $ADDRESS 2>&1`
+	
+		if [ -z "$ANYTEXTISFAILURE" ] ; then
+			echo "Pairing successfull"
+			RESULT=0
+		else
+			echo "$ANYTEXTISFAILURE"
+			echo "Pairing failed"
+		fi
+	
+		#echo "Killing pid=$PASSPID"
+		# Kill bg process
+		sudo kill $PASSPID
+	fi
+fi
+
+#
+# A2DP Setting
+#
+echo "Select device for a2dp (y/N)?"
+read A2PARAM
+
+if [ "$A2PARAM" = "y" ] ; then
+	echo "Writing ~/.a2dprc"
+	if [ -f ~/.a2dprc ] ; then
+		mv -f ~/.a2dprc ~/.a2dprc~
+		cat ~/.a2dprc~ | while read LINE ; do
+			# Address line
+			if expr "$LINE" : "address=.*" > /dev/null; then
+				echo "address=$ADDRESS" >> ~/.a2dprc
+			else
+				echo "$LINE" >> ~/.a2dprc
+			fi
+		done
+	else
+		echo "[A2DPD]" > ~/.a2dprc
+		echo "address=$ADDRESS" >> ~/.a2dprc
+	fi
+fi
+
+
+#
+# A2DP Daemon
+#
+echo "Start a2dp daemon (y/N)?"
+read A2DAEMON
+if [ "$A2DAEMON" = "y" ] ; then
+	while killall a2dpd 2> /dev/null ; do
+		echo -n .
+		sleep 1
+	done
+	a2dpd -d +v
+fi
+
+#
+# Ending
+#
+exit 0
+
+############

Index: alsa-plugins/a2dpd.c
===================================================================
RCS file: /cvsroot/bluetooth-alsa/btsco/alsa-plugins/a2dpd.c,v retrieving revision 1.4

a2dpd.c +9 -7
diff -u -r1.4 a2dpd.c
@@ -95,10 +95,10 @@
                 chdir("/");
         }
 
-        // Redirect output to file in silent mode, verbose will print output to stdin/out/err
+        // Redirect output to file (default /dev/null) in silent mode, verbose will print output to stdin/out/err
         if(!bVerbose)
         {
-        int fd;
+                int fd;
                 if ((fd = open(output_file_name, O_CREAT|O_APPEND|O_RDWR, 0)) != -1)
                 {
                         fchmod(fd, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
@@ -764,6 +764,7 @@
                                         setup_socket(new_fd);
                                         int iReceived = 0;
                                         int play = 0;
+                                        int count = 0;
                                         do
                                         {
                                                 iReceived = a2dp_handle_avdtp_message(NULL, new_fd, NULL, NULL, 0);
@@ -771,16 +772,18 @@
                                                 {
                                                         printf("avdtp: socket %d: Received frame, start %s\n", new_fd, g_sCmdNew);
                                                         play=1;
+                                                        count=0;
                                                         break;
                                                 }
-                                                else
+                                                else if(iReceived<0)
                                                 {
-                                                        if(iReceived!=EAGAIN)
+                                                        if(errno!=EAGAIN)
                                                                 printf("avdtp: socket %d: Received failed result=%d (errno=%d:%s)\n", new_fd, iReceived, errno, strerror(errno));
                                                 }
+                                                count++;
                                         }
                                         // AVDTP do not need to have a device connected, since it can establish device connection
-                                        while(!bSigINTReceived && (iReceived>=0 || errno==EAGAIN));
+                                        while(!bSigINTReceived && (iReceived>=0 || errno==EAGAIN) && count<10);
                                         printf("avdtp: socket %d: timed out\n", new_fd);
                                         close_socket(new_fd);
 
@@ -852,7 +855,6 @@
                                 }
                                 else
                                 {
-
                                         if(errno!=EAGAIN)
                                         {
                                                 printf("a2dp_wait_connection failed (AVRCP socket) : %d (errno=%d:%s)\n", new_fd, errno, strerror(errno));
@@ -970,7 +972,7 @@
         read_config_string(g_srcfilename, "a2dpd", "cmdprev",  g_sCmdPrev,  sizeof(g_sCmdPrev),  "");
         read_config_string(g_srcfilename, "a2dpd", "cmdnext",  g_sCmdNext,  sizeof(g_sCmdNext),  "");
         read_config_string(g_srcfilename, "a2dpd", "cmdnew",   g_sCmdNew,   sizeof(g_sCmdNew),  "");
-        read_config_string(g_srcfilename, "a2dpd", "logfile",  g_sOutputFilename,  sizeof(g_sOutputFilename),  "/tmp/a2dpd.log");
+        read_config_string(g_srcfilename, "a2dpd", "logfile",  g_sOutputFilename,  sizeof(g_sOutputFilename),  "/dev/null");
 
         // Parse command line parameters
         for(i=1; i<argc && argv[i]!=NULL; i++)

Index: alsa-plugins/a2dplib.c
===================================================================
RCS file: /cvsroot/bluetooth-alsa/btsco/alsa-plugins/a2dplib.c,v retrieving revision 1.4

a2dplib.c +129 -114

358 lines not on this page · raw message

Index: alsa-plugins/pcm_a2dp.c
===================================================================
RCS file: /cvsroot/bluetooth-alsa/btsco/alsa-plugins/pcm_a2dp.c,v retrieving revision 1.15

pcm_a2dp.c +1 -1
diff -u -r1.15 pcm_a2dp.c
@@ -818,7 +818,7 @@
 	struct media_packet_header packet_header;
 	struct media_payload_header payload_header;
 	int codesize,datatoread;
-	unsigned long sleeptime;
+	unsigned long sleeptime=0;
 	int written;
 	struct timeval dt;
 	struct timeval timeofday;

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

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

#1 lore raw

Fr=E9d=E9ric

Quoted 1 line

What about Matthew's patches?

Maybe I missed this. What are his changes?

Brad

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easi= er
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#2 lore raw
Quoted 8 lines
Quoted 3 lines

What about Matthew's patches?

    =

Maybe I missed this. What are his changes?

=

see
http://sourceforge.net/mailarchive/forum.php?thread_id=3D30260835&forum_id=
=3D1881
http://sourceforge.net/mailarchive/forum.php?thread_id=3D30262307&forum_id=
=3D1881
Fr=E9d=E9ric

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easi= er
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

Fr=E9d=E9ric

Quoted 7 lines

Latest patch : Default daemon logfile is /dev/null. Try to open an l2cap socket with short timeout before doing sdp_connect that can last very long. Also a script called a2dpair that wrap hcitool and passkey-agent as an effort to simplify pairing and a2dpd setup :D
What about Matthew's patches? I plan to move to getopt and cleanup indent and traces so having them integrated first would be better as there are new options.

I looked over Matthew's patches and applied them. I applied your "small patch" which turns out to be bigger than it sounds :)

Brad

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easi= er
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#4 lore raw

[Bluez-devel] Big patch to a2dpd

Hi Brad,

Quoted 4 lines

I looked over Matthew's patches and applied them. I applied your "small patch" which turns out to be bigger than it sounds :)

This one is more than bigger!
Reindent,
Alsa output redirection,
New on-the-fly in-play switch from bt to alsa and reverse Changing bdaddr in play too.
More options described in sample.a2dprc

I removed the line LIBS= from Makefile.am as suggested. This line was making tons of compilation problems. As a2dpd finally links to alsa, it is no longer needed. Please give it a try before submitting (Matthew and RUI if you read that).

Wrote a doc : http://fdalleau.free.fr/a2dp_doc.pdf ideas welcome!

Frédéric

? Doxyfile
? Makefile.in
? aclocal.m4
? autom4te.cache
? btsco.kdevelop
? btsco.kdevelop.pcs
? btsco.kdevses
? compile
? config.guess
? config.h.in
? config.sub
? configure
? depcomp
? install-sh
? missing
? alsa-plugins/Makefile.in
? avdtp/Makefile.in
? sbc/Makefile.in
Index: alsa-plugins/BUILD
===================================================================
RCS file: /cvsroot/bluetooth-alsa/btsco/alsa-plugins/BUILD,v retrieving revision 1.2

BUILD +0 -1
diff -u -r1.2 BUILD
@@ -26,4 +26,3 @@
 Note that this device will not automatically appear in the list of alsa devices.
 The alsa folks did this by design but they added a new api for clients to 
 enumerate plugin devices.
-

Index: alsa-plugins/Makefile.am
===================================================================
RCS file: /cvsroot/bluetooth-alsa/btsco/alsa-plugins/Makefile.am,v retrieving revision 1.6

Makefile.am +3 -4
diff -u -r1.6 Makefile.am
@@ -4,8 +4,6 @@
 
 if ALSAPLUGIN
 
-#LIBS = 
-
 alsadir = $(libdir)/alsa-lib
 
 alsa_LTLIBRARIES = libasound_module_pcm_a2dp.la libasound_module_pcm_a2dpd.la libasound_module_ctl_a2dpd.la libasound_module_pcm_sco.la libasound_module_ctl_sco.la
@@ -31,9 +29,10 @@
 libasound_module_ctl_sco_la_LIBADD = @ALSA_LIBS@
 
 bin_PROGRAMS = a2dpd
-a2dpd_SOURCES = a2dpd.c a2dplib.c 
+a2dpd_SOURCES = a2dpd.c a2dplib.c alsalib.c
+a2dpd_CFLAGS = $(AM_CFLAGS)
 #a2dp_timer.c a2dp_ipc.c
-a2dpd_LDADD = a2dp_timer.o a2dp_ipc.o @BLUEZ_LIBS@ -lsbc -lpthread -lrt
+a2dpd_LDADD = a2dp_timer.o a2dp_ipc.o @ALSA_LIBS@ @BLUEZ_LIBS@ -lsbc -lpthread -lrt
 
 AM_CFLAGS = @ALSA_CFLAGS@ @BLUEZ_CFLAGS@ -pthread
 AM_LDFLAGS = -module -avoid-version -export-dynamic

Index: alsa-plugins/a2dp_ipc.c
===================================================================
RCS file: /cvsroot/bluetooth-alsa/btsco/alsa-plugins/a2dp_ipc.c,v retrieving revision 1.3

a2dp_ipc.c +6 -2
diff -u -r1.3 a2dp_ipc.c
@@ -36,7 +36,11 @@
 
 void close_socket(int sockfd)
 {
-        if(sockfd>0) close(sockfd);
+        if(sockfd>0)
+        {
+        	shutdown(sockfd, SHUT_RDWR);
+        	close(sockfd);
+        }
 }
 
 int make_udp_socket()
@@ -98,7 +102,7 @@
         {
                 if(bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr))==0)
                 {
-                        if(listen(sockfd, 10)==0)
+                        if(listen(sockfd, 0)==0)
                         {
                                 // No error
                         }

Index: alsa-plugins/a2dp_timer.c
===================================================================
RCS file: /cvsroot/bluetooth-alsa/btsco/alsa-plugins/a2dp_timer.c,v retrieving revision 1.2

a2dp_timer.c +70 -81

174 lines not on this page · raw message

Index: alsa-plugins/a2dpair
===================================================================
RCS file: alsa-plugins/a2dpair

a2dpair new file +129 -0

129 lines not on this page · raw message

Index: alsa-plugins/a2dpd.c
===================================================================
RCS file: /cvsroot/bluetooth-alsa/btsco/alsa-plugins/a2dpd.c,v retrieving revision 1.7

a2dpd.c +857 -917

1,972 lines not on this page · raw message

Index: alsa-plugins/a2dpd_protocol.h
===================================================================
RCS file: /cvsroot/bluetooth-alsa/btsco/alsa-plugins/a2dpd_protocol.h,v retrieving revision 1.3

a2dpd_protocol.h +7 -8
diff -u -r1.3 a2dpd_protocol.h
@@ -26,12 +26,11 @@
 
 
 // parameters used to describe device state
-typedef struct
-{
-        int16_t                     volume_speaker_right;
-        int16_t                     volume_speaker_left;
-        int16_t                     volume_micro_right;
-        int16_t                     volume_micro_left;
+typedef struct {
+	int16_t volume_speaker_right;
+	int16_t volume_speaker_left;
+	int16_t volume_micro_right;
+	int16_t volume_micro_left;
 } AUDIOMIXERDATA;
 
 #define INVALIDAUDIOMIXERDATA   { -1, -1, -1, -1 }
@@ -44,8 +43,8 @@
 #define A2DPD_VOLUME_MIN        0
 #define A2DPD_VOLUME_MAX        15
 
-#define A2DPD_FRAME_BYTES       4 // 16bits * 2 channels
-#define A2DPD_FRAME_RATE        44100 // Can be 32000, tested with HP, iPhono and needed Sonorix, but quality decreases, 48000 nearly never works
+#define A2DPD_FRAME_BYTES       4	// 16bits * 2 channels
+#define A2DPD_FRAME_RATE        44100	// Can be 32000, tested with HP, iPhono and needed Sonorix, but quality decreases, 48000 nearly never works
 // a2dp->sbc.channels*44100*2/(size*a2dp->frame_bytes);
 // 344.53125=channels*freq*16 bits/sizeof(buf)
 #define A2DPD_BLOCK_SIZE        (512*1)

Index: alsa-plugins/a2dplib.c
===================================================================
RCS file: /cvsroot/bluetooth-alsa/btsco/alsa-plugins/a2dplib.c,v retrieving revision 1.5

a2dplib.c +874 -976

654 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Index: alsa-plugins/alsalib.c
===================================================================
RCS file: alsa-plugins/alsalib.c

alsalib.c new file +203 -0

203 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Index: alsa-plugins/alsalib.h
===================================================================
RCS file: alsa-plugins/alsalib.h

alsalib.h new file +48 -0

48 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Index: alsa-plugins/pcm_a2dpd.c
===================================================================
RCS file: /cvsroot/bluetooth-alsa/btsco/alsa-plugins/pcm_a2dpd.c,v retrieving revision 1.4

pcm_a2dpd.c +261 -284

545 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Index: alsa-plugins/sample.a2dprc
===================================================================
RCS file: /cvsroot/bluetooth-alsa/btsco/alsa-plugins/sample.a2dprc,v retrieving revision 1.2

sample.a2dprc +29 -1
diff -u -r1.2 sample.a2dprc

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

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

Part of the diff is not shown here. View the raw message.

#5 lore raw

Re: [Bluez-devel] Big patch to a2dpd

Hi Fr=E9d=E9ric,

Whoo some patch cant wait to give it a whirl..

On the subject of your DOC nice work very concise

You might like to add
------------------
If you create an ~.asoundrc as follows

pcm.a2dpd {
type a2dpd
}

Then you can directly add the headphone device (pcm.a2dpd) to any app that supports alsa plugins correctly, Without affecting the default Gnome/X/KDE sounds

Known working Apps

Xmms
alsaplayer
VLC (you have to manualy add it to the conf file as the gui wont allow adding non visible plugins (bug)).

cheers Andy
--------------------------------------
Hi Brad,

Quoted 11 lines
Quoted 4 lines

I looked over Matthew's patches and applied them. I applied your "small patch" which turns out to be bigger than it sounds :)

This one is more than bigger!
Reindent,
Alsa output redirection,
New on-the-fly in-play switch from bt to alsa and reverse Changing bdaddr in play too.
More options described in sample.a2dprc

Quoted 10 lines

I removed the line LIBS=3D from Makefile.am as suggested. This line was making tons of compilation problems. As a2dpd finally links to alsa, it is no longer needed.
Please give it a try before submitting (Matthew and RUI if you read that).

Wrote a doc : http://fdalleau.free.fr/a2dp_doc.pdf ideas welcome!

Fr=E9d=E9ric

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easi= er
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#6 lore raw

Re: [Bluez-devel] Big patch to a2dpd

Is there a way to have a2dpd use the alsa dmixer? And does anyone =

know how to change the default alsa device on the fly. I know you =

can change .asoundrc but any running applications need to be =

restarted in order to pick up the change. Is there a better way?

Michael

Quoted 73 lines · On Sep 1, 2006, at 8:57 AM, [email protected] wrote:

Hi Fr=E9d=E9ric,

Whoo some patch cant wait to give it a whirl..

On the subject of your DOC nice work very concise

You might like to add
------------------
If you create an ~.asoundrc as follows

pcm.a2dpd {
type a2dpd
}

Then you can directly add the headphone device (pcm.a2dpd) to any =

app that
supports alsa plugins correctly, Without affecting the default =

Gnome/X/KDE
sounds

Known working Apps

Xmms
alsaplayer
VLC (you have to manualy add it to the conf file as the gui wont allow adding non visible plugins (bug)).

cheers Andy
--------------------------------------
Hi Brad,

Quoted 20 lines
Quoted 6 lines

I looked over Matthew's patches and applied them. I applied your =

"small
patch" which turns out to be bigger than it sounds :)

This one is more than bigger!
Reindent,
Alsa output redirection,
New on-the-fly in-play switch from bt to alsa and reverse Changing bdaddr in play too.
More options described in sample.a2dprc

I removed the line LIBS=3D from Makefile.am as suggested. This line was making tons of compilation problems. As a2dpd finally links to =

alsa, it
is no longer needed.
Please give it a try before submitting (Matthew and RUI if you =

Quoted 7 lines

read that).

Wrote a doc : http://fdalleau.free.fr/a2dp_doc.pdf ideas welcome!

Fr=E9d=E9ric

---------------------------------------------------------------------- =

---
Using Tomcat but need to do more? Need to support web services, =

security?
Get stuff done quickly with pre-integrated technology to make your =

job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache =

Quoted 8 lines

Geronimo
http://sel.as-us.falkag.net/sel? =

cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easi= er
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#7 lore raw

Re: [Bluez-devel] Big patch to a2dpd

In reply to Frédéric DALLEAU

Fr=E9d=E9ric

thanks for the continued work.

Quoted 6 lines

This one is more than bigger!
Reindent,
Alsa output redirection,
New on-the-fly in-play switch from bt to alsa and reverse Changing bdaddr in play too.
More options described in sample.a2dprc

a few problems:

It only works if the bdaddr is specified in .asoundrc (the old way) as well as in .a2dprc. Specifying it on the a2dpd command line does not seem to help.

Audio only came out the left speaker using my itech r35 black set. (My other sets are up at work)

How do you switch on the fly to wired audio?

Quoted 1 line

Wrote a doc : http://fdalleau.free.fr/a2dp_doc.pdf ideas welcome!

Could we contribute this stuff to a wiki? I actually have the feeling that no one of us understands the whole picture. I have an account on the ubuntu wiki but a better one for our purposes would have no association with a specific distro...

Brad

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easi= er
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#12 lore raw

Re: [Bluez-devel] Big patch to a2dpd

In reply to Frédéric DALLEAU

argh... another problem...

when I just sent that last message via wifi while streaming with xmms, the audio turned choppy (works for 1s, silence for 1s, repeat) and it never started working again even after no wifi activity :(

brad

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#13 lore raw

Re: [Bluez-devel] Big patch to a2dpd

hey

Quoted 5 lines

argh... another problem...

when I just sent that last message via wifi while streaming with xmms, the audio turned choppy (works for 1s, silence for 1s, repeat) and it never started working again even after no wifi activity :(

whoops... not sure if this is better or worse.

what actually happened is my wifi stopped working during the a2dp streaming. so the computer demand-dialed using my cellphone over bluetooth and that's when the trouble started. so maybe it would have recovered once the dun connection was closed.

my r35 is a combo hfp/hsp so it does like to be master and doesn't like scatternetting. funny if you think about it... the network was a fully-connected triangle between the three devices when the audio was breaking up.

brad

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#8 lore raw

[Bluez-devel] RE : Big patch to a2dpd

In reply to Brad Midgley

Hi Brad,

Quoted 3 lines

It only works if the bdaddr is specified in .asoundrc (the old way) as well as in .a2dprc. Specifying it on the a2dpd command line does not seem to help.

Now that you tell it, as the .a2dprc is reread for address changes it will overwrite the value set by command line. You can use, enablerereadconfig=0. The .asoundrc is ignored.

Quoted 2 lines

Audio only came out the left speaker using my itech r35 black set. (My other sets are up at work)

I have a reversed stereo. It may be related. I haven't found where but it's one of the main problems. Try enablereversestereo=1 and see if audio comes from the right speaker. This would mean the failure came before compression and transmission. Also try playing with sound balance on xmms and look at alsamixer -D ctl.a2dpd to see if both internal channel values are the same.
Does the standard a2dp plugin work well with that headset?
I have a faulty headset that does that too. When I shoot it it goes ok :D

Quoted 1 line

How do you switch on the fly to wired audio?

Modify the .a2dprc file, write enablealsaredirect=1 instead of 0 and save. Yes, file ipc :D

Quoted 1 line

Could we contribute this stuff to a wiki?

Man is to my eyes the standard unix doc format. Even gnu info is nothing :D Why not a manpage stored in cvs, there are certainly php scripts that can render a man page in html.

The wiki is good for writing but having some docs in the project is better. The wiki needs to be watched over and there would be no way to automatically provide docs to a distro... The manpage can be installed with unbuntu packages.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

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

#9 lore raw

Re: [Bluez-devel] RE : Big patch to a2dpd

Frederic

fyi, I applied the "big patch" to cvs.

Quoted 4 lines
Quoted 3 lines

It only works if the bdaddr is specified in .asoundrc (the old way) as well as in .a2dprc. Specifying it on the a2dpd command line does not seem to help.

Now that you tell it, as the .a2dprc is reread for address changes it will overwrite the value set by command line. You can use, enablerereadconfig=0. The .asoundrc is ignored.

I think this will lead to unexpected behavior. Normally the command line
overrides the config file. Maybe we should ignore bdaddr changes in the
config file if the bdaddr was specified on the command line.

Have you looked into using dbus for communicating with the running a2dpd? I think I read that ALP is going to use dbus for things like this.

Quoted 6 lines
Quoted 2 lines

Audio only came out the left speaker using my itech r35 black set. (My other sets are up at work)

I have a reversed stereo. It may be related. I haven't found where but it's one of the main problems. Try enablereversestereo=1 and see if audio comes from the right speaker. This would mean the failure came before compression and transmission. Also try playing with sound balance on xmms and look at alsamixer -D ctl.a2dpd to see if both internal channel values are the same.
Does the standard a2dp plugin work well with that headset?
I have a faulty headset that does that too. When I shoot it it goes ok :D

enablereversestereo=1 fixes audio so it comes out of both speakers. I've made this the default in sample.a2dprc.

fyi, if interference makes the stream get behind, the rate of the stream gets a little wacky for a while and the pitch wanders around for a few seconds before settling down. fwiw, this is on a machine with intel i810 graphics which seems to "behave" better than nvidia with regard to interrupt masking.

I was ecstatic to have avrcp "just work" when I used xmms to try things out.

fyi, the itech r35 has a combo play/pause button that seems to always send "play" even when the music is already playing. Maybe we need to pause if we get a play message during playback.

Quoted 7 lines
Quoted 1 line

How do you switch on the fly to wired audio?

Modify the .a2dprc file, write enablealsaredirect=1 instead of 0 and save. Yes, file ipc :D

Quoted 1 line

Could we contribute this stuff to a wiki?

Man is to my eyes the standard unix doc format. Even gnu info is nothing :D Why not a manpage stored in cvs, there are certainly php scripts that can render a man page in html.

The wiki is good for writing but having some docs in the project is better. The wiki needs to be watched over and there would be no way to automatically provide docs to a distro... The manpage can be installed with unbuntu packages.

I agree the manpage is essential but I'm going to break with tradition for now and use the wiki for our in-progress stuff. It also motivates me to get things down in some form of documentation when I don't have to worry too much about coordination of other efforts.

I put a placeholder here:
http://wiki.linuxquestions.org/wiki/Bluetoooth-alsa
linuxquestions.org seems like an ok spot for this kind of thing.

I will put wiki snapshots in the project in some form when doing releases or cvs tags.

Brad

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#10 lore raw

Re: [Bluez-devel] RE : Big patch to a2dpd

Hi Brad,

Quoted 3 lines

Have you looked into using dbus for communicating with the running a2dpd? I think I read that ALP is going to use dbus for things like this.
=

We still need data persistency, so It would need to
1) listen dbus
2) rewrite the file

Quoted 3 lines

enablereversestereo=3D1 fixes audio so it comes out of both speakers. I've made this the default in sample.a2dprc.
=

It seems that the reverse code is a bit buggy :D which explains why you =

have no sound.
Look at this in a2dpd.c

        } else {
            //FIXME We have a reverse stereo I don't know why
            // The following line corrects the problem but I miss the =

cause so

            pBuffer[j] =3D =
(((channel_2&0x0000FFFF)<<16)|(channel_1&0x0000FFFF));
            //pBuffer[j] =3D ( (channel_1 & 0xFFFF0000) | (channel_2 & =

0x0000FFFF) ); // ------------------ remove this line

        }
Quoted 6 lines

fyi, if interference makes the stream get behind, the rate of the stream gets a little wacky for a while and the pitch wanders around for a few seconds before settling down. fwiw, this is on a machine with intel i810 graphics which seems to "behave" better than nvidia with regard to interrupt masking.
=

What do you call interference?

Fr=E9d=E9ric

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easi= er
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel

#11 lore raw

Re: [Bluez-devel] RE : Big patch to a2dpd

Fr=E9d=E9ric

Quoted 7 lines
Quoted 3 lines

Have you looked into using dbus for communicating with the running a2dpd? I think I read that ALP is going to use dbus for things like this.
=

We still need data persistency, so It would need to
1) listen dbus
2) rewrite the file

sure... I do like how dbus integration would also allow us to have another manager app changing settings.

btw, would it be hard to have wired output by default as long as a2dpd isn't running?

Quoted 8 lines
Quoted 6 lines

fyi, if interference makes the stream get behind, the rate of the stream gets a little wacky for a while and the pitch wanders around for a few seconds before settling down. fwiw, this is on a machine with intel i810 graphics which seems to "behave" better than nvidia with regard to interrupt masking.
=

What do you call interference?

if you walk too far from the transmitter, you get this. also if there's a bluetooth device scan or motion from my bluetooth mouse things stop. not much we can do except try to get back to normal as soon as possible when this stuff happens.

brad

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easi= er
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D1=
21642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel