Hello all. I'm new to this list. I'm also new to coding with libvorbis and things, so please bear with me. :) I've been having trouble with libvorbisfile. My use of it is fairly simple, but when I try to ov_clear the vorbis file, it segfaults. I can attach or otherwise make availible some demo source code, but for now I'll just pull out relevant lines: //BEGIN PSEUDO CODE OggVorbis_File vorbis; vorbis_info *info; if(ov_open(infile, &vorbis, NULL, 0) != 0) error(); if((info = ov_info(&vorbis, -1)) == NULL) error(); if((availible_chunks[tint]->len = ov_pcm_total(&vorbis, -1)) == OV_EINVAL) error(); while((tulong = ov_read(&vorbis, tuint8p, 4096, endian, 2, 1, &bitstream)) != 0) dothings_withdata(); //While not end. if(ov_clear(&vorbis) != 0) error(); //SEGFAULT! //END PSEUDO CODE Now, I realize that I haven't given much in the line of an example here, but I do have a full, compiling, smallest test-case availible to anybody who's interested. Also, and this is probably of the most interest, that code extracts valid PCM data, and my SDL mixing/playing code plays it fine. Any ideas? tia --Alex --- >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-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
On Sun, 2003-09-14 at 13:26, Alexander Markley wrote:> //BEGIN PSEUDO CODE > OggVorbis_File vorbis; > vorbis_info *info; > > if(ov_open(infile, &vorbis, NULL, 0) != 0) error(); > if((info = ov_info(&vorbis, -1)) == NULL) error(); > if((availible_chunks[tint]->len = ov_pcm_total(&vorbis, -1)) == > OV_EINVAL) error(); > while((tulong = ov_read(&vorbis, tuint8p, 4096, endian, 2, 1, > &bitstream)) != 0) dothings_withdata(); //While not end. > if(ov_clear(&vorbis) != 0) error(); //SEGFAULT! > //END PSEUDO CODE > > Now, I realize that I haven't given much in the line of an example here, > but I do have a full, compiling, smallest test-case availible to anybody > who's interested.Can you supply a backtrace showing where the code segfaulted? That usually helps to pinpoint errors. --- Stan Seibert <p>--- >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-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
On Monday 15 September 2003 04:26, Alexander Markley wrote:> //BEGIN PSEUDO CODE > OggVorbis_File vorbis; > vorbis_info *info; > > if(ov_open(infile, &vorbis, NULL, 0) != 0) error(); > if((info = ov_info(&vorbis, -1)) == NULL) error(); > if((availible_chunks[tint]->len = ov_pcm_total(&vorbis, -1)) => OV_EINVAL) error(); > while((tulong = ov_read(&vorbis, tuint8p, 4096, endian, 2, 1, > &bitstream)) != 0) dothings_withdata(); //While not end. > if(ov_clear(&vorbis) != 0) error(); //SEGFAULT! > //END PSEUDO CODEThis code doesn't look obviously wrong. You've probably got some other error (maybe you're accidently overwriting some buffer somewhere, or corrupting some data structures, or maybe your application is linked incorrectly. There are many possible problems - you haven't given us much detail). <p>Mike --- >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-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Sorry for breaking the thread sort algorithm there. :-P
I just discovered a new facet to this problem.
The ogg file included in the tarball, created with oggenc, is the ONLY
file that I can use to crash the demo code. I'm not sure why. The
details of the setup used to create the file are below.
(My previously mentioned friend, who tested the code on Darwin and
Linux, has discovered that the file included in the tarball crashes the
linux build, but nothing, including the odd file, crashes the Darwin build.)
Everybody involved is running libogg and libvorbis 1.0.
Here's my oggenc setup.
[alex@elbmin3 audio_crash_test]$ ldd /usr/bin/oggenc
libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0x40037000)
libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x4011f000)
libm.so.6 => /lib/libm.so.6 (0x4013f000)
libogg.so.0 => /usr/lib/libogg.so.0 (0x40161000)
libc.so.6 => /lib/libc.so.6 (0x40165000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
[alex@elbmin3 audio_crash_test]$ oggenc --version
OggEnc v1.0 (libvorbis 1.0)
[alex@elbmin3 audio_crash_test]$
I hope I'm not wasting everybody's time with a bug in my code.
Thanks in advance.
--Alex
--- >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-request@xiph.org'
containing only the word 'unsubscribe' in the body. No subject is
needed.
Unsubscribe messages sent to the list will be ignored/filtered.
If it doesn't crash on your system with newer code, that is good, but I'd like to test it myself. Is this newer libvorbisfile in CVS or something somewhere so I can try it myself? Also, did you take a peek at my code to see if I was doing anything retarded? Thanks a lot. --Alex <p>--- >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-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
> Of course.:) I figured as much, I'm just too lazy to check for myself. :-P > you're allocating half as much as you need to: ... times number of channels (you didn't do this). audio_test.c: 69: length = length * info->channels; //Isn't that what this does? ;) >This last bit is made more complex by the existence of chained streams Yes, I noticed that. >you never, ever, want to allocate a single buffer for an entire file I agree that for general purpose vorbis decoding, decoding the whole file into memory would be both stupid and dangerous. However, the application that I am currently writing requires me to do so.** (The vorbis files that are being decoded are tightly controlled, and should not pose a serious problem.) ** - If there was a way to quickly branch off the OggVorbis_File into multiple structures that could be decoded seperately potentially at the same time, then I could cut down on the RAM usage. Thanks for the comments, you're keepin' me on my toes. :) I will test the new libvorbis code to see if that really does fix the previous problem. --Alex Michael Smith wrote:> On Monday 15 September 2003 23:40, you wrote: > >>If it doesn't crash on your system with newer code, that is good, but >>I'd like to test it myself. >> >>Is this newer libvorbisfile in CVS or something somewhere so I can try >>it myself? > > > Of course. > > >>Also, did you take a peek at my code to see if I was doing anything >>retarded? >> > > > Not before, I just did then. The only bit that looks wrong is where you > allocate your decode buffer. This is stupid for two reasons: you never, ever, > want to allocate a single buffer for an entire file, and you're allocating > half as much as you need to: number of samples (ok), times number of bytes > per sample (ok), times number of channels (you didn't do this). This last bit > is made more complex by the existence of chained streams: the number of > channels (and other parameters not used here, like sample rate) can change in > the middle of a file. > > Mike >--- >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-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
>>>This _may_ be an old fixed bug in libvorbisfile on very short files,I don't get a crash with this testcase in linux with the (upcoming) 1.0.1 release. Bleeding edge CVS fixes all incarnations of this problem. --Alex --- >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-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.