Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2012-12-06 06:48:45 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2012-12-06 06:48:45 +0400
commita0737d1fcfcc099ae72d23c127d11bfa0a0b8879 (patch)
tree1cf1671e8555a2bb01729f189c020c608cbe883d
parent535efb0707307c9d74bdb8cdcee0b5dc0d409d6e (diff)
Fixes OPUS_GET_LAST_PACKET_DURATION
Calling PLC/FEC with a different size was not updating it
-rw-r--r--src/opus_decoder.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/opus_decoder.c b/src/opus_decoder.c
index e2b9ed9e..85c256fd 100644
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -759,6 +759,7 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
celt_assert(pcm_count == frame_size);
if (OPUS_CHECK_ARRAY(pcm, pcm_count*st->channels))
OPUS_PRINT_INT(pcm_count);
+ st->last_packet_duration = pcm_count;
return pcm_count;
} else if (len<0)
return OPUS_BAD_ARG;
@@ -774,14 +775,19 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
if (decode_fec)
{
+ int duration_copy;
int ret;
/* If no FEC can be present, run the PLC (recursive call) */
if (frame_size <= packet_frame_size || packet_mode == MODE_CELT_ONLY || st->mode == MODE_CELT_ONLY)
return opus_decode_native(st, NULL, 0, pcm, frame_size, 0, 0, NULL);
/* Otherwise, run the PLC on everything except the size for which we might have FEC */
+ duration_copy = st->last_packet_duration;
ret = opus_decode_native(st, NULL, 0, pcm, frame_size-packet_frame_size, 0, 0, NULL);
if (ret<0)
+ {
+ st->last_packet_duration = duration_copy;
return ret;
+ }
celt_assert(ret==frame_size-packet_frame_size);
/* Complete with FEC */
st->mode = packet_mode;
@@ -795,6 +801,7 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
else {
if (OPUS_CHECK_ARRAY(pcm, frame_size*st->channels))
OPUS_PRINT_INT(frame_size);
+ st->last_packet_duration = frame_size;
return frame_size;
}
}