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