[vlc-commits] auhal: limit scope of mutex
David Fuhrmann
git at videolan.org
Wed Aug 21 19:44:54 CEST 2013
vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Wed Aug 21 19:42:41 2013 +0200| [b2823701b6123b5cb1f862dec7f5a62a9d77d17f] | committer: David Fuhrmann
auhal: limit scope of mutex
This should suffice as the variable is only modified on this thread.
Avoids deadlock in refs #9141
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b2823701b6123b5cb1f862dec7f5a62a9d77d17f
---
modules/audio_output/auhal.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index f32f4c3..1cdf602 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -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);
if (err != noErr) {
msg_Err(p_aout, "could not get default audio device [%4.4s]", (char *)&err);
+ vlc_mutex_unlock(&p_sys->var_lock);
goto error;
}
else
@@ -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->b_selected_dev_is_digital = var_InheritBool(p_aout, "spdif");
}
+ vlc_mutex_unlock(&p_sys->var_lock);
// recheck if device still supports 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)
b_success = true;
}
}
- vlc_mutex_unlock(&p_sys->var_lock);
if (b_success) {
p_aout->play = Play;
@@ -387,7 +388,6 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
error:
/* If we reach this, this aout has failed */
- vlc_mutex_unlock(&p_sys->var_lock);
msg_Err(p_aout, "opening auhal output failed");
return VLC_EGENERIC;
}
@@ -1015,7 +1015,6 @@ static void Stop(audio_output_t *p_aout)
verify_noerr(AudioComponentInstanceDispose(p_sys->au_unit));
}
- vlc_mutex_lock(&p_sys->var_lock);
if (p_sys->b_digital) {
/* Stop device */
err = AudioDeviceStop(p_sys->i_selected_dev,
@@ -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);
}
- vlc_mutex_unlock(&p_sys->var_lock);
-
p_sys->i_bytes_per_sample = 0;
p_sys->b_digital = false;
More information about the vlc-commits
mailing list