Google
  Web www.spinics.net

Re: An Issue with A2dpd and some suggestions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


  I know little of ALSA or Bluez, so I don't know the detail inside.
  1. attached log files:
     Blue-startup.log: the log information when "hcid -d -n" start to run
     Bluez-play.log: during a helix based player playback an audio stream, the log information from hcid.
  
  2. ALSA api 
   snd_pcm_hw_params() --> snd_pcm_prepare() --> pcm->fast_ops->prepare(pcm->fast_op_arg)
  I guess it will call to (from printf log, it does)
  File: audio/pcm_bluetooth.c 
  Function: bluetooth_prepare()
  And in this function, it will use the return value from write(data->pipefd[1],&c,1) as its (bluetooth_prepare) return value.---- I think the positive return value "1" was create here; 
  but I don't know whether there should be some place to translate this value to a valid return value of ALSA API. And I also don't what "1" is valid return value from the write() function.
  
  
  BR
  
  
  
  >-----Original Message-----
  >From: Holtmann, Marcel
  >Sent: 2008年5月14日 21:08
  >To: Zhao, Halley; Wong, James Sing Toh
  >Cc: Guo, Young
  >Subject: RE: An Issue with A2dpd and some suggestions
  >
  >Hi Halley,
  >
  >does a call to snd_pcm_hw_params() gets re-directed to the Bluetooth plugin
  >from the ALSA API? What is the actual call chain for it.
  >
  >Personally I would say this is an ALSA problem, but it could also be a BlueZ
  >problem since I must admit the ALSA plugins APIs are not really clear and
  >the possibility that we made a mistake is quite high.
  >
  >Please run "hcid -n -d" and then copy the output from your application
  >calling sndP_pcm_hw_params() so we see where inside the BlueZ code we are
  >actually. My wild guess is that if it is a BlueZ issue, then this will be
  >hidden somewhere non obvious. Please put this result on the BlueZ mailing
  >list so Luiz can have a look at it, too.
  >
  >Regards
  >
  >Marcel
  >
  >>-----Original Message-----
  >>From: Zhao, Halley
  >>Sent: Wednesday, May 14, 2008 1:34 AM
  >>To: Holtmann, Marcel; Wong, James Sing Toh
  >>Cc: Guo, Young; Zhao, Halley
  >>Subject: FW: An Issue with A2dpd and some suggestions
  >>
  >>  Hi Marcel:
  >>  With your (and bluez community) help, finally I installed bluez-3.31
  >on
  >>my desktop. Great thanks.
  >>
  >>  But I still have the issue that snd_pcm_hw_params() give a return value
  >>of "1" which is undefined meaning for this API. After I hack that return
  >>value to 0 (success). A helix based player (RP4MID) could work well on this
  >>package.
  >>
  >>  But I still don't know where the root cause is, James is more cared
  >about
  >>it.
  >>
  >>  Thanks BR.
  >>  "
  >http://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m.html
  >>          int snd_pcm_hw_params  ()
  >>          Returns:
  >>              0 on success otherwise a negative error code
  >>  "
  >>
  >>
  >>  -----Original Message-----
  >>From: Holtmann, Marcel
  >>Sent: 2008年5月9日 21:09
  >>To: Zhao, Halley
  >>Cc: Guo, Young; Zheng, Huan; Tang, Feng; Lynch, Rusty
  >>Subject: RE: An Issue with A2dpd and some suggestions
  >>
  >>  Hi Halley,
  >>
  >>  can you please mail this bug report to the bluez-devel mailing list.
  >Then
  >>we have more experts looking at it. There is also a avinfo tool inside the
  >>bluez-utils packages that allows you to discover details on the A2DP
  >>features supported by your headset.
  >>
  >>
  >>  Additionally you should check that the ALSA or GStreamer plugins are
  >>installed at the right location. Sometimes it happens that the wrong one
  >is
  >>used and that makes it incompatible.
  >>
  >>  Regards
  >>
  >>  Marcel
  >>
  >>  >-----Original Message-----
  >>  >From: Zhao, Halley
  >>  >Sent: Friday, May 09, 2008 3:23 AM
  >>  >To: Holtmann, Marcel
  >>  >Cc: Guo, Young; Zheng, Huan; Tang, Feng; Lynch, Rusty
  >>  >Subject: RE: An Issue with A2dpd and some suggestions
  >>  >
  >>  >  Hi Marcel:
  >>  >  My Bluetooth earphone is Motorola HT820.
  >>  >
  >>  >  1. When I try to use bluez-utils 3.31 on my desktop (Ubuntu7.10),
  >>there
  >>  >are some issues: (but there is no such issue when I use 3.19 version
  >on
  >>  >this same platform). Should I update some other package besides bluez-
  >>utils
  >>  >and bluez-libs?
  >>  >  "
  >>  >  halley@azhao2ubtg2:~$ aplay
  >/home/halley/media/audio/Track27.wav
  >>  >  ALSA lib pcm_bluetooth.c:1501:(audioservice_recv) Error
  >receiving data
  >>  >from audio service: Success(0)
  >>  >  ALSA lib pcm_bluetooth.c:1517:(audioservice_expect) Bogus
  >message
  >>  >BT_GETCAPABILITIES_REQ received while BT_GETCAPABILITIES_RSP was
  >>expected
  >>  >  aplay: main:545: audio open error: Invalid argument
  >>  >  "
  >>  >
  >>  >  2. When I use bluez-utils 3.19 version, application calls
  >>  >snd_pcm_hw_params() sometimes will got return value "1". (The
  >function
  >>  >description says it will be 0 for success and negative number for
  >>failure).
  >>  >The positive value makes me puzzled.
  >>  >
  >>  >      /* Apply parameters */
  >>  >  	err = snd_pcm_hw_params(m_pAlsaPCMHandle, hwparams);
  >>  >  	if (err < 0)
  >>  >      {
  >>  >          HXLOGL1 ( HXLOG_ADEV, "snd_pcm_hw_params: %s",
  >>  >                    snd_strerror(err));
  >>  >          m_wLastError = RA_AOE_NOTENABLED;
  >>  >  	}
  >>  >
  >>  >      /* read buffer & period sizes */
  >>  >      snd_pcm_uframes_t buffer_size = 0;
  >>  >      snd_pcm_uframes_t period_size = 0;
  >>  >
  >>  >      if (err == 0)
  >>  >      {
  >>  >
  >>  >  >-----Original Message-----
  >>  >  >From: Holtmann, Marcel
  >>  >  >Sent: 2008年4月29日 19:01
  >>  >  >To: Zhao, Halley
  >>  >  >Cc: Li, Frank; Guo, Young; Zheng, Huan; Tang, Feng; Lynch, Rusty
  >>  >  >Subject: RE: An Issue with A2dpd and some suggestions
  >>  >  >
  >>  >  >Hi Halley,
  >>  >  >
  >>  >  >if you read the ChangeLog file it clearly states that you need
  >>  >  >bluez-libs-3.30 to use bluez-utils-3.30.
  >>  >  >
  >>  >  >You can find bluez-utils-3.28 at the same position you
  >downloaded
  >>3.30
  >>  >from.
  >>  >  >However there is no link it, but the packages are still
  >available.
  >>  >However
  >>  >  >in case of 3.28 you need at least bluez-libs-3.28 to match up
  >with
  >>it.
  >>  >  >
  >>  >  >Regards
  >>  >  >
  >>  >  >Marcel
  >>  >  >
  >>  >  >
  >>  >  >-----Original Message-----
  >>  >  >From: Zhao, Halley
  >>  >  >Sent: Tue 4/29/2008 2:12 AM
  >>  >  >To: Holtmann, Marcel
  >>  >  >Cc: Li, Frank; Guo, Young; Zheng, Huan; Tang, Feng; Lynch, Rusty
  >>  >  >Subject: RE: An Issue with A2dpd and some suggestions
  >>  >  >
  >>  >  >??Hi Marcel:
  >>  >  >??When I tried bluez-utils-3.30, I was block by error:
  >>  >  >??"hciconfig.c:(.text+0x37ee): undefined reference to
  >>  >  >`hci_write_inquiry_transmit_power_level'
  >>  >  >??hciconfig.c:(.text+0x3823): undefined reference to
  >>  >  >`hci_read_inquiry_transmit_power_level'
  >>  >  >??"
  >>  >  >??
  >>  >  >??Where could I get 3.28 version ?
  >>  >  >??
  >>  >  >??
  >>  >  >??>-----Original Message-----
  >>  >  >??>From: Holtmann, Marcel
  >>  >  >??>Sent: 2008?4?29? 15:46
  >>  >  >??>To: Zhao, Halley
  >>  >  >??>Cc: Li, Frank; Guo, Young; Zheng, Huan; Tang, Feng; Lynch,
  >Rusty
  >>  >  >??>Subject: RE: An Issue with A2dpd and some suggestions
  >>  >  >??>
  >>  >  >??>Hi Halley,
  >>  >  >??>
  >>  >  >??>the latest version of bluez-utils is 3.30 and I am just about
  >to
  >>  >release
  >>  >  >??>3.31. When you talk about 3.19, then you talk about a release
  >that
  >>is
  >>  >  >over
  >>  >  >??>7 month old. In some cases that might be fine, but with a topic
  >>like
  >>  >A2DP
  >>  >  >??>it is not. Simply download bluez-utils-3.30 and look at the
  >>ChangeLog
  >>  >  >file.
  >>  >  >??>It has the highlights of changes and you will see a lot of
  >them in
  >>  >  >direction
  >>  >  >??>of A2DP. If you stick with 3.19 you might get it working, but
  >you
  >>  >might
  >>  >  >also
  >>  >  >??>discover all the fixed bugs over and over again.
  >>  >  >??>
  >>  >  >??>You can clone a copy from the git://git.infradead.org/bluez-
  >>utils.git
  >>  >  >??>mirror and then run "gitk audio" to see only the audio service
  >>(A2DP
  >>  >and
  >>  >  >??>Headset) related changes and then judge for yourself.
  >>  >  >??>
  >>  >  >??>With Ubuntu Hardy you get at least 3.26 and even that is
  >already
  >>  >pretty
  >>  >  >old.
  >>  >  >??>The best choice might be too look at some updates packages
  >from
  >>  >Debian,
  >>  >  >??>because I remember that they already packaged 3.30 and my
  >advise
  >>  >would
  >>  >  >be
  >>  >  >??>to wait until the end of this week when I actually release
  >3.31
  >>since
  >>  >  >that
  >>  >  >??>has a lot of fixes in it.
  >>  >  >??>
  >>  >  >??>If you don't wanna wait, the best release would be currently
  >the
  >>  >3.28,
  >>  >  >??>because that was before we introduced the new API. Once 3.31
  >is
  >>out
  >>  >  >??>everything is back to normal again. However with 3.28 the
  >services
  >>  >are
  >>  >  >in
  >>  >  >??>a separate process and with 3.31 everything will be a plugin
  >(just
  >>  >for
  >>  >  >the
  >>  >  >??>technical clarification).
  >>  >  >??>
  >>  >  >??>Regards
  >>  >  >??>
  >>  >  >??>Marcel
  >>  >  >??>
  >>  >  >??>-----Original Message-----
  >>  >  >??>From: Zhao, Halley
  >>  >  >??>Sent: Mon 4/28/2008 10:54 PM
  >>  >  >??>To: Holtmann, Marcel
  >>  >  >??>Cc: Li, Frank; Guo, Young; Zheng, Huan; Zhao, Halley; Tang,
  >Feng;
  >>  >Lynch,
  >>  >  >??>Rusty
  >>  >  >??>Subject: RE: An Issue with A2dpd and some suggestions
  >>  >  >??>
  >>  >  >??>??Hi Marcel:
  >>  >  >??>??Our OS is Ubuntu based, and there is bluez-utils
  >(3.19-0ubuntu3)
  >>  >  >??>installed.
  >>  >  >??>??The package information gives us the link
  >>  >  >http://bluez.sourceforge.net,
  >>  >  >??>and it is same to http://www.bluez.org/, do you think the 3.19
  >>  >version
  >>  >  >is
  >>  >  >??>ok for us?
  >>  >  >??>??
  >>  >  >??>??Is it correct?
  >>  >  >??>??If not, how could we remove the "plugz" and install
  >bluez-utils?
  >>  >  >??>??Must we start from the source package from
  >>http://www.bluez.org/?
  >>  >  >??>??
  >>  >  >??>??
  >>  >  >??>??
  >>  >  >??>??>-----Original Message-----
  >>  >  >??>??>From: Holtmann, Marcel
  >>  >  >??>??>Sent: 2008?4?28? 17:53
  >>  >  >??>??>To: Zheng, Huan
  >>  >  >??>??>Cc: Zhao, Halley; Li, Frank; Guo, Young
  >>  >  >??>??>Subject: RE: An Issue with A2dpd and some suggestions
  >>  >  >??>??>
  >>  >  >??>??>Hi Huan,
  >>  >  >??>??>
  >>  >  >??>??>there is a simple answer to this. You are using the plugz
  >code
  >>and
  >>  >  >that
  >>  >  >??>is
  >>  >  >??>??>wrong. This code is outdated and deprecated. The
  >bluez-utils
  >>  >packages
  >>  >  >??>??>contains the audio service (which is now actually a plugin)
  >and
  >>  >has
  >>  >  >??>plugins
  >>  >  >??>??>for ALSA and GStreamer integration. This audio service
  >fully
  >>  >supports
  >>  >  >??>A2DP
  >>  >  >??>??>and is widely tested. Check wiki.bluez.org for more
  >details on
  >>how
  >>  >  >to
  >>  >  >??>setup
  >>  >  >??>??>your .asoundrc for testing it.
  >>  >  >??>??>
  >>  >  >??>??>Regards
  >>  >  >??>??>
  >>  >  >??>??>Marcel
  >>  >  >??>??>
  >>  >  >??>??>-----Original Message-----
  >>  >  >??>??>From: Zheng, Huan
  >>  >  >??>??>Sent: Sun 4/27/2008 10:11 PM
  >>  >  >??>??>To: Holtmann, Marcel
  >>  >  >??>??>Cc: Zhao, Halley; Li, Frank; Guo, Young; Zheng, Huan
  >>  >  >??>??>Subject: An Issue with A2dpd and some suggestions
  >>  >  >??>??>
  >>  >  >??>??>Hi, Marcel
  >>  >  >??>??>
  >>  >  >??>??>I'm an engineer from OTC PRC, I'm currently working
  >moblin.
  >>  >  >??>??>
  >>  >  >??>??>I encountered an issue when using Bluetooth alsa on Crown
  >>Beach,
  >>  >and
  >>  >  >I
  >>  >  >??>have
  >>  >  >??>??>located the code where cause the issue, it may be a
  >potential
  >>bug,
  >>  >  >but
  >>  >  >??>I'm
  >>  >  >??>??>not sure. Since you are the expert on Bluetooth-alsa, very
  >much
  >>  >  >??>appreciate
  >>  >  >??>??>your opinions.
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>Symptom:
  >>  >  >??>??>
  >>  >  >??>??>After finished playing one song, then opening another song
  >will
  >>  >hear
  >>  >  >??>nothing,
  >>  >  >??>??>and finally hang.
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>Investigation:
  >>  >  >??>??>
  >>  >  >??>??>Code hang on snd_pcm_prepare, which finally goes into
  >>  >  >??>??>a2dp_prepare(snd_pcm_ioplug_t * io)  inside
  >>  >  >??>??>plugz/alsa-plugin/a2dpd/pcm_a2dpd.c
  >>  >  >??>??>
  >>  >  >??>??>Code hangs on
  >>  >  >??>??>
  >>  >  >??>??>while(poll_accept(a2dp->sk, 0)) {
  >>  >  >??>??>
  >>  >  >??>??>                   transfer = recv_socket(a2dp->sk,
  >>  >  >&GetPointerResp,
  >>  >  >??>??>sizeof(GetPointerResp));
  >>  >  >??>??>
  >>  >  >??>??>         }
  >>  >  >??>??>
  >>  >  >??>??>At this place, poll_accept always return true, but inside
  >>  >  >recv_socket,
  >>  >  >??>recv
  >>  >  >??>??>call report errono 104(connection reset by peer). This
  >becomes
  >>an
  >>  >  >??>infinite
  >>  >  >??>??>loop.
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>Suggestions:
  >>  >  >??>??>
  >>  >  >??>??>I'm thinking that is it possible to add functionality into
  >>  >poll_accept
  >>  >  >??>to
  >>  >  >??>??>judge whether connection has been reset? If find
  >connection has
  >>  >been
  >>  >  >??>reset,
  >>  >  >??>??>then do some recovery and return 0 to let the while loop
  >end.
  >>  >  >??>??>There is a new bit since 2.6.17, maybe this will be helpful
  >to
  >>  >judge
  >>  >  >??>whether
  >>  >  >??>??>connection has been reset when using poll.
  >>  >  >??>??>
  >>  >  >??>??>POLLRDHUP " (since Linux 2.6.17)"
  >>  >  >??>??>
  >>  >  >??>??>Stream socket peer closed connection, or shut down writing
  >half
  >>of
  >>  >  >??>??>connection. The _GNU_SOURCE feature test macro must be
  >defined
  >>in
  >>  >  >order
  >>  >  >??>to
  >>  >  >??>??>obtain this definition.
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>Could you please share your opinions on this?
  >>  >  >??>??>
  >>  >  >??>??>Thanks a lot!
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>For your convenience, I attached the code below:
  >>  >  >??>??>
  >>  >  >??>??>int poll_accept(int sockfd, int timeout)
  >>  >  >??>??>
  >>  >  >??>??>{
  >>  >  >??>??>
  >>  >  >??>??>         int result = 0;
  >>  >  >??>??>
  >>  >  >??>??>         int ipoll = -1;
  >>  >  >??>??>
  >>  >  >??>??>         struct pollfd pollfds[1];
  >>  >  >??>??>
  >>  >  >??>??>         pollfds[0].fd = sockfd;
  >>  >  >??>??>
  >>  >  >??>??>         pollfds[0].events = POLLIN;
  >>  >  >??>??>
  >>  >  >??>??>         pollfds[0].revents = 0;
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>         ipoll = poll(pollfds, (nfds_t)1, timeout);
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>         if((ipoll>0) && (pollfds[0].revents & POLLIN))
  >{
  >>  >  >??>??>
  >>  >  >??>??>                   result = 1;
  >>  >  >??>??>
  >>  >  >??>??>         } else if(ipoll==0) {
  >>  >  >??>??>
  >>  >  >??>??>                   errno = EAGAIN;
  >>  >  >??>??>
  >>  >  >??>??>         }
  >>  >  >??>??>
  >>  >  >??>??>         return result;
  >>  >  >??>??>
  >>  >  >??>??>}
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>ssize_t recv_socket(int sockfd, void* buffer, size_t
  >size)
  >>  >  >??>??>
  >>  >  >??>??>{
  >>  >  >??>??>
  >>  >  >??>??>        ssize_t received = 0;
  >>  >  >??>??>
  >>  >  >??>??>        while((buffer!=0) && (received<(ssize_t)size))
  >>  >  >??>??>
  >>  >  >??>??>        {
  >>  >  >??>??>
  >>  >  >??>??>                ssize_t result = recv(sockfd,
  >buffer+received,
  >>  >  >??>??>size-received, MSG_NOSIGNAL);
  >>  >  >??>??>
  >>  >  >??>??>                if(result>0)
  >>  >  >??>??>
  >>  >  >??>??>                {
  >>  >  >??>??>
  >>  >  >??>??>                        received += result;
  >>  >  >??>??>
  >>  >  >??>??>                        if(result != (ssize_t)size)
  >>  >  >??>??>
  >>  >  >??>??>                                DBG("split frame
  >received
  >>  >  >(%d/%d)",
  >>  >  >??>??>(int)result, (int)size);
  >>  >  >??>??>
  >>  >  >??>??>                }
  >>  >  >??>??>
  >>  >  >??>??>                else
  >>  >  >??>??>
  >>  >  >??>??>                {
  >>  >  >??>??>
  >>  >  >??>??>                        received=result;
  >>  >  >??>??>
  >>  >  >??>??>                        break;
  >>  >  >??>??>
  >>  >  >??>??>                }
  >>  >  >??>??>
  >>  >  >??>??>        }
  >>  >  >??>??>
  >>  >  >??>??>        return received;
  >>  >  >??>??>
  >>  >  >??>??>}
  >>  >  >??>??>
  >>  >  >??>??>Best Regards, Zheng, Huan(ZBT)
  >>  >  >??>??>
  >>  >  >??>??>OTC/SSD/SSG
  >>  >  >??>??>
  >>  >  >??>??>Intel Aisa-Pacific Research & Developement Ltd
  >>  >  >??>??>
  >>  >  >??>??>Tel: 021-6116 6435
  >>  >  >??>??>
  >>  >  >??>??>Inet: 8821 6435
  >>  >  >??>??>
  >>  >  >??>??>Cub: 3W035
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??>
  >>  >  >??>??
  >>  >  >??
  >>  >

Attachment: bluez-play.log
Description: bluez-play.log

Attachment: bluez-startup.log
Description: bluez-startup.log

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/bluez-devel

[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]

Add to Google Powered by Linux