From 2933a71d5da7d9e7ffa13babdfccc7cda05698ea Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Tue, 20 Aug 2013 09:33:35 -0400 Subject: [PATCH] JACK: fix race condition with decode thread It was possible for the JACK callback to execute before the decode thread had been started, causing an assertion. --- src/arch/Sound/RageSoundDriver_JACK.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/arch/Sound/RageSoundDriver_JACK.cpp b/src/arch/Sound/RageSoundDriver_JACK.cpp index 839dcf1e82..770dcf528f 100644 --- a/src/arch/Sound/RageSoundDriver_JACK.cpp +++ b/src/arch/Sound/RageSoundDriver_JACK.cpp @@ -34,6 +34,9 @@ RString RageSoundDriver_JACK::Init() sample_rate = jack_get_sample_rate(client); LOG->Trace("JACK connected at %u Hz", sample_rate); + // Start this before callbacks + StartDecodeThread(); + // Set callback for processing audio if (jack_set_process_callback(client, ProcessTrampoline, this)) { @@ -83,7 +86,6 @@ RString RageSoundDriver_JACK::Init() goto out_deactivate; // Success! - StartDecodeThread(); LOG->Trace("JACK sound driver started successfully"); return RString();