summaryrefslogtreecommitdiffstats
path: root/sbc/sbcenc.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-10-26 00:26:20 +0200
committerMarcel Holtmann <marcel@holtmann.org>2008-10-26 00:26:20 +0200
commit66e81554621cf700f88a9482b2e55bf797229fbc (patch)
treebed9c19b11f66f559ddbb9dea4b5190d7cd136ed /sbc/sbcenc.c
parentf4779a985079cc7d85d5e0faac0e13497f3dd38c (diff)
Fix missing encoding of last frame
Diffstat (limited to 'sbc/sbcenc.c')
-rw-r--r--sbc/sbcenc.c6
1 files changed, 3 insertions, 3 deletions
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);