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