Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deadlocks when exporting #7449

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions include/AudioSdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ class AudioSdl : public AudioDevice
size_t m_currentBufferFramePos;
size_t m_currentBufferFramesCount;

bool m_stopped;

SDL_AudioDeviceID m_outputDevice;

SDL_AudioSpec m_inputAudioHandle;
Expand Down
6 changes: 0 additions & 6 deletions src/core/AudioEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,15 +549,9 @@ void AudioEngine::clearInternal()

void AudioEngine::changeQuality(const struct qualitySettings & qs)
{
// don't delete the audio-device
stopProcessing();

m_qualitySettings = qs;

emit sampleRateChanged();
emit qualitySettingsChanged();

startProcessing();
}


Expand Down
3 changes: 0 additions & 3 deletions src/core/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@ void Song::processNextBuffer()
return;
}

// If we have no tracks to play, there is nothing to do
if (trackList.empty()) { return; }

// If the playback position is outside of the range [begin, end), move it to
// begin and inform interested parties.
// Returns true if the playback position was moved, else false.
Expand Down
22 changes: 2 additions & 20 deletions src/core/audio/AudioSdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@

void AudioSdl::startProcessing()
{
m_stopped = false;

SDL_PauseAudioDevice (m_outputDevice, 0);
SDL_PauseAudioDevice (m_inputDevice, 0);
}
Expand All @@ -150,19 +148,8 @@

void AudioSdl::stopProcessing()
{
if( SDL_GetAudioDeviceStatus(m_outputDevice) == SDL_AUDIO_PLAYING )
{
SDL_LockAudioDevice (m_inputDevice);
SDL_LockAudioDevice (m_outputDevice);

m_stopped = true;

SDL_PauseAudioDevice (m_inputDevice, 1);
SDL_PauseAudioDevice (m_outputDevice, 1);

SDL_UnlockAudioDevice (m_inputDevice);
SDL_UnlockAudioDevice (m_outputDevice);
}
SDL_PauseAudioDevice (m_inputDevice, 1);
SDL_PauseAudioDevice (m_outputDevice, 1);
}

void AudioSdl::sdlAudioCallback( void * _udata, Uint8 * _buf, int _len )
Expand All @@ -177,11 +164,6 @@

void AudioSdl::sdlAudioCallback( Uint8 * _buf, int _len )
{
if( m_stopped )
{
memset( _buf, 0, _len );
return;
}

// SDL2: process float samples
while( _len )
Expand All @@ -196,7 +178,7 @@
return;
}
m_currentBufferFramesCount = frames;

Check notice on line 181 in src/core/audio/AudioSdl.cpp

View check run for this annotation

codefactor.io / CodeFactor

src/core/audio/AudioSdl.cpp#L181

Redundant blank line at the end of a code block should be deleted. (whitespace/blank_line)
}
const uint min_frames_count = std::min(_len/sizeof(SampleFrame),
m_currentBufferFramesCount
Expand Down
Loading