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
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; }