summaryrefslogtreecommitdiff
path: root/src/repacketizer.c
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2011-10-30 19:57:22 -0400
committerGregory Maxwell <greg@xiph.org>2011-10-30 19:57:22 -0400
commitafd05aca0cdb2cd4b530d00cbb823ecc148b5780 (patch)
treea9546eda5b3330d1a7818fadfb063cfab8e335f5 /src/repacketizer.c
parentb77c44b46f46810ae9af3a1b88d361f1daeb769b (diff)
downloadopus-afd05aca0cdb2cd4b530d00cbb823ecc148b5780.tar.gz
Fix multistream packet corruption, implement GET_FINAL_RANGE for multistream, and add many tests.
Multistream encode was failing to add the length of the extra length for self-delimited packets causing corrupted output. Multistream decode was not properly handling lost frames (and potentially reading out of bounds as a result). GET_FINAL_RANGE has been implemented as the xor of the final range of all the streams in the packet. test_opus_encode now does the mono narrowband tests using dual-mono multistream.
Diffstat (limited to 'src/repacketizer.c')
-rw-r--r--src/repacketizer.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/repacketizer.c b/src/repacketizer.c
index e947383a..1caa2feb 100644
--- a/src/repacketizer.c
+++ b/src/repacketizer.c
@@ -182,8 +182,11 @@ opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int
}
break;
}
- if (self_delimited)
- data += encode_size(len[count-1], data);
+ if (self_delimited) {
+ int sdlen = encode_size(len[count-1], data);
+ tot_size += sdlen;
+ data += sdlen;
+ }
/* Copy the actual data */
for (i=0;i<count;i++)
{