Changes in uspace/srv/audio/hound/audio_data.c [38d150e:33b8d024] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/audio/hound/audio_data.c
r38d150e r33b8d024 36 36 #include <macros.h> 37 37 #include <stdlib.h> 38 #include <str.h> 38 39 39 40 #include "audio_data.h" … … 50 51 pcm_format_t format) 51 52 { 52 audio_data_t *adata = malloc(sizeof(audio_data_t) );53 audio_data_t *adata = malloc(sizeof(audio_data_t) + size); 53 54 if (adata) { 54 55 unsigned overflow = size % pcm_format_frame_size(&format); … … 56 57 log_warning("Data not a multiple of frame size, " 57 58 "clipping."); 58 59 adata->data = data;59 uint8_t *d = ((uint8_t *)adata) + offsetof(audio_data_t, data); 60 memcpy(d, data, size); 60 61 adata->size = size - overflow; 61 62 adata->format = format; … … 86 87 atomic_count_t refc = atomic_predec(&adata->refcount); 87 88 if (refc == 0) { 88 free(adata->data);89 89 free(adata); 90 90 } … … 213 213 * @return Error code. 214 214 */ 215 int audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data)215 errno_t audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data) 216 216 { 217 217 assert(pipe); … … 260 260 * @param size Target buffer size. 261 261 * @param format Target data format. 262 * @return Size of the target buffer used , Error code on failure.263 */ 264 s size_t audio_pipe_mix_data(audio_pipe_t *pipe, void *data,262 * @return Size of the target buffer used. 263 */ 264 size_t audio_pipe_mix_data(audio_pipe_t *pipe, void *data, 265 265 size_t size, const pcm_format_t *f) 266 266 {
Note:
See TracChangeset
for help on using the changeset viewer.