TINSEL: Work around PCM playback deadlock in Noir

This workaround disables PCM playback.

The PCMPlayers _chunk is NULL but _state is S_MID.
As a result getNextChunk always return 1, leading to readBuffer in
the playback thread never unlocking _mutex.
This commit is contained in:
Jakob Wagner 2022-04-16 11:36:53 +02:00 committed by Filippos Karapetis
parent 6fe03ab8de
commit 08b500b5e9

View File

@ -693,6 +693,10 @@ PCMMusicPlayer::PCMMusicPlayer() {
_vm->_mixer->playStream(Audio::Mixer::kMusicSoundType,
&_handle, this, -1, _volume, 0, DisposeAfterUse::NO, true);
if (TinselVersion == 3) {
warning("Todo: remove workaround when deadlock in readBuffer is fixed");
}
}
PCMMusicPlayer::~PCMMusicPlayer() {
@ -726,6 +730,10 @@ void PCMMusicPlayer::stopPlay() {
int PCMMusicPlayer::readBuffer(int16 *buffer, const int numSamples) {
Common::StackLock slock(_mutex);
// Workaround for v3 to prevent deadlock due to missing chunk
if ((TinselVersion == 3) && !_curChunk && _state == S_MID)
return 0;
if (!_curChunk && ((_state == S_IDLE) || (_state == S_STOP)))
return 0;