diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-10-26 00:26:20 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-07-29 19:48:26 -0700 |
commit | cd3a2f684a99344c26b6c9c425ebcd464e2e7e36 (patch) | |
tree | 1ebb85a83582cba03e7e003e2c7a57ac9bc9c57f | |
parent | a58063a1aa2a370947b398076ba051385d4155c6 (diff) |
sbc: 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 5ac02b4..5029d31 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 e17f8fd..6821759 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); |