output: join the output thread after sending the KILL command
Be sure that the output thread has quite before we start destructing the output object.
This commit is contained in:
@@ -134,8 +134,12 @@ void audio_output_close(struct audio_output *audioOutput)
|
|||||||
void audio_output_finish(struct audio_output *audioOutput)
|
void audio_output_finish(struct audio_output *audioOutput)
|
||||||
{
|
{
|
||||||
audio_output_close(audioOutput);
|
audio_output_close(audioOutput);
|
||||||
if (audioOutput->thread != NULL)
|
|
||||||
|
if (audioOutput->thread != NULL) {
|
||||||
ao_command(audioOutput, AO_COMMAND_KILL);
|
ao_command(audioOutput, AO_COMMAND_KILL);
|
||||||
|
g_thread_join(audioOutput->thread);
|
||||||
|
}
|
||||||
|
|
||||||
if (audioOutput->plugin->finish)
|
if (audioOutput->plugin->finish)
|
||||||
audioOutput->plugin->finish(audioOutput->data);
|
audioOutput->plugin->finish(audioOutput->data);
|
||||||
if (audioOutput->convBuffer)
|
if (audioOutput->convBuffer)
|
||||||
|
@@ -175,6 +175,6 @@ void audio_output_thread_start(struct audio_output *ao)
|
|||||||
|
|
||||||
assert(ao->command == AO_COMMAND_NONE);
|
assert(ao->command == AO_COMMAND_NONE);
|
||||||
|
|
||||||
if (!(ao->thread = g_thread_create(audio_output_task, ao, FALSE, &e)))
|
if (!(ao->thread = g_thread_create(audio_output_task, ao, true, &e)))
|
||||||
g_error("Failed to spawn output task: %s\n", e->message);
|
g_error("Failed to spawn output task: %s\n", e->message);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user