Commit 617fcd2c authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Fixes a few PLC/DTX bugs due to the recent decode API change

parent d4341929
celt @ 1a8bf37d
Subproject commit 6f6e8b39842a7d175e89f47e4d37ad5de8143ad2
Subproject commit 1a8bf37dbaa461d410c101d1be302a67b4927035
......@@ -216,8 +216,9 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
/* Shrink decoder because of raw bits */
dec.storage -= redundancy_bytes;
}
start_band = 17;
}
if (mode != MODE_CELT_ONLY)
start_band = 17;
if (mode != MODE_SILK_ONLY)
{
......@@ -343,7 +344,9 @@ int opus_decode(OpusDecoder *st, const unsigned char *data,
unsigned char ch, toc;
/* 48 x 2.5 ms = 120 ms */
short size[48];
if (len<1)
if (len==0 || data==NULL)
return opus_decode_frame(st, NULL, 0, pcm, frame_size, 0);
else if (len<0)
return CELT_BAD_ARG;
st->mode = opus_packet_get_mode(data);
st->bandwidth = opus_packet_get_bandwidth(data);
......
......@@ -293,6 +293,9 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
fprintf (stderr, "SILK encode error: %d\n", ret);
/* Handle error */
}
if (nBytes==0)
return 0;
/* Extract SILK internal bandwidth for signaling in first byte */
if( st->mode == MODE_SILK_ONLY ) {
if( st->silk_mode.internalSampleRate == 8000 ) {
......
......@@ -285,13 +285,13 @@ int main(int argc, char *argv[])
#if OPUS_TEST_RANGE_CODER_STATE
enc_final_range[toggle] = opus_encoder_get_final_range( enc );
#endif
if (len[toggle] <= 0)
if (len[toggle] < 0)
{
fprintf (stderr, "opus_encode() returned %d\n", len[toggle]);
return 1;
}
lost = rand()%100<packet_loss_perc;
lost = rand()%100<packet_loss_perc || len[toggle]==0;
if( count >= use_inbandfec ) {
/* delay by one packet when using in-band FEC */
if( use_inbandfec ) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment