diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-11-19 06:22:30 +0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2013-11-19 06:23:21 +0400 |
commit | 43a287fd758b1e67235f3c1054095749249ff13d (patch) | |
tree | b17022031d408b8041cd946de28e809522124a64 /src | |
parent | 2ce30358ecb646720f8612bef64ed73d4a6d64ca (diff) |
Fixes unpad for multi-stream
Diffstat (limited to 'src')
-rw-r--r-- | src/repacketizer.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/repacketizer.c b/src/repacketizer.c index feb9480c..a62675ce 100644 --- a/src/repacketizer.c +++ b/src/repacketizer.c @@ -58,7 +58,7 @@ void opus_repacketizer_destroy(OpusRepacketizer *rp) opus_free(rp); } -int opus_repacketizer_cat(OpusRepacketizer *rp, const unsigned char *data, opus_int32 len) +static int opus_repacketizer_cat_impl(OpusRepacketizer *rp, const unsigned char *data, opus_int32 len, int self_delimited) { unsigned char tmp_toc; int curr_nb_frames,ret; @@ -82,13 +82,18 @@ int opus_repacketizer_cat(OpusRepacketizer *rp, const unsigned char *data, opus_ return OPUS_INVALID_PACKET; } - ret=opus_packet_parse(data, len, &tmp_toc, &rp->frames[rp->nb_frames], &rp->len[rp->nb_frames], NULL); + ret=opus_packet_parse_impl(data, len, self_delimited, &tmp_toc, &rp->frames[rp->nb_frames], &rp->len[rp->nb_frames], NULL, NULL); if(ret<1)return ret; rp->nb_frames += curr_nb_frames; return OPUS_OK; } +int opus_repacketizer_cat(OpusRepacketizer *rp, const unsigned char *data, opus_int32 len) +{ + return opus_repacketizer_cat_impl(rp, data, len, 0); +} + int opus_repacketizer_get_nb_frames(OpusRepacketizer *rp) { return rp->nb_frames; @@ -311,7 +316,7 @@ opus_int32 opus_multistream_packet_unpad(unsigned char *data, opus_int32 len, in return OPUS_BAD_ARG; dst = data; dst_len = 0; - /* Seek to last stream */ + /* Unpad all frames */ for (s=0;s<nb_streams;s++) { opus_int32 ret; @@ -323,7 +328,7 @@ opus_int32 opus_multistream_packet_unpad(unsigned char *data, opus_int32 len, in size, NULL, &packet_offset); if (ret<0) return ret; - ret = opus_repacketizer_cat(&rp, data, packet_offset); + ret = opus_repacketizer_cat_impl(&rp, data, packet_offset, self_delimited); if (ret < 0) return ret; ret = opus_repacketizer_out_range_impl(&rp, 0, rp.nb_frames, dst, len, self_delimited, 0); |