diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/outputBuffer.c | 4 | ||||
-rw-r--r-- | src/outputBuffer.h | 2 | ||||
-rw-r--r-- | src/playerData.c | 10 |
3 files changed, 6 insertions, 10 deletions
diff --git a/src/outputBuffer.c b/src/outputBuffer.c index 26dc50a91..f1d7201a6 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -26,10 +26,10 @@ #include "conf.h" #include "os_compat.h" -void initOutputBuffer(OutputBuffer * cb, OutputBufferChunk * chunks) +void initOutputBuffer(OutputBuffer * cb) { memset(&cb->convState, 0, sizeof(ConvState)); - cb->chunks = chunks; + cb->chunks = xmalloc(buffered_chunks * sizeof(*cb->chunks)); cb->currentChunk = -1; } diff --git a/src/outputBuffer.h b/src/outputBuffer.h index d42400070..70fff1d08 100644 --- a/src/outputBuffer.h +++ b/src/outputBuffer.h @@ -58,7 +58,7 @@ typedef struct _OutputBuffer { ConvState convState; } OutputBuffer; -void initOutputBuffer(OutputBuffer * cb, OutputBufferChunk * chunks); +void initOutputBuffer(OutputBuffer * cb); void clearOutputBuffer(OutputBuffer * cb); diff --git a/src/playerData.c b/src/playerData.c index 27b69cfb2..c2de08512 100644 --- a/src/playerData.c +++ b/src/playerData.c @@ -74,11 +74,8 @@ void initPlayerData(void) buffered_before_play = buffered_chunks; } - allocationSize = buffered_chunks * sizeof(OutputBufferChunk); /*actual buffer */ - allocationSize += buffered_chunks * sizeof(float); /*for times */ - allocationSize += buffered_chunks * sizeof(mpd_sint16); /*for chunkSize */ - allocationSize += buffered_chunks * sizeof(mpd_sint16); /*for bitRate */ - allocationSize += sizeof(PlayerData); /*for playerData struct */ + /* for playerData struct */ + allocationSize = sizeof(PlayerData); /* for audioDeviceStates[] */ allocationSize += device_array_size; @@ -93,8 +90,7 @@ void initPlayerData(void) playerData_pd->audioDeviceStates = (mpd_uint8 *)playerData_pd + allocationSize - device_array_size; - initOutputBuffer(&(playerData_pd->buffer), - (OutputBufferChunk*)(((char *)playerData_pd) + sizeof(PlayerData))); + initOutputBuffer(&(playerData_pd->buffer)); notifyInit(&playerData_pd->playerControl.notify); playerData_pd->playerControl.stop = 0; |