[vorbis-dev] Vorbisfile: Small Files broken in 1.0?

Marc Templin hi at thetemplins.net
Tue Nov 12 14:03:56 PST 2002



I am a game developer, and we used RC3 in our last game.  Worked great.
I'm trying to update to 1.0 now, and running into some problems.
Specifically, I think a change to _get_prev_page() in vorbisfile.c broke
the decoder for very small files.  I have a file called "silence" that's
just a silent wav file.  It compresses down to barely more than the
header, so it's _really_ small.  When I try to play it, it goes into an
infinite loop in vorbisfile.c, line 159.

In RC3, that code was:

  while(offset==-1){
    begin-=CHUNKSIZE;
    if(begin<0)
      begin=0;
    _seek_helper(vf,begin);
    while(vf->offset<begin+CHUNKSIZE){
      ret=_get_next_page(vf,og,begin+CHUNKSIZE-vf->offset);
      if(ret==OV_EREAD)return(OV_EREAD);
      if(ret<0){
        break;
      }else{
        offset=ret;
      }
    }
  }

In 1.0, it changed to:

  end = begin;
  while(offset==-1){
    begin-=CHUNKSIZE;
    if(begin<0)
      begin=0;
    _seek_helper(vf,begin);
    while(vf->offset<end){
      ret=_get_next_page(vf,og,end-vf->offset);
      if(ret==OV_EREAD)return(OV_EREAD);
      if(ret<0){
        break;
      }else{
        offset=ret;
      }
    }
  }

I don't know why that change was made, but it breaks the decoder for me.
I'm not exactly sure what is wrong with the new code (I mean, I can think
of a situation where they behave differently, but I'm too lazy to trace
through all the implications).  Replacing the 1.0 loop with the RC3 loop
made the problem go away for me.

Anybody have a good explanation of why that change was made, and why it
shouldn't be set back to the way it was before?

-Marc

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list