summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Harris <mark.hsj@gmail.com>2022-06-26 13:40:45 -0700
committerMark Harris <mark.hsj@gmail.com>2022-06-26 14:57:24 -0700
commit57ddf37c83eff80a5064c38fde57b6cc6ad1e739 (patch)
tree45dc1066093fdb0a5d35ac5fb5c7c7e6b5819d45
parent63855aff731dcf58875c159dc2fa7463a444d617 (diff)
downloadopus-57ddf37c83eff80a5064c38fde57b6cc6ad1e739.tar.gz
Fix 8101b33 to decode ignored redundancy
Even if the redundancy is ignored, the final range from the decoder is needed for testing. Reviewed by Timothy B. Terriberry.
-rw-r--r--src/opus_decoder.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/opus_decoder.c b/src/opus_decoder.c
index 0be87dc0..6520e748 100644
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -455,10 +455,6 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
{
transition = 0;
pcm_transition_silk_size=ALLOC_NONE;
- /* don't use stale CELT decoder to decode second redundancy frame if
- the first redundancy frame for a transition from SILK was lost */
- if (celt_to_silk && st->prev_mode == MODE_SILK_ONLY && !st->prev_redundancy)
- redundancy = 0;
}
ALLOC(pcm_transition_silk, pcm_transition_silk_size, opus_val16);
@@ -504,6 +500,11 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
/* 5 ms redundant frame for CELT->SILK*/
if (redundancy && celt_to_silk)
{
+ /* If the previous frame did not use CELT (the first redundancy frame in
+ a transition from SILK may have been lost) then the CELT decoder is
+ stale at this point and the redundancy audio is not useful, however
+ the final range is still needed (for testing), so the redundancy is
+ always decoded but the decoded audio may not be used */
MUST_SUCCEED(celt_decoder_ctl(celt_dec, CELT_SET_START_BAND(0)));
celt_decode_with_ec(celt_dec, data+len, redundancy_bytes,
redundant_audio, F5, NULL, 0);
@@ -566,7 +567,10 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
smooth_fade(pcm+st->channels*(frame_size-F2_5), redundant_audio+st->channels*F2_5,
pcm+st->channels*(frame_size-F2_5), F2_5, st->channels, window, st->Fs);
}
- if (redundancy && celt_to_silk)
+ /* 5ms redundant frame for CELT->SILK; ignore if the previous frame did not
+ use CELT (the first redundancy frame in a transition from SILK may have
+ been lost) */
+ if (redundancy && celt_to_silk && (st->prev_mode != MODE_SILK_ONLY || st->prev_redundancy))
{
for (c=0;c<st->channels;c++)
{