diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-10-26 00:26:20 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-10-26 00:26:20 +0200 |
commit | 66e81554621cf700f88a9482b2e55bf797229fbc (patch) | |
tree | bed9c19b11f66f559ddbb9dea4b5190d7cd136ed | |
parent | f4779a985079cc7d85d5e0faac0e13497f3dd38c (diff) |
Fix missing encoding of last frame
-rw-r--r-- | sbc/sbcdec.c | 3 | ||||
-rw-r--r-- | sbc/sbcenc.c | 6 |
2 files changed, 4 insertions, 5 deletions
diff --git a/sbc/sbcdec.c b/sbc/sbcdec.c index 5ac02b44..5029d317 100644 --- a/sbc/sbcdec.c +++ b/sbc/sbcdec.c @@ -170,8 +170,7 @@ static void decode(char *filename, char *output, int tofile) * length of the file (!) */ pos += framelen; framelen = sbc_decode(&sbc, stream + pos, streamlen - pos, - buf + count, sizeof(buf) - count, - &len); + buf + count, sizeof(buf) - count, &len); } if (count > 0) { diff --git a/sbc/sbcenc.c b/sbc/sbcenc.c index e17f8fdb..6821759d 100644 --- a/sbc/sbcenc.c +++ b/sbc/sbcenc.c @@ -172,7 +172,7 @@ static void encode(char *filename, int subbands, int joint) while (1) { if (size < sizeof(input)) { len = __read(fd, input + size, sizeof(input) - size); - if (len == 0) + if (len == 0 && size == 0) break; if (len < 0) { @@ -183,8 +183,8 @@ static void encode(char *filename, int subbands, int joint) size += len; } - len = sbc_encode(&sbc, input, size, output, sizeof(output), - &encoded); + len = sbc_encode(&sbc, input, size, + output, sizeof(output), &encoded); if (len < size) memmove(input, input + len, size - len); |