From: "keith preston" <keithpre@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] bluez a2dp alsa fix
Date: Wed, 23 Jul 2008 17:31:30 -0500 [thread overview]
Message-ID: <3837d8b10807231531h36402a71g3ee5ac500a5dc45@mail.gmail.com> (raw)
[-- 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;
}
next reply other threads:[~2008-07-23 22:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-23 22:31 keith preston [this message]
2008-07-24 19:29 ` [PATCH] bluez a2dp alsa fix Brad Midgley
2008-07-24 19:34 ` keith preston
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3837d8b10807231531h36402a71g3ee5ac500a5dc45@mail.gmail.com \
--to=keithpre@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox