Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/audio/hound/audio_data.c

    r33b8d024 r38d150e  
    3636#include <macros.h>
    3737#include <stdlib.h>
    38 #include <str.h>
    3938
    4039#include "audio_data.h"
     
    5150    pcm_format_t format)
    5251{
    53         audio_data_t *adata = malloc(sizeof(audio_data_t) + size);
     52        audio_data_t *adata = malloc(sizeof(audio_data_t));
    5453        if (adata) {
    5554                unsigned overflow = size % pcm_format_frame_size(&format);
     
    5756                        log_warning("Data not a multiple of frame size, "
    5857                            "clipping.");
    59                 uint8_t *d = ((uint8_t *)adata) + offsetof(audio_data_t, data);
    60                 memcpy(d, data, size);
     58
     59                adata->data = data;
    6160                adata->size = size - overflow;
    6261                adata->format = format;
     
    8786        atomic_count_t refc = atomic_predec(&adata->refcount);
    8887        if (refc == 0) {
     88                free(adata->data);
    8989                free(adata);
    9090        }
     
    213213 * @return Error code.
    214214 */
    215 errno_t audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data)
     215int audio_pipe_push(audio_pipe_t *pipe, audio_data_t *data)
    216216{
    217217        assert(pipe);
     
    260260 * @param size Target buffer size.
    261261 * @param format Target data format.
    262  * @return Size of the target buffer used.
    263  */
    264 size_t audio_pipe_mix_data(audio_pipe_t *pipe, void *data,
     262 * @return Size of the target buffer used, Error code on failure.
     263 */
     264ssize_t audio_pipe_mix_data(audio_pipe_t *pipe, void *data,
    265265    size_t size, const pcm_format_t *f)
    266266{
Note: See TracChangeset for help on using the changeset viewer.