Opened 12 years ago
Closed 12 years ago
#1604 closed defect (fixed)
[PATCH] Sound system breaks on archived data
Reported by: | historic_bruno | Owned by: | stwf |
---|---|---|---|
Priority: | Release Blocker | Milestone: | Alpha 11 |
Component: | Core engine | Keywords: | |
Cc: | stwf | Patch: |
Description (last modified by )
Found this error while testing a 10.5 bundle but it also occurs on Windows, this will break releases. At a guess it's from using fopen()
which is naughty - it won't know how to read a .zip file, I think we should be using something like Vfs::LoadFile()
instead (this implies using a loading method that is compatible with archives). Also it would be nicer to pass an OsPath
rather than wchar_t*
to InitOggFile()
. See the old ogg.cpp for ideas.
gdb backtrace:
Thread 1 (process 97051): #0 0x97c3f4cf in flockfile () No symbol table info available. #1 0x97c3c3c3 in ferror () No symbol table info available. #2 0x001e8f9e in COggData::InitOggFile (this=0x299f400, fileLoc=0x299fa0c) at ../../../source/soundmanager/data/OggData.cpp:55 nameH = "/Users/ben/0ad/build/workspaces/0ad.app/Contents/Resources/data/mods/public/public.zip/Honor_Bound.ogg\000\001P\000\000\000tBL?P^??????????\002\t???p?\000\000\000\000\000P\000\000\000\000??\000\f??\002/\000\000\000f\000\000\000??D\000\000\000\000\000\000\000\000\000????l?D\000?p?\000a???\000\000\000\000????\000\000\000\000t\004\000\000"... f = (FILE *) 0x0 err = -132 #3 0x001e9937 in CSoundData::SoundDataFromOgg (itemPath=@0x1c9384c) at ../../../source/soundmanager/data/SoundData.cpp:103 answer = <value temporarily unavailable, due to optimizations> oggAnswer = (COggData *) 0x299f400 realPath = { path = { static npos = 4294967295, _M_dataplus = { <std::allocator<wchar_t>> = { <__gnu_cxx::new_allocator<wchar_t>> = {<No data fields>}, <No data fields>}, members of std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::_Alloc_hider: _M_p = 0x299fa0c } }, separator = 47 } ret = 6988444992 #4 0x001e9f2e in CSoundData::SoundDataFromFile (itemPath=@0x1c9384c) at ../../../source/soundmanager/data/SoundData.cpp:79 fExt = { path = { static npos = 4294967295, _M_dataplus = { <std::allocator<wchar_t>> = { <__gnu_cxx::new_allocator<wchar_t>> = {<No data fields>}, <No data fields>}, members of std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::_Alloc_hider: _M_p = 0x1c90b6c } }, separator = 47 } answer = (CSoundData *) 0x0 #5 0x001e7ec2 in CSoundManager::LoadItem (this=0x1a05630, itemPath=@0x1c9384c) at ../../../source/soundmanager/SoundManager.cpp:145 itemData = <value temporarily unavailable, due to optimizations> answer = (ISoundItem *) 0x1c93810 #6 0x001f08f8 in JMusicSound::Loop (this=0x1c93810) at ../../../source/soundmanager/js/MusicSound.cpp:44 aSnd = <value temporarily unavailable, due to optimizations> #7 0x001f1af2 in CNativeFunction<JMusicSound, false, bool, &(JMusicSound::Loop(JSContext*, unsigned int, unsigned long long*))>::JSFunction (cx=0x1c1da40, argc=0, vp=0x19bb2168) at ScriptableObject.h:188 rval = <value temporarily unavailable, due to optimizations> #8 0x0058eeda in js::Interpret () at basic_string.h:227
Attachments (2)
Change History (8)
comment:2 by , 12 years ago
Description: | modified (diff) |
---|
Philip says the VFS supported streaming at one time but it has since been removed, and rather than worrying about that, it's better to load the whole buffer into memory using something like Vfs::LoadFile()
.
comment:3 by , 12 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:4 by , 12 years ago
ok, This should fix the problem reading archives, also support for running with no sound and building without audio.
comment:5 by , 12 years ago
Summary: | Sound system breaks on archived data → [PATCH] Sound system breaks on archived data |
---|
by , 12 years ago
Attachment: | archiveStream_2.diff added |
---|
fix some windows build issues and warnings
Apparently this method of using file handles to load sound data was disabled in the old snd_mgr for just this reason:
We have two options: make archives work with file handles and streaming, or rewrite the new sound loading interface to use buffers. It seems more efficient if we can avoid loading the entire buffer into memory (I suppose that was the reasoning behind the current method). I'll investigate this, perhaps Philip or Jan have some insight into how difficult it would be.