From 4d115e925f937e5c04a1e7f05d3d7a599aeb2bda Mon Sep 17 00:00:00 2001 From: ZhongAn Date: Mon, 27 Aug 2018 07:45:27 -0600 Subject: [PATCH] include/nuttx/audio/audio.h: Change member samp of apb to pointer so driver can customize sample buffer allocation --- include/nuttx/audio/audio.h | 2 +- libs/libc/audio/lib_buffer.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/nuttx/audio/audio.h b/include/nuttx/audio/audio.h index 1395873622..c3872c081a 100644 --- a/include/nuttx/audio/audio.h +++ b/include/nuttx/audio/audio.h @@ -377,7 +377,7 @@ begin_packed_struct struct ap_buffer_s sem_t sem; /* Reference locking semaphore */ uint16_t flags; /* Buffer flags */ uint16_t crefs; /* Number of reference counts */ - uint8_t samp[0]; /* Offset of the first sample */ + FAR uint8_t *samp; /* Offset of the first sample */ } end_packed_struct; /* Structure defining the messages passed to a listening audio thread diff --git a/libs/libc/audio/lib_buffer.c b/libs/libc/audio/lib_buffer.c index 2b548b66bb..55d22ca902 100644 --- a/libs/libc/audio/lib_buffer.c +++ b/libs/libc/audio/lib_buffer.c @@ -130,6 +130,7 @@ int apb_alloc(FAR struct audio_buf_desc_s *bufdesc) apb->nmaxbytes = bufdesc->numbytes; apb->nbytes = 0; apb->flags = 0; + apb->samp = (FAR uint8_t *)(apb + 1); #ifdef CONFIG_AUDIO_MULTI_SESSION apb->session = bufdesc->session; #endif