[pulseaudio-discuss] [PATCH 21/25] raop: Honor memchunk index when encoding chunks

Hajime Fujita crisp.fujita at nifty.com
Sat Sep 7 09:35:10 PDT 2013


In some cases memchunk index is not zero when encoding memory chunk
blocks. This would lead to damage sound quality in some music
players (e.g. Rhythmbox).

This fix was found thanks to Matthias, who reported that his ALAC
codec support fixed the issue.
https://bugs.freedesktop.org/show_bug.cgi?id=42804#c30
By carefully looking at the patch I found an issue in my code.
---
 src/modules/raop/raop_client.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/modules/raop/raop_client.c b/src/modules/raop/raop_client.c
index 527f4b5..d8b1d17 100644
--- a/src/modules/raop/raop_client.c
+++ b/src/modules/raop/raop_client.c
@@ -1299,7 +1299,9 @@ int pa_raop_client_encode_sample(pa_raop_client *c, pa_memchunk *raw, pa_memchun
     bit_writer(&bp,&bpos,&size,(bsize>>8)&0xff,8);
     bit_writer(&bp,&bpos,&size,(bsize)&0xff,8);
 
-    ibp = p = pa_memblock_acquire(raw->memblock);
+    p = pa_memblock_acquire(raw->memblock);
+    p += raw->index;
+    ibp = p;
     maxibp = p + raw->length - 4;
     while (ibp <= maxibp) {
         /* Byte swap stereo data. */
-- 
1.8.1.2



More information about the pulseaudio-discuss mailing list