linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [Bluez-devel] PATCH1/2: bluez-utils - fix-a2dp-buffer-constraints
@ 2007-10-17 16:31 Kai.Vehmanen
  2007-10-18  8:42 ` Johan Hedberg
  2007-10-18 10:08 ` Fabien Chevalier
  0 siblings, 2 replies; 17+ messages in thread
From: Kai.Vehmanen @ 2007-10-17 16:31 UTC (permalink / raw)
  To: bluez-devel

Hi,

On 12 Oct 2007, Kai Vehmanen wrote: 
>Here're couple of patches (against CVS HEAD) that solve the 
>problems for me (for instance pulseaudio starts working with 
>the plugin, less CPU usage with other apps). If you think 
[...]
>This first modifies the buffering constraints as exposed by 
>the A2DP ALSA plugin:
>  - increased max overall buffer size to 16384 bytes (~93msecs
>    of CD quality audio, so a reasonable max size)

hmm, looking at this more deeply, I realized this doesn't quite 
work. I originally thought there is a real ringbuffer (imitating 
the usual audio hardware ringbuffer) between the worker
thread and the application, but this appears not to be the
case. Current code seems to gather samples-to-be-sent in a buffer,
and when a threshold (a2dp->codesize or cfg.pkt_len) is reached,
a packet is then sent right away. So in other words, application
cannot really prefill more data than one packet worth, and most of 
the allocated buffer space gets never used.

So I guess this specific patch should be dropped (it might fix
some issues, but at least the assumptions I used to pick the 
values are wrong ;)). The other patch should still be valid.

What I intended with the patch was that you could...:
  - prefill N*a2dp_codesize (less than buffersize) worth of 
    PCM frames
  - trigger playback 
      -> oldest queued a2dp_codesize worth of samples is encoded 
        and sent
  - application is woken up every M*a2dp_codesize
      - in case application is occasionally late, the worker
        thread would still be encoding and sending packets
        at a steady rate using the buffered samples
	- with M>1, application can reduce the amount of wakeups
        needed, but will increase the playout latency (but
        note: the HW thread still needs to wake up for every 
        a2dp_codesize)
  - an XRUN occurs only if application is stalled for 
    duration of N*a2dp_codesize
        
But yeah, that would seem to be a much bigger task to implement (and
something you may have already discussed earlier).

br,
-- 
first.surname@nokia.com (Kai Vehmanen)

-------------------------------------------------------------------------
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] 17+ messages in thread

end of thread, other threads:[~2007-11-08  9:58 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-17 16:31 [Bluez-devel] PATCH1/2: bluez-utils - fix-a2dp-buffer-constraints Kai.Vehmanen
2007-10-18  8:42 ` Johan Hedberg
2007-10-18 10:08 ` Fabien Chevalier
2007-10-18 17:33   ` Jim Carter
2007-10-22 12:28     ` [Bluez-devel] PATCH1/2: bluez-utils -fix-a2dp-buffer-constraints Kai.Vehmanen
2007-10-22 20:15       ` Luiz Augusto von Dentz
2007-10-23 16:58       ` Fabien Chevalier
2007-10-26 13:31         ` [Bluez-devel] experimental ALSA/A2DP plugin patch (was: RE: PATCH1/2: bluez-utils -fix-a2dp-buffer-constraints) Kai.Vehmanen
2007-11-01 14:19           ` [Bluez-devel] experimental ALSA/A2DP plugin patch Fabien Chevalier
2007-11-01 14:40           ` [Bluez-devel] Kai's experimental ALSA/A2DP plugin patch review Fabien Chevalier
2007-11-01 15:11             ` Kai.Vehmanen
2007-11-01 17:28               ` Fabien Chevalier
2007-11-02 12:05                 ` Kai.Vehmanen
2007-11-02 12:28                 ` Kai.Vehmanen
2007-11-08  9:58                 ` [Bluez-devel] new not-so-experimental ALSA plugin patch (was: RE: Kai's experimental ALSA/A2DP plugin patch review) Kai.Vehmanen
2007-10-23 14:12   ` [Bluez-devel] PATCH1/2: bluez-utils-fix-a2dp-buffer-constraints Kai.Vehmanen
2007-10-23 16:53     ` Fabien Chevalier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).