Bug 1131768 - Unlock before tearing down the stream in case of error, to avoid recursive locking. r=kinetik

This commit is contained in:
Paul Adenot 2015-02-11 00:12:09 +01:00
parent e6fa54fe9e
commit 318ed9a8bd

View File

@ -934,6 +934,7 @@ int setup_wasapi_stream(cubeb_stream * stm)
hr = get_default_endpoint(&device);
if (FAILED(hr)) {
LOG("Could not get default endpoint, error: %x", hr);
auto_unlock unlock(stm->stream_reset_lock);
wasapi_stream_destroy(stm);
return CUBEB_ERROR;
}
@ -946,6 +947,7 @@ int setup_wasapi_stream(cubeb_stream * stm)
SafeRelease(device);
if (FAILED(hr)) {
LOG("Could not activate the device to get an audio client: error: %x", hr);
auto_unlock unlock(stm->stream_reset_lock);
wasapi_stream_destroy(stm);
return CUBEB_ERROR;
}
@ -955,6 +957,7 @@ int setup_wasapi_stream(cubeb_stream * stm)
hr = stm->client->GetMixFormat(&mix_format);
if (FAILED(hr)) {
LOG("Could not fetch current mix format from the audio client: error: %x", hr);
auto_unlock unlock(stm->stream_reset_lock);
wasapi_stream_destroy(stm);
return CUBEB_ERROR;
}
@ -979,6 +982,7 @@ int setup_wasapi_stream(cubeb_stream * stm)
if (FAILED(hr)) {
LOG("Unable to initialize audio client: %x.", hr);
auto_unlock unlock(stm->stream_reset_lock);
wasapi_stream_destroy(stm);
return CUBEB_ERROR;
}
@ -986,6 +990,7 @@ int setup_wasapi_stream(cubeb_stream * stm)
hr = stm->client->GetBufferSize(&stm->buffer_frame_count);
if (FAILED(hr)) {
LOG("Could not get the buffer size from the client %x.", hr);
auto_unlock unlock(stm->stream_reset_lock);
wasapi_stream_destroy(stm);
return CUBEB_ERROR;
}
@ -997,6 +1002,7 @@ int setup_wasapi_stream(cubeb_stream * stm)
hr = stm->client->SetEventHandle(stm->refill_event);
if (FAILED(hr)) {
LOG("Could set the event handle for the client %x.", hr);
auto_unlock unlock(stm->stream_reset_lock);
wasapi_stream_destroy(stm);
return CUBEB_ERROR;
}
@ -1005,6 +1011,7 @@ int setup_wasapi_stream(cubeb_stream * stm)
(void **)&stm->render_client);
if (FAILED(hr)) {
LOG("Could not get the render client %x.", hr);
auto_unlock unlock(stm->stream_reset_lock);
wasapi_stream_destroy(stm);
return CUBEB_ERROR;
}
@ -1013,6 +1020,7 @@ int setup_wasapi_stream(cubeb_stream * stm)
(void **)&stm->audio_stream_volume);
if (FAILED(hr)) {
LOG("Could not get the IAudioStreamVolume %x.", hr);
auto_unlock unlock(stm->stream_reset_lock);
wasapi_stream_destroy(stm);
return CUBEB_ERROR;
}
@ -1028,6 +1036,7 @@ int setup_wasapi_stream(cubeb_stream * stm)
stm->user_ptr,
CUBEB_RESAMPLER_QUALITY_DESKTOP);
if (!stm->resampler) {
auto_unlock unlock(stm->stream_reset_lock);
LOG("Could not get a resampler");
wasapi_stream_destroy(stm);
return CUBEB_ERROR;