From 886aa88eb68e691b05a1335564adcf4ac8a925a3 Mon Sep 17 00:00:00 2001 From: Sean McNeil Date: Thu, 2 Sep 2010 10:08:53 +0700 Subject: Hold lock when doing a route. Routing can end up closing and re-opening an audio path (alsa_default.cpp). If this happend while audio is being played or recorded, then the handle can become invalid and cause a crash in the ALSA library. Change-Id: I2ab62cec0b8a77abdfb890c2addf7e3f54aca750 --- ALSAStreamOps.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ALSAStreamOps.cpp b/ALSAStreamOps.cpp index 0d14971..e450dd0 100644 --- a/ALSAStreamOps.cpp +++ b/ALSAStreamOps.cpp @@ -161,6 +161,7 @@ status_t ALSAStreamOps::setParameters(const String8& keyValuePairs) LOGV("setParameters() %s", keyValuePairs.string()); if (param.getInt(key, device) == NO_ERROR) { + AutoMutex lock(mLock); mParent->mALSADevice->route(mHandle, (uint32_t)device, mParent->mode()); param.remove(key); } -- cgit v1.2.3