| Index: tests/test_opus_encode.c
 | 
| diff --git a/tests/test_opus_encode.c b/tests/test_opus_encode.c
 | 
| index ad6345330e57debbbf81d4e6b2bf4fc01141c752..b80def3f64a1ec8bf40dd42cb582d010b5c67d55 100644
 | 
| --- a/tests/test_opus_encode.c
 | 
| +++ b/tests/test_opus_encode.c
 | 
| @@ -38,6 +38,9 @@
 | 
|  #include <time.h>
 | 
|  #if (!defined WIN32 && !defined _WIN32) || defined(__MINGW32__)
 | 
|  #include <unistd.h>
 | 
| +#else
 | 
| +#include <process.h>
 | 
| +#define getpid _getpid
 | 
|  #endif
 | 
|  #include "opus_multistream.h"
 | 
|  #include "opus.h"
 | 
| @@ -141,11 +144,44 @@ int run_test1(int no_fuzz)
 | 
|     enc = opus_encoder_create(48000, 2, OPUS_APPLICATION_VOIP, &err);
 | 
|     if(err != OPUS_OK || enc==NULL)test_failed();
 | 
|  
 | 
| +   for(i=0;i<2;i++)
 | 
| +   {
 | 
| +      int *ret_err;
 | 
| +      ret_err = i?0:&err;
 | 
| +      MSenc = opus_multistream_encoder_create(8000, 2, 2, 0, mapping, OPUS_UNIMPLEMENTED, ret_err);
 | 
| +      if((ret_err && *ret_err != OPUS_BAD_ARG) || MSenc!=NULL)test_failed();
 | 
| +
 | 
| +      MSenc = opus_multistream_encoder_create(8000, 0, 1, 0, mapping, OPUS_APPLICATION_VOIP, ret_err);
 | 
| +      if((ret_err && *ret_err != OPUS_BAD_ARG) || MSenc!=NULL)test_failed();
 | 
| +
 | 
| +      MSenc = opus_multistream_encoder_create(44100, 2, 2, 0, mapping, OPUS_APPLICATION_VOIP, ret_err);
 | 
| +      if((ret_err && *ret_err != OPUS_BAD_ARG) || MSenc!=NULL)test_failed();
 | 
| +
 | 
| +      MSenc = opus_multistream_encoder_create(8000, 2, 2, 3, mapping, OPUS_APPLICATION_VOIP, ret_err);
 | 
| +      if((ret_err && *ret_err != OPUS_BAD_ARG) || MSenc!=NULL)test_failed();
 | 
| +
 | 
| +      MSenc = opus_multistream_encoder_create(8000, 2, -1, 0, mapping, OPUS_APPLICATION_VOIP, ret_err);
 | 
| +      if((ret_err && *ret_err != OPUS_BAD_ARG) || MSenc!=NULL)test_failed();
 | 
| +
 | 
| +      MSenc = opus_multistream_encoder_create(8000, 256, 2, 0, mapping, OPUS_APPLICATION_VOIP, ret_err);
 | 
| +      if((ret_err && *ret_err != OPUS_BAD_ARG) || MSenc!=NULL)test_failed();
 | 
| +   }
 | 
| +
 | 
|     MSenc = opus_multistream_encoder_create(8000, 2, 2, 0, mapping, OPUS_APPLICATION_AUDIO, &err);
 | 
|     if(err != OPUS_OK || MSenc==NULL)test_failed();
 | 
|  
 | 
| +   /*Some multistream encoder API tests*/
 | 
|     if(opus_multistream_encoder_ctl(MSenc, OPUS_GET_BITRATE(&i))!=OPUS_OK)test_failed();
 | 
|     if(opus_multistream_encoder_ctl(MSenc, OPUS_GET_LSB_DEPTH(&i))!=OPUS_OK)test_failed();
 | 
| +   if(i<16)test_failed();
 | 
| +
 | 
| +   {
 | 
| +      OpusEncoder *tmp_enc;
 | 
| +      if(opus_multistream_encoder_ctl(MSenc,  OPUS_MULTISTREAM_GET_ENCODER_STATE(1,&tmp_enc))!=OPUS_OK)test_failed();
 | 
| +      if(opus_encoder_ctl(tmp_enc, OPUS_GET_LSB_DEPTH(&j))!=OPUS_OK)test_failed();
 | 
| +      if(i!=j)test_failed();
 | 
| +      if(opus_multistream_encoder_ctl(MSenc,  OPUS_MULTISTREAM_GET_ENCODER_STATE(2,&tmp_enc))!=OPUS_BAD_ARG)test_failed();
 | 
| +   }
 | 
|  
 | 
|     dec = opus_decoder_create(48000, 2, &err);
 | 
|     if(err != OPUS_OK || dec==NULL)test_failed();
 | 
| @@ -233,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();
 | 
| @@ -281,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));
 | 
| 
 |