зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1337805 - Avoid deadlock in AudioStream::DataCallback. r=padenot
MozReview-Commit-ID: IPCjepQ4dKt --HG-- extra : rebase_source : cf45c748521bacdb23f49c27bcda71110e62f324
This commit is contained in:
Родитель
c0634dbb84
Коммит
eeb706b254
|
@ -223,17 +223,27 @@ uint32_t PreferredSampleRate()
|
|||
|
||||
bool InitPreferredChannelLayout()
|
||||
{
|
||||
StaticMutexAutoLock lock(sMutex);
|
||||
if (sPreferredChannelLayout != 0) {
|
||||
return true;
|
||||
{
|
||||
StaticMutexAutoLock lock(sMutex);
|
||||
if (sPreferredChannelLayout != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
cubeb* context = GetCubebContextUnlocked();
|
||||
|
||||
cubeb* context = GetCubebContext();
|
||||
if (!context) {
|
||||
return false;
|
||||
}
|
||||
return cubeb_get_preferred_channel_layout(context,
|
||||
&sPreferredChannelLayout) == CUBEB_OK
|
||||
? true : false;
|
||||
|
||||
// Favor calling cubeb api with the mutex unlock, potential deadlock.
|
||||
cubeb_channel_layout layout;
|
||||
if (cubeb_get_preferred_channel_layout(context, &layout) != CUBEB_OK) {
|
||||
return false;
|
||||
}
|
||||
|
||||
StaticMutexAutoLock lock(sMutex);
|
||||
sPreferredChannelLayout = layout;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t PreferredChannelMap(uint32_t aChannels)
|
||||
|
|
Загрузка…
Ссылка в новой задаче