Changeset 2373ba7 in mainline


Ignore:
Timestamp:
2013-04-05T17:26:01Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
353f8cc
Parents:
7e7def5
Message:

hound: warn and clip if data size is not a multiple of framesize

File:
1 edited

Legend:

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

    r7e7def5 r2373ba7  
    3636#include <macros.h>
    3737#include <malloc.h>
     38
    3839#include "audio_data.h"
     40#include "log.h"
    3941
    4042audio_data_t *audio_data_create(const void *data, size_t size,
     
    4345        audio_data_t *adata = malloc(sizeof(audio_data_t));
    4446        if (adata) {
     47                unsigned overflow = size % pcm_format_frame_size(&format);
     48                if (overflow)
     49                        log_warning("Data not a multiple of frame size, "
     50                            "clipping.");
     51
    4552                adata->data = data;
    46                 adata->size = size;
     53                adata->size = size - overflow;
    4754                adata->format = format;
    4855                atomic_set(&adata->refcount, 1);
Note: See TracChangeset for help on using the changeset viewer.