Disable assertion in idSampleDecoderLocal::Decode*(), fix #461

It happened a lot more since
  504b572a Update sounds at ~60Hz instead of ~10Hz, fixes #141
(because then MixLoop() is more likely to be called in the narrow
 timeframe this can happen during level load) but could happen before.
So far I only observed it when starting a new game in Classic Doom 3.
See comment in the change and #461 for more information.
This commit is contained in:
Daniel Gibson 2022-05-28 18:05:22 +02:00
parent cdbb526a3b
commit 860181867a
2 changed files with 17 additions and 2 deletions

View file

@ -74,6 +74,8 @@ Note: Numbers starting with a "#" like #330 refer to the bugreport with that num
the dead "monster_zsec_shotgun_12" into the void (#409) the dead "monster_zsec_shotgun_12" into the void (#409)
* Support loading some mods known to need `fs_game_base d3xp` via Mods menu * Support loading some mods known to need `fs_game_base d3xp` via Mods menu
(currently, *The Lost Mission* and *LibreCoop d3xp* are supported) (currently, *The Lost Mission* and *LibreCoop d3xp* are supported)
* Disable assertion in idSampleDecoderLocal::DecodeOGG() that triggered
when starting a new Classic Doom3 game (#461)
1.5.1 (2021-03-14) 1.5.1 (2021-03-14)
------------------------------------------------------------------------ ------------------------------------------------------------------------

View file

@ -492,7 +492,9 @@ int idSampleDecoderLocal::DecodePCM( idSoundSample *sample, int sampleOffset44k,
int sampleCount = sampleCount44k >> shift; int sampleCount = sampleCount44k >> shift;
if ( sample->nonCacheData == NULL ) { if ( sample->nonCacheData == NULL ) {
assert( false ); // this should never happen ( note: I've seen that happen with the main thread down in idGameLocal::MapClear clearing entities - TTimo ) //assert( false ); // this should never happen ( note: I've seen that happen with the main thread down in idGameLocal::MapClear clearing entities - TTimo )
// DG: see comment in DecodeOGG()
common->Warning( "Called idSampleDecoderLocal::DecodePCM() on idSoundSample '%s' without nonCacheData\n", sample->name.c_str() );
failed = true; failed = true;
return 0; return 0;
} }
@ -533,7 +535,18 @@ int idSampleDecoderLocal::DecodeOGG( idSoundSample *sample, int sampleOffset44k,
return 0; return 0;
} }
if ( sample->nonCacheData == NULL ) { if ( sample->nonCacheData == NULL ) {
assert( false ); // this should never happen //assert( false ); // this should never happen
/* DG: turned this assertion into a warning, because this can happen, at least with
* the Classic Doom3 mod (when starting a new game). There idSoundCache::EndLevelLoad()
* purges (with idSoundSample::PurgeSoundSample()) sound/music/cdoomtheme.ogg
* (the music running in the main menu), which free()s nonCacheData.
* But afterwards (still during loading) idSoundSystemLocal::currentSoundWorld
* is set back to menuSoundWorld, which still tries to play that sample,
* which brings us here. Shortly afterwards the sound world is set to
* the game soundworld (sw) and that sample is not referenced anymore
* (until opening the menu again, when that sample is apparently properly reloaded)
* see also https://github.com/dhewm/dhewm3/issues/461 */
common->Warning( "Called idSampleDecoderLocal::DecodeOGG() on idSoundSample '%s' without nonCacheData\n", sample->name.c_str() );
failed = true; failed = true;
return 0; return 0;
} }