Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] bluez a2dp alsa fix
@ 2008-07-23 22:31 keith preston
  2008-07-24 19:29 ` Brad Midgley
  0 siblings, 1 reply; 3+ messages in thread
From: keith preston @ 2008-07-23 22:31 UTC (permalink / raw)
  To: linux-bluetooth

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

There is a small bug in pcm_bluetooth.c.   Typically in an alsa write
call you return the number of samples(frames) that you have processed.
  However in this case where we don't have a full block to encode in
SBC, we return basically return (incoming_buffer_size) %
(SBC_Encode_Block_size).   This is correct in the case where
(incoming_buffer_size) < (SBC_Encode_Block_size), however is wrong
when (incoming_buffer_size) > (SBC_Encode_Block_size), because this
statement ignores previously processed blocks.  This is a small one
line fix.   Patch is attached.    Also I don't know if anyone is
actively working on this, but this section of code is rather
inefficent.   The memcopy is only needed when partial blocks are found
and there are way too many repeated calculations inside the for loop.
 I guess a patch for that will come another day though.

Keith Preston

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: return-correct-number-of-frames.patch --]
[-- Type: text/x-patch; name=return-correct-number-of-frames.patch, Size: 495 bytes --]

diff -Naur bluez-utils-3.36.orig/audio/pcm_bluetooth.c bluez-utils-3.36/audio/pcm_bluetooth.c
--- bluez-utils-3.36.orig/audio/pcm_bluetooth.c	2008-07-23 17:13:13.000000000 -0500
+++ bluez-utils-3.36/audio/pcm_bluetooth.c	2008-07-23 17:13:56.000000000 -0500
@@ -1032,7 +1032,7 @@
 		/* Remember we have some frames in the pipe now */
 		data->count += frames_to_read * frame_size;
 		if (data->count != a2dp->codesize) {
-			ret = frames_to_read;
+			ret += frames_to_read;
 			goto done;
 		}
 

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

end of thread, other threads:[~2008-07-24 19:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-23 22:31 [PATCH] bluez a2dp alsa fix keith preston
2008-07-24 19:29 ` Brad Midgley
2008-07-24 19:34   ` keith preston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox