Mercurial > mplayer.hg
changeset 3820:8f7fab2e89bf
more stable and reliable spudec packet reassembler
author | arpi |
---|---|
date | Fri, 28 Dec 2001 01:03:57 +0000 |
parents | c93ade8dcf70 |
children | a75add28f16c |
files | spudec.c |
diffstat | 1 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/spudec.c Fri Dec 28 00:54:57 2001 +0000 +++ b/spudec.c Fri Dec 28 01:03:57 2001 +0000 @@ -292,10 +292,35 @@ spu->packet_offset += len; } } +#if 1 + // check if we have a complete packet (unfortunatelly packet_size is bad + // for some disks) +// if (spu->packet_offset == spu->packet_size) + { int x=0,y; + while(x>=0 && x+4<=spu->packet_offset){ + y=get_be16(spu->packet+x+2); // next control pointer + printf("SPUtest: x=%d y=%d off=%d size=%d\n",x,y,spu->packet_offset,spu->packet_size); + if(x>=4 && x==y){ // if it points to self - we're done! + // we got it! + printf("SPUgot: off=%d size=%d \n",spu->packet_offset,spu->packet_size); + spudec_decode(spu); + spu->packet_offset = 0; + break; + } + if(y<=x || y>=spu->packet_size){ // invalid? + printf("SPUtest: broken packet!!!!! y=%d < x=%d\n",y,x); + spu->packet_size = spu->packet_offset = 0; + break; + } + x=y; + } + } +#else if (spu->packet_offset == spu->packet_size) { spudec_decode(spu); spu->packet_offset = 0; } +#endif } void spudec_reset(void *this) // called after seek