Lines Matching refs:packet
89 unsigned char packet[1276]; in test_dec_api() local
188 VG_UNDEF(packet,sizeof(packet)); in test_dec_api()
189 packet[0]=63<<2;packet[1]=packet[2]=0; in test_dec_api()
190 if(opus_decode(dec, packet, 3, sbuf, 960, 0)!=960)test_failed(); in test_dec_api()
196 packet[0]=1; in test_dec_api()
197 if(opus_decode(dec, packet, 1, sbuf, 960, 0)!=960)test_failed(); in test_dec_api()
247 VG_UNDEF(packet,sizeof(packet)); in test_dec_api()
248 packet[0]=0; in test_dec_api()
249 if(opus_decoder_get_nb_samples(dec,packet,1)!=480)test_failed(); in test_dec_api()
250 if(opus_packet_get_nb_samples(packet,1,48000)!=480)test_failed(); in test_dec_api()
251 if(opus_packet_get_nb_samples(packet,1,96000)!=960)test_failed(); in test_dec_api()
252 if(opus_packet_get_nb_samples(packet,1,32000)!=320)test_failed(); in test_dec_api()
253 if(opus_packet_get_nb_samples(packet,1,8000)!=80)test_failed(); in test_dec_api()
254 packet[0]=3; in test_dec_api()
255 if(opus_packet_get_nb_samples(packet,1,24000)!=OPUS_INVALID_PACKET)test_failed(); in test_dec_api()
256 packet[0]=(63<<2)|3; in test_dec_api()
257 packet[1]=63; in test_dec_api()
258 if(opus_packet_get_nb_samples(packet,0,24000)!=OPUS_BAD_ARG)test_failed(); in test_dec_api()
259 if(opus_packet_get_nb_samples(packet,2,48000)!=OPUS_INVALID_PACKET)test_failed(); in test_dec_api()
260 if(opus_decoder_get_nb_samples(dec,packet,2)!=OPUS_INVALID_PACKET)test_failed(); in test_dec_api()
264 if(OPUS_BAD_ARG!=opus_packet_get_nb_frames(packet,0))test_failed(); in test_dec_api()
267 packet[0]=i; in test_dec_api()
268 if(l1res[packet[0]&3]!=opus_packet_get_nb_frames(packet,1))test_failed(); in test_dec_api()
271 packet[1]=j; in test_dec_api()
272 …if(((packet[0]&3)!=3?l1res[packet[0]&3]:packet[1]&63)!=opus_packet_get_nb_frames(packet,2))test_fa… in test_dec_api()
280 packet[0]=i; in test_dec_api()
281 bw=packet[0]>>4; in test_dec_api()
283 if(bw!=opus_packet_get_bandwidth(packet))test_failed(); in test_dec_api()
290 packet[0]=i; in test_dec_api()
291 fp3s=packet[0]>>3; in test_dec_api()
294 …if((opus_rates[rate]*3/fp3s)!=opus_packet_get_samples_per_frame(packet,opus_rates[rate]))test_fail… in test_dec_api()
300 packet[0]=(63<<2)+3; in test_dec_api()
301 packet[1]=49; in test_dec_api()
302 for(j=2;j<51;j++)packet[j]=0; in test_dec_api()
304 if(opus_decode(dec, packet, 51, sbuf, 960, 0)!=OPUS_INVALID_PACKET)test_failed(); in test_dec_api()
306 packet[0]=(63<<2); in test_dec_api()
307 packet[1]=packet[2]=0; in test_dec_api()
308 if(opus_decode(dec, packet, -1, sbuf, 960, 0)!=OPUS_BAD_ARG)test_failed(); in test_dec_api()
310 if(opus_decode(dec, packet, 3, sbuf, 60, 0)!=OPUS_BUFFER_TOO_SMALL)test_failed(); in test_dec_api()
312 if(opus_decode(dec, packet, 3, sbuf, 480, 0)!=OPUS_BUFFER_TOO_SMALL)test_failed(); in test_dec_api()
314 if(opus_decode(dec, packet, 3, sbuf, 960, 0)!=960)test_failed(); in test_dec_api()
319 if(opus_decode_float(dec, packet, 3, fbuf, 960, 0)!=960)test_failed(); in test_dec_api()
328 if(opus_decode(0,packet,1,outbuf,2880,0) !=OPUS_INVALID_STATE)test_failed(); in test_dec_api()
329 if(opus_decode_float(0,packet,1,0,2880,0) !=OPUS_INVALID_STATE)test_failed(); in test_dec_api()
330 if(opus_decoder_get_nb_samples(0,packet,1) !=OPUS_INVALID_STATE)test_failed(); in test_dec_api()
348 unsigned char packet[1276]; in test_msdec_api() local
620 VG_UNDEF(packet,sizeof(packet)); in test_msdec_api()
621 packet[0]=63<<2;packet[1]=packet[2]=0; in test_msdec_api()
622 if(opus_multistream_decode(dec, packet, 3, sbuf, 960, 0)!=960)test_failed(); in test_msdec_api()
628 packet[0]=1; in test_msdec_api()
629 if(opus_multistream_decode(dec, packet, 1, sbuf, 960, 0)!=960)test_failed(); in test_msdec_api()
650 packet[0]=(63<<2)+3; in test_msdec_api()
651 packet[1]=49; in test_msdec_api()
652 for(j=2;j<51;j++)packet[j]=0; in test_msdec_api()
654 if(opus_multistream_decode(dec, packet, 51, sbuf, 960, 0)!=OPUS_INVALID_PACKET)test_failed(); in test_msdec_api()
656 packet[0]=(63<<2); in test_msdec_api()
657 packet[1]=packet[2]=0; in test_msdec_api()
658 …f(opus_multistream_decode(dec, packet, -1, sbuf, 960, 0)!=OPUS_BAD_ARG){printf("%d\n",opus_multist… in test_msdec_api()
660 if(opus_multistream_decode(dec, packet, 3, sbuf, 60, 0)!=OPUS_BUFFER_TOO_SMALL)test_failed(); in test_msdec_api()
662 if(opus_multistream_decode(dec, packet, 3, sbuf, 480, 0)!=OPUS_BUFFER_TOO_SMALL)test_failed(); in test_msdec_api()
664 if(opus_multistream_decode(dec, packet, 3, sbuf, 960, 0)!=960)test_failed(); in test_msdec_api()
669 if(opus_multistream_decode_float(dec, packet, 3, fbuf, 960, 0)!=960)test_failed(); in test_msdec_api()
678 if(opus_multistream_decode(0,packet,1,outbuf,2880,0) !=OPUS_INVALID_STATE)test_failed(); in test_msdec_api()
679 if(opus_multistream_decode_float(0,packet,1,0,2880,0) !=OPUS_INVALID_STATE)test_failed(); in test_msdec_api()
680 if(opus_multistream_decoder_get_nb_samples(0,packet,1) !=OPUS_INVALID_STATE)test_failed(); in test_msdec_api()
712 unsigned char packet[1276]; in test_parse() local
720 memset(packet,0,sizeof(char)*1276); in test_parse()
721 packet[0]=63<<2; in test_parse()
722 if(opus_packet_parse(packet,1,&toc,frames,0,&payload_offset)!=OPUS_BAD_ARG)test_failed(); in test_parse()
727 packet[0]=i<<2; in test_parse()
729 ret=opus_packet_parse(packet,4,&toc,frames,size,&payload_offset); in test_parse()
733 if(frames[0]!=packet+1)test_failed(); in test_parse()
741 packet[0]=(i<<2)+1; in test_parse()
745 ret=opus_packet_parse(packet,jj,&toc,frames,size,&payload_offset); in test_parse()
753 if(frames[0]!=packet+1)test_failed(); in test_parse()
765 packet[0]=(i<<2)+2; in test_parse()
767 ret=opus_packet_parse(packet,1,&toc,frames,size,&payload_offset); in test_parse()
770 packet[1]=252; in test_parse()
772 ret=opus_packet_parse(packet,2,&toc,frames,size,&payload_offset); in test_parse()
777 if(j<252)packet[1]=j; in test_parse()
778 else{packet[1]=252+(j&3);packet[2]=(j-252)>>2;} in test_parse()
781 ret=opus_packet_parse(packet,j+(j<252?2:3)-1,&toc,frames,size,&payload_offset); in test_parse()
786 ret=opus_packet_parse(packet,j+(j<252?2:3)+1276,&toc,frames,size,&payload_offset); in test_parse()
791 ret=opus_packet_parse(packet,j+(j<252?2:3),&toc,frames,size,&payload_offset); in test_parse()
799 ret=opus_packet_parse(packet,(j<<1)+4,&toc,frames,size,&payload_offset); in test_parse()
812 packet[0]=(i<<2)+3; in test_parse()
815 ret=opus_packet_parse(packet,1,&toc,frames,size,&payload_offset); in test_parse()
825 packet[0]=(i<<2)+3; in test_parse()
828 packet[1]=0+(jj&63); /*CBR, no padding*/ in test_parse()
830 ret=opus_packet_parse(packet,1275,&toc,frames,size,&payload_offset); in test_parse()
833 packet[1]=128+(jj&63); /*VBR, no padding*/ in test_parse()
835 ret=opus_packet_parse(packet,1275,&toc,frames,size,&payload_offset); in test_parse()
838 packet[1]=64+(jj&63); /*CBR, padding*/ in test_parse()
840 ret=opus_packet_parse(packet,1275,&toc,frames,size,&payload_offset); in test_parse()
843 packet[1]=128+64+(jj&63); /*VBR, padding*/ in test_parse()
845 ret=opus_packet_parse(packet,1275,&toc,frames,size,&payload_offset); in test_parse()
855 packet[0]=(i<<2)+3; in test_parse()
857 packet[1]=1; in test_parse()
861 ret=opus_packet_parse(packet,j+2,&toc,frames,size,&payload_offset); in test_parse()
868 ret=opus_packet_parse(packet,1276+2,&toc,frames,size,&payload_offset); in test_parse()
879 packet[0]=(i<<2)+3; in test_parse()
880 frame_samp=opus_packet_get_samples_per_frame(packet,48000); in test_parse()
883 packet[1]=j; in test_parse()
887 ret=opus_packet_parse(packet,sz,&toc,frames,size,&payload_offset); in test_parse()
899 packet[1]=5760/frame_samp; in test_parse()
901 ret=opus_packet_parse(packet,1275*packet[1]+2,&toc,frames,size,&payload_offset); in test_parse()
903 if(ret!=packet[1])test_failed(); in test_parse()
913 packet[0]=(i<<2)+3; in test_parse()
914 packet[1]=128+1; in test_parse()
915 frame_samp=opus_packet_get_samples_per_frame(packet,48000); in test_parse()
919 ret=opus_packet_parse(packet,2+jj,&toc,frames,size,&payload_offset); in test_parse()
926 ret=opus_packet_parse(packet,2+1276,&toc,frames,size,&payload_offset); in test_parse()
931 packet[1]=128+j; in test_parse()
934 ret=opus_packet_parse(packet,2+j-2,&toc,frames,size,&payload_offset); in test_parse()
937 packet[2]=252; in test_parse()
938 packet[3]=0; in test_parse()
939 for(jj=4;jj<2+j;jj++)packet[jj]=0; in test_parse()
941 ret=opus_packet_parse(packet,2+j,&toc,frames,size,&payload_offset); in test_parse()
945 for(jj=2;jj<2+j;jj++)packet[jj]=0; in test_parse()
947 ret=opus_packet_parse(packet,2+j-2,&toc,frames,size,&payload_offset); in test_parse()
951 packet[2]=252; in test_parse()
952 packet[3]=0; in test_parse()
953 for(jj=4;jj<2+j;jj++)packet[jj]=0; in test_parse()
955 ret=opus_packet_parse(packet,2+j+252-1,&toc,frames,size,&payload_offset); in test_parse()
959 for(jj=2;jj<2+j;jj++)packet[jj]=0; in test_parse()
961 ret=opus_packet_parse(packet,2+j-1,&toc,frames,size,&payload_offset); in test_parse()
976 if(as<252){packet[2+pos]=as;pos++;} in test_parse()
977 else{packet[2+pos]=252+(as&3);packet[3+pos]=(as-252)>>2;pos+=2;} in test_parse()
980 ret=opus_packet_parse(packet,tsz[sz]+i,&toc,frames,size,&payload_offset); in test_parse()
996 packet[0]=(i<<2)+3; in test_parse()
998 packet[1]=128+1+64; in test_parse()
1000 for(jj=2;jj<127;jj++)packet[jj]=255; in test_parse()
1002 ret=opus_packet_parse(packet,127,&toc,frames,size,&payload_offset); in test_parse()
1012 for(pos=0;pos<jj/254;pos++)packet[2+pos]=255; in test_parse()
1013 packet[2+pos]=jj%254; in test_parse()
1019 ret=opus_packet_parse(packet,2+jj+pos-1,&toc,frames,size,&payload_offset); in test_parse()
1024 ret=opus_packet_parse(packet,2+jj+tsz[sz]+i+pos,&toc,frames,size,&payload_offset); in test_parse()
1072 unsigned char packet[1276]; in test_enc_api() local
1406 VG_UNDEF(packet,sizeof(packet)); in test_enc_api()
1407 i=opus_encode(enc, sbuf, 960, packet, sizeof(packet)); in test_enc_api()
1408 if(i<1 || (i>(opus_int32)sizeof(packet)))test_failed(); in test_enc_api()
1409 VG_CHECK(packet,i); in test_enc_api()
1414 VG_UNDEF(packet,sizeof(packet)); in test_enc_api()
1415 i=opus_encode_float(enc, fbuf, 960, packet, sizeof(packet)); in test_enc_api()
1416 if(i<1 || (i>(opus_int32)sizeof(packet)))test_failed(); in test_enc_api()
1417 VG_CHECK(packet,i); in test_enc_api()
1426 if(opus_encode(0,sbuf,960,packet,sizeof(packet)) !=OPUS_INVALID_STATE)test_failed(); in test_enc_api()
1427 if(opus_encode_float(0,fbuf,960,packet,sizeof(packet))!=OPUS_INVALID_STATE)test_failed(); in test_enc_api()
1441 unsigned char *packet; in test_repacketizer_api() local
1447 packet=malloc(max_out); in test_repacketizer_api()
1448 if(packet==NULL)test_failed(); in test_repacketizer_api()
1449 memset(packet,0,max_out); in test_repacketizer_api()
1475 VG_UNDEF(packet,4); in test_repacketizer_api()
1476 if(opus_repacketizer_cat(rp,packet,0)!=OPUS_INVALID_PACKET)test_failed(); /* Zero len */ in test_repacketizer_api()
1478 packet[0]=1; in test_repacketizer_api()
1479 … if(opus_repacketizer_cat(rp,packet,2)!=OPUS_INVALID_PACKET)test_failed(); /* Odd payload code 1 */ in test_repacketizer_api()
1481 packet[0]=2; in test_repacketizer_api()
1482 …if(opus_repacketizer_cat(rp,packet,1)!=OPUS_INVALID_PACKET)test_failed(); /* Code 2 overflow one */ in test_repacketizer_api()
1484 packet[0]=3; in test_repacketizer_api()
1485 if(opus_repacketizer_cat(rp,packet,1)!=OPUS_INVALID_PACKET)test_failed(); /* Code 3 no count */ in test_repacketizer_api()
1487 packet[0]=2; in test_repacketizer_api()
1488 packet[1]=255; in test_repacketizer_api()
1489 …if(opus_repacketizer_cat(rp,packet,2)!=OPUS_INVALID_PACKET)test_failed(); /* Code 2 overflow two */ in test_repacketizer_api()
1491 packet[0]=2; in test_repacketizer_api()
1492 packet[1]=250; in test_repacketizer_api()
1493 …if(opus_repacketizer_cat(rp,packet,251)!=OPUS_INVALID_PACKET)test_failed(); /* Code 2 overflow thr… in test_repacketizer_api()
1495 packet[0]=3; in test_repacketizer_api()
1496 packet[1]=0; in test_repacketizer_api()
1497 if(opus_repacketizer_cat(rp,packet,2)!=OPUS_INVALID_PACKET)test_failed(); /* Code 3 m=0 */ in test_repacketizer_api()
1499 packet[1]=49; in test_repacketizer_api()
1500 if(opus_repacketizer_cat(rp,packet,100)!=OPUS_INVALID_PACKET)test_failed(); /* Code 3 m=49 */ in test_repacketizer_api()
1502 packet[0]=0; in test_repacketizer_api()
1503 if(opus_repacketizer_cat(rp,packet,3)!=OPUS_OK)test_failed(); in test_repacketizer_api()
1505 packet[0]=1<<2; in test_repacketizer_api()
1506 if(opus_repacketizer_cat(rp,packet,3)!=OPUS_INVALID_PACKET)test_failed(); /* Change in TOC */ in test_repacketizer_api()
1515 packet[0]=((j<<1)+(j&1))<<2; in test_repacketizer_api()
1516 maxi=960/opus_packet_get_samples_per_frame(packet,8000); in test_repacketizer_api()
1521 packet[0]=((j<<1)+(j&1))<<2; in test_repacketizer_api()
1522 if(i>1)packet[0]+=i==2?1:3; in test_repacketizer_api()
1523 packet[1]=i>2?i:0; in test_repacketizer_api()
1524 maxp=960/(i*opus_packet_get_samples_per_frame(packet,8000)); in test_repacketizer_api()
1534 ret=opus_repacketizer_cat(rp,packet,k+(i>2?2:1)); in test_repacketizer_api()
1587 packet[0]=0; in test_repacketizer_api()
1588 if(opus_repacketizer_cat(rp,packet,5)!=OPUS_OK)test_failed(); in test_repacketizer_api()
1590 packet[0]+=1; in test_repacketizer_api()
1591 if(opus_repacketizer_cat(rp,packet,9)!=OPUS_OK)test_failed(); in test_repacketizer_api()
1605 packet[0]=1; in test_repacketizer_api()
1606 if(opus_repacketizer_cat(rp,packet,9)!=OPUS_OK)test_failed(); in test_repacketizer_api()
1608 packet[0]=0; in test_repacketizer_api()
1609 if(opus_repacketizer_cat(rp,packet,3)!=OPUS_OK)test_failed(); in test_repacketizer_api()
1617 packet[0]=2; in test_repacketizer_api()
1618 packet[1]=4; in test_repacketizer_api()
1619 if(opus_repacketizer_cat(rp,packet,8)!=OPUS_OK)test_failed(); in test_repacketizer_api()
1621 if(opus_repacketizer_cat(rp,packet,8)!=OPUS_OK)test_failed(); in test_repacketizer_api()
1629 packet[0]=2; in test_repacketizer_api()
1630 packet[1]=4; in test_repacketizer_api()
1631 if(opus_repacketizer_cat(rp,packet,10)!=OPUS_OK)test_failed(); in test_repacketizer_api()
1633 if(opus_repacketizer_cat(rp,packet,10)!=OPUS_OK)test_failed(); in test_repacketizer_api()
1644 packet[0]=((j<<1)+(j&1))<<2; in test_repacketizer_api()
1645 maxi=960/opus_packet_get_samples_per_frame(packet,8000); in test_repacketizer_api()
1652 ret=opus_repacketizer_cat(rp,packet,i); in test_repacketizer_api()
1736 free(packet); in test_repacketizer_api()