diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2012-12-05 00:07:45 +0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2012-12-05 00:07:45 +0400 |
commit | 7fcd66c40d0257796c912a6f500a98cbea89e704 (patch) | |
tree | fd4f7464453c559e34ad0080ba114bef0a4d5363 /tests | |
parent | 124f69b00ca3dae73b1815985b0a83c30934afa6 (diff) |
Changes the PLC behaviour and fixes the FEC behaviour on concatenated packets
PLC and FEC now return exactly the number of samples specified for the
buffer rather than (usually) returning the size of the last packet.
Doc and tests are updated accordingly.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_opus_decode.c | 16 | ||||
-rw-r--r-- | tests/test_opus_encode.c | 6 |
2 files changed, 11 insertions, 11 deletions
diff --git a/tests/test_opus_decode.c b/tests/test_opus_decode.c index 868869b9..be93df48 100644 --- a/tests/test_opus_decode.c +++ b/tests/test_opus_decode.c @@ -106,21 +106,21 @@ int test_decoder_code0(int no_fuzz) for(fec=0;fec<2;fec++) { /*Test PLC on a fresh decoder*/ - out_samples = opus_decode(dec[t], 0, 0, outbuf, MAX_FRAME_SAMP, fec); + out_samples = opus_decode(dec[t], 0, 0, outbuf, 120/factor, fec); if(out_samples!=120/factor)test_failed(); /*Test null pointer input*/ - out_samples = opus_decode(dec[t], 0, -1, outbuf, MAX_FRAME_SAMP, fec); + out_samples = opus_decode(dec[t], 0, -1, outbuf, 120/factor, fec); if(out_samples!=120/factor)test_failed(); - out_samples = opus_decode(dec[t], 0, 1, outbuf, MAX_FRAME_SAMP, fec); + out_samples = opus_decode(dec[t], 0, 1, outbuf, 120/factor, fec); if(out_samples!=120/factor)test_failed(); - out_samples = opus_decode(dec[t], 0, 10, outbuf, MAX_FRAME_SAMP, fec); + out_samples = opus_decode(dec[t], 0, 10, outbuf, 120/factor, fec); if(out_samples!=120/factor)test_failed(); - out_samples = opus_decode(dec[t], 0, fast_rand(), outbuf, MAX_FRAME_SAMP, fec); + out_samples = opus_decode(dec[t], 0, fast_rand(), outbuf, 120/factor, fec); if(out_samples!=120/factor)test_failed(); /*Zero lengths*/ - out_samples = opus_decode(dec[t], packet, 0, outbuf, MAX_FRAME_SAMP, fec); + out_samples = opus_decode(dec[t], packet, 0, outbuf, 120/factor, fec); if(out_samples!=120/factor)test_failed(); /*Zero buffer*/ @@ -182,7 +182,7 @@ int test_decoder_code0(int no_fuzz) /* The PLC is run for 6 frames in order to get better PLC coverage. */ for(j=0;j<6;j++) { - out_samples = opus_decode(dec[t], 0, 0, outbuf, MAX_FRAME_SAMP, 0); + out_samples = opus_decode(dec[t], 0, 0, outbuf, expected[t], 0); if(out_samples!=expected[t])test_failed(); } /* Run the PLC once at 2.5ms, as a simulation of someone trying to @@ -292,7 +292,7 @@ int test_decoder_code0(int no_fuzz) for(t=0;t<5*2;t++)expected[t]=opus_decoder_get_nb_samples(dec[t],packet,plen); for(j=0;j<plen;j++)packet[j+1]=(fast_rand()|fast_rand())&255; memcpy(decbak,dec[0],decsize); - if(opus_decode(decbak, packet, plen+1, outbuf, MAX_FRAME_SAMP, 1)!=expected[0])test_failed(); + if(opus_decode(decbak, packet, plen+1, outbuf, expected[0], 1)!=expected[0])test_failed(); memcpy(decbak,dec[0],decsize); if(opus_decode(decbak, 0, 0, outbuf, MAX_FRAME_SAMP, 1)<20)test_failed(); memcpy(decbak,dec[0],decsize); diff --git a/tests/test_opus_encode.c b/tests/test_opus_encode.c index 61e0dec1..b80def3f 100644 --- a/tests/test_opus_encode.c +++ b/tests/test_opus_encode.c @@ -269,7 +269,7 @@ int run_test1(int no_fuzz) if(opus_decoder_ctl(dec, OPUS_GET_FINAL_RANGE(&dec_final_range))!=OPUS_OK)test_failed(); if(enc_final_range!=dec_final_range)test_failed(); /*LBRR decode*/ - out_samples = opus_decode(dec_err[0], packet, len, out2buf, MAX_FRAME_SAMP, (fast_rand()&3)!=0); + out_samples = opus_decode(dec_err[0], packet, len, out2buf, frame_size, (fast_rand()&3)!=0); if(out_samples!=frame_size)test_failed(); out_samples = opus_decode(dec_err[1], packet, (fast_rand()&3)==0?0:len, out2buf, MAX_FRAME_SAMP, (fast_rand()&7)!=0); if(out_samples<120)test_failed(); @@ -317,8 +317,8 @@ int run_test1(int no_fuzz) if(enc_final_range!=dec_final_range)test_failed(); /*LBRR decode*/ loss=(fast_rand()&63)==0; - out_samples = opus_multistream_decode(MSdec_err, packet, loss?0:len, out2buf, MAX_FRAME_SAMP, (fast_rand()&3)!=0); - if(loss?out_samples<120:out_samples!=(frame_size*6))test_failed(); + out_samples = opus_multistream_decode(MSdec_err, packet, loss?0:len, out2buf, frame_size*6, (fast_rand()&3)!=0); + if(out_samples!=(frame_size*6))test_failed(); i+=frame_size; count++; }while(i<(SSAMPLES/12-MAX_FRAME_SAMP)); |