Lines Matching refs:packet

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