Commit b2823701 authored by David Fuhrmann's avatar David Fuhrmann

auhal: limit scope of mutex

This should suffice as the variable is only modified on this thread.
Avoids deadlock in refs #9141
parent f0d02027
...@@ -314,6 +314,7 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt) ...@@ -314,6 +314,7 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &defaultDeviceAddress, 0, NULL, &propertySize, &defaultDeviceID); err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &defaultDeviceAddress, 0, NULL, &propertySize, &defaultDeviceID);
if (err != noErr) { if (err != noErr) {
msg_Err(p_aout, "could not get default audio device [%4.4s]", (char *)&err); msg_Err(p_aout, "could not get default audio device [%4.4s]", (char *)&err);
vlc_mutex_unlock(&p_sys->var_lock);
goto error; goto error;
} }
else else
...@@ -322,6 +323,7 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt) ...@@ -322,6 +323,7 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
p_sys->i_selected_dev = defaultDeviceID; p_sys->i_selected_dev = defaultDeviceID;
p_sys->b_selected_dev_is_digital = var_InheritBool(p_aout, "spdif"); p_sys->b_selected_dev_is_digital = var_InheritBool(p_aout, "spdif");
} }
vlc_mutex_unlock(&p_sys->var_lock);
// recheck if device still supports digital // recheck if device still supports digital
b_start_digital = p_sys->b_selected_dev_is_digital; b_start_digital = p_sys->b_selected_dev_is_digital;
...@@ -375,7 +377,6 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt) ...@@ -375,7 +377,6 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
b_success = true; b_success = true;
} }
} }
vlc_mutex_unlock(&p_sys->var_lock);
if (b_success) { if (b_success) {
p_aout->play = Play; p_aout->play = Play;
...@@ -387,7 +388,6 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt) ...@@ -387,7 +388,6 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
error: error:
/* If we reach this, this aout has failed */ /* If we reach this, this aout has failed */
vlc_mutex_unlock(&p_sys->var_lock);
msg_Err(p_aout, "opening auhal output failed"); msg_Err(p_aout, "opening auhal output failed");
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -1015,7 +1015,6 @@ static void Stop(audio_output_t *p_aout) ...@@ -1015,7 +1015,6 @@ static void Stop(audio_output_t *p_aout)
verify_noerr(AudioComponentInstanceDispose(p_sys->au_unit)); verify_noerr(AudioComponentInstanceDispose(p_sys->au_unit));
} }
vlc_mutex_lock(&p_sys->var_lock);
if (p_sys->b_digital) { if (p_sys->b_digital) {
/* Stop device */ /* Stop device */
err = AudioDeviceStop(p_sys->i_selected_dev, err = AudioDeviceStop(p_sys->i_selected_dev,
...@@ -1070,8 +1069,6 @@ static void Stop(audio_output_t *p_aout) ...@@ -1070,8 +1069,6 @@ static void Stop(audio_output_t *p_aout)
msg_Warn(p_aout, "failed to remove audio device life checker [%4.4s]", (char *)&err); msg_Warn(p_aout, "failed to remove audio device life checker [%4.4s]", (char *)&err);
} }
vlc_mutex_unlock(&p_sys->var_lock);
p_sys->i_bytes_per_sample = 0; p_sys->i_bytes_per_sample = 0;
p_sys->b_digital = false; p_sys->b_digital = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment