diff options
author | Jean-Marc Valin <jmvalin@amazon.com> | 2022-12-20 01:24:47 +0300 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@amazon.com> | 2023-06-16 20:01:25 +0300 |
commit | 2d98cedd0efa745143c7b826a695385fe262fbec (patch) | |
tree | d422e99d82204724b37df0882038a9834466161f /src | |
parent | 37a4e2e3d0743b3c8eca2a23e4c45e23b4d56f73 (diff) |
Should handle mixes of PLC and DRED
Diffstat (limited to 'src')
-rw-r--r-- | src/opus_decoder.c | 13 | ||||
-rw-r--r-- | src/opus_demo.c | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/opus_decoder.c b/src/opus_decoder.c index 70364e22..947d6fed 100644 --- a/src/opus_decoder.c +++ b/src/opus_decoder.c @@ -659,15 +659,15 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data, features_per_frame = frame_size/(st->Fs/100); needed_feature_frames = features_per_frame; if (!silk_dec->sPLC.pre_filled) needed_feature_frames+=2; - silk_dec->sPLC.pre_filled = 1; for (i=0;i<needed_feature_frames;i++) { int feature_offset = (needed_feature_frames-i-1 + (decode_fec-1)*features_per_frame); - /* FIXME: Find something better than that (involving actual PLC) */ - feature_offset = IMIN(feature_offset, silk_dec->sPLC.nb_fec_frames-1); - lpcnet_plc_fec_add(silk_dec->sPLC.lpcnet, silk_dec->sPLC.fec_features+feature_offset*DRED_NUM_FEATURES); + if (feature_offset <= silk_dec->sPLC.nb_fec_frames-1) { + lpcnet_plc_fec_add(silk_dec->sPLC.lpcnet, silk_dec->sPLC.fec_features+feature_offset*DRED_NUM_FEATURES); + } else { + lpcnet_plc_fec_add(silk_dec->sPLC.lpcnet, NULL); + } + } - } else { - silk_dec->sPLC.pre_filled = 0; } if (len==0 || data==NULL) { @@ -1114,7 +1114,6 @@ int opus_decoder_dred_input(OpusDecoder *st, const unsigned char *data, /*printf("Found: %p of size %d\n", payload, payload_len);*/ min_feature_frames = IMIN(2 + offset, 2*DRED_NUM_REDUNDANCY_FRAMES); silk_dec->sPLC.nb_fec_frames = dred_decode_redundancy_package(&silk_dec->sPLC.dred_decoder, silk_dec->sPLC.fec_features, payload, payload_len, min_feature_frames); - /*printf("%d\n", silk_dec->sPLC.nb_fec_frames);*/ return 1; } return 0; diff --git a/src/opus_demo.c b/src/opus_demo.c index 50a66db3..c40819a1 100644 --- a/src/opus_demo.c +++ b/src/opus_demo.c @@ -787,7 +787,7 @@ int main(int argc, char *argv[]) if (run_decoder) run_decoder += lost_count; if (!lost && lost_count > 0) { - opus_decoder_dred_input(dec, data, len, 100); + opus_decoder_dred_input(dec, data, len, 2); } /* FIXME: Figure out how to trigger the decoder when the last packet of the file is lost. */ for (fr=0;fr<run_decoder;fr++) { |