Game Development Community

OGG crash problem

by Kevin Ryan · in Torque Game Engine · 08/10/2004 (5:12 pm) · 11 replies

At the IGC last October it was mentioned that some OGG files will crash your game. Well I'm working on finishing up my current game and i've got some sfx that work fine as WAVs but crash my game as OGGs.

- Was this problem ever identified and fixed?

- Anyone have any sense of how hard a problem this is to fix? Would it be worth my time to track down and fix this? I really don't want to have to slog around down in the innards of the OGG code.

Interestingly the OGG files that I am having problems with run fine in Winamp, but not it Torque.

#1
08/10/2004 (6:22 pm)
Clark, not Joe here, just too lazy to switch profiles. Check to make sure that OG_HOLE is handled properly by the ogg player. If I remember correctly, that was one of the issues we ran into. Send me an email and I can send you the latest TT audio version (fixes should be in head by now, but sometimes these things take time). The other thing to check, is to see if there are any comments in the file. Not sure how to check that in winamp, but the ogg api has a method for getting the comments. I believe that Tim Clarke, who did our sound, found that he couldn't include his "sig" in the file as a comment (something along the lines of Tim Clarke, Score Music in a comment field). Sorry for lack of details...
#2
08/11/2004 (4:38 am)
We are using the latest vorbisfile library (with the use of ov_open_callbacks) instead of the modified version of torque and seems that the problem disappeared completely.

Also, one workaround you can try is to use an old version encoder.
#3
08/11/2004 (3:47 pm)
@Clark - Thanks for the offer Clark, I'll email you later tonight. I'm not sure if it is a problem with exporter creating a faulty OGG and winamp is better at recovering from the error. Torque is hanging in OggVorvisFile::_get_next_page(...) - loops forever adding to offset into file - i'd need to get familiar with ogg format to see what it is trying to do. I'm thinking of final download size otherwise I'd just go with WAVs. It seems the OGGs are more likely to have problems if the are smaller files instead of larger ones.

@Marcelo - Do you mean you are using different libs that the ones in the Torque head. Right now I'm using vorbis_static_mt.lib and ogg_static.lib that I just copied over from torque to my current project's directory.
#4
08/12/2004 (1:00 pm)
I now have all my OGG files working without a problem. I made a slight change to _get_next_page(...) in vorbisStream.cc

In the section where (more < 0) the code used to be:

vf->offset -= more;

Now is:

vf->offset -= more;
if (vf->offset >= vf->end)
   return(OV_EOF);

With some OGG files, the while loop in this function would loop forever without detecting that the offset was past the end of the file. I am not very familiar with this section of code, but my fix hasn't seemed to break anything else.
#5
08/12/2004 (3:21 pm)
Interesting, Kevin... This is also on my todo list. :)
#6
08/13/2004 (7:22 am)
I've got some code laying around that replaces the hacked up vorbisStream.cc with calls out to the vorbisfile lib.

I also integrated it in with this resource:

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=5557

which I think is a better way to do it in the long run.
#7
08/13/2004 (8:50 am)
Hmmm... Thanks, Kurtis! I'll also take a look at that when I get to this entry on my todo list.
#8
08/17/2004 (2:35 pm)
Ok, took a look at this.

Apparently the problem occured in Marble Blast on a few files. It's related to bad Ogg Vorbis files, which apparently were common with the early versions of the exporters.

We are planning on fixing this whole area of the engine, sometime in the mid future - new audio layer, sort of thing. I'd rather not inadvertantly introduce a subtle bug, so on Rick's advice, I think I'm going to leave things as they are. If more people have this problem, I'll reconsider.

Thanks for the input, guys!
#9
05/18/2005 (2:56 pm)
Kevin's fix works ... the latest version of vorbisfile.c doesn't include the conditonal, probably should... dunno

-Josh Ritter
-=Prairie Games=-
#10
10/31/2005 (1:19 pm)
Just to add my two cents; the "bad ogg files" that caused the crashes I saw were files less than the CHUNKSIZE of 8500 bytes.

Any ogg file less than 8500 bytes that was saved with an "average bit rate" setting caused a crash when torque was trying to read past the end of the file. Other ogg files less than 8500 bytes which were saved with an "adjustable VBR quality" setting would work just fine, however. (I'm speaking in terms used by Sony Sound Forge 7.0)

Kevin Ryan's Aug 12th post fixes this problem.
#11
06/11/2006 (11:05 am)
I posted a report about this over in the TGB forums and Kevin Ryan was kind enough to point me to this thread. Thanks again Kevin.

One oddity- these short OGG files that are hanging TGB- I could not play them with WinAmp, but I could play them fine with another Player, fubar2000. I figured that Winamp now has too much latency to play sound files that are < 1 second.

And the ogg files are from MojoAudio arcade pack so I don't think they are corrupted ;-)