[pulseaudio-discuss] [PATCH RFCv2 12/27] pstream: #define PA_PSTREAM_SHM_SIZE

Peter Meerwald pmeerw at pmeerw.net
Tue Oct 28 12:46:25 PDT 2014


From: Peter Meerwald <p.meerwald at bct-electronic.com>

Signed-off-by: Peter Meerwald <pmeerw at pmeerw.net>
---
 src/pulsecore/pstream.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c
index 111899d..3a6b5f7 100644
--- a/src/pulsecore/pstream.c
+++ b/src/pulsecore/pstream.c
@@ -74,6 +74,7 @@ enum {
 typedef uint32_t pa_pstream_descriptor[PA_PSTREAM_DESCRIPTOR_MAX];
 
 #define PA_PSTREAM_DESCRIPTOR_SIZE (PA_PSTREAM_DESCRIPTOR_MAX*sizeof(uint32_t))
+#define PA_PSTREAM_SHM_SIZE (PA_PSTREAM_SHM_MAX*sizeof(uint32_t))
 
 #define MINIBUF_SIZE (256)
 
@@ -579,7 +580,6 @@ static void prepare_next_write_item(pa_pstream *p) {
             uint32_t block_id, shm_id;
             size_t offset, length;
             uint32_t *shm_info = (uint32_t *) &p->write.minibuf[PA_PSTREAM_DESCRIPTOR_SIZE];
-            size_t shm_size = sizeof(uint32_t) * PA_PSTREAM_SHM_MAX;
             pa_mempool *current_pool = pa_memblock_get_pool(p->write.current->per_type.memblock_info.chunk.memblock);
             pa_memexport *current_export;
 
@@ -605,8 +605,8 @@ static void prepare_next_write_item(pa_pstream *p) {
                 shm_info[PA_PSTREAM_SHM_INDEX] = htonl((uint32_t) (offset + p->write.current->per_type.memblock_info.chunk.index));
                 shm_info[PA_PSTREAM_SHM_LENGTH] = htonl((uint32_t) p->write.current->per_type.memblock_info.chunk.length);
 
-                p->write.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH] = htonl(shm_size);
-                p->write.minibuf_validsize = PA_PSTREAM_DESCRIPTOR_SIZE + shm_size;
+                p->write.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH] = htonl(PA_PSTREAM_SHM_SIZE);
+                p->write.minibuf_validsize = PA_PSTREAM_DESCRIPTOR_SIZE + PA_PSTREAM_SHM_SIZE;
             }
 /*             else */
 /*                 pa_log_warn("Failed to export memory block."); */
-- 
1.9.1



More information about the pulseaudio-discuss mailing list