Changeset 231c770 in mainline


Ignore:
Timestamp:
2018-04-06T21:29:11Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
105fcf0
Parents:
2f1c88e
git-author:
Jakub Jermar <jakub@…> (2018-04-06 20:59:41)
git-committer:
Jakub Jermar <jakub@…> (2018-04-06 21:29:11)
Message:

Fix handling of hound audio data

Commit 33b8d024bc268f2773c26e74a40dada11bb71e58 broke audio.

Hound needs to modify the buffer even after audio_data_create() returns.
The original buffer also needs to be eventually deallocated. Lastly,
the extra data copy may introduce undesired latencies.

This commit reverts the offending parts of
33b8d024bc268f2773c26e74a40dada11bb71e58.

Location:
uspace/srv/audio/hound
Files:
2 edited

Legend:

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

    r2f1c88e r231c770  
    3636#include <macros.h>
    3737#include <stdlib.h>
    38 #include <str.h>
    3938
    4039#include "audio_data.h"
     
    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                adata->data = data;
    6159                adata->size = size - overflow;
    6260                adata->format = format;
     
    8785        atomic_count_t refc = atomic_predec(&adata->refcount);
    8886        if (refc == 0) {
     87                free((void *) adata->data);
    8988                free(adata);
    9089        }
  • uspace/srv/audio/hound/audio_data.h

    r2f1c88e r231c770  
    4545/** Reference counted audio buffer */
    4646typedef struct {
     47        /** Audio data */
     48        const void *data;
    4749        /** Size of the buffer pointer to by data */
    4850        size_t size;
     
    5153        /** Reference counter */
    5254        atomic_t refcount;
    53         /** Audio data */
    54         const uint8_t data[];
    5555} audio_data_t;
    5656
Note: See TracChangeset for help on using the changeset viewer.