music_pipe: pass frame size to tail_chunk()

Don't make tail_chunk() calculate the frame size again.
This commit is contained in:
Max Kellermann 2008-11-02 14:18:34 +01:00
parent fd0f195bb7
commit 30fca5e5a9

View File

@ -154,9 +154,8 @@ music_pipe_get_chunk(const unsigned i)
* room. * room.
*/ */
static struct music_chunk * static struct music_chunk *
tail_chunk(float data_time, uint16_t bitRate) tail_chunk(float data_time, uint16_t bitRate, size_t frame_size)
{ {
const size_t frame_size = audio_format_frame_size(&ob.audioFormat);
unsigned int next; unsigned int next;
struct music_chunk *chunk; struct music_chunk *chunk;
@ -197,7 +196,7 @@ size_t music_pipe_append(const void *data0, size_t datalen,
assert((datalen % frame_size) == 0); assert((datalen % frame_size) == 0);
while (datalen) { while (datalen) {
chunk = tail_chunk(data_time, bitRate); chunk = tail_chunk(data_time, bitRate, frame_size);
if (chunk == NULL) if (chunk == NULL)
return ret; return ret;