summaryrefslogtreecommitdiffstats
path: root/libaudio/AudioHardware.h
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-01-18 13:50:39 -0800
committerEric Laurent <elaurent@google.com>2011-01-18 14:30:12 -0800
commit0c5bf19e1535772bf837800536a2dbb25790964e (patch)
tree85e6abaeb3195830cfd7ece16554e450b78a8dfe /libaudio/AudioHardware.h
parente93175d679a044f242962730ade8d133570c4ab1 (diff)
downloaddevice_samsung_crespo-0c5bf19e1535772bf837800536a2dbb25790964e.zip
device_samsung_crespo-0c5bf19e1535772bf837800536a2dbb25790964e.tar.gz
device_samsung_crespo-0c5bf19e1535772bf837800536a2dbb25790964e.tar.bz2
Fix issue 3305305.
The problem is that when the voice search tone is started, audio capture is still active and the output stream write function needs to place the input stream in standby to reconfigure the kernel driver. To do so it has to acquire the input stream mutex but as the input stream thread holds the lock most of the time while sleeping in the driver waiting for more data, this is very difficult and can take several seconds. The fix consists in forcing a sleep in the next read() when another function needs to acquire the input stream lock. The same change is done for output stream write() function. Also removed the workaround for issue 3201189 in setMode() (thread priority bump) as this change addresses the same problem. Change-Id: I3a5e672717752f83dfedce822a18748b165b0a5a
Diffstat (limited to 'libaudio/AudioHardware.h')
-rw-r--r--libaudio/AudioHardware.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/libaudio/AudioHardware.h b/libaudio/AudioHardware.h
index 1379495..a2c47bd 100644
--- a/libaudio/AudioHardware.h
+++ b/libaudio/AudioHardware.h
@@ -203,8 +203,9 @@ private:
status_t open_l();
int standbyCnt() { return mStandbyCnt; }
- void lock() { mLock.lock(); }
- void unlock() { mLock.unlock(); }
+ int prepareLock();
+ void lock();
+ void unlock();
private:
@@ -222,6 +223,7 @@ private:
// trace driver operations for dump
int mDriverOp;
int mStandbyCnt;
+ bool mSleepReq;
};
class DownSampler;
@@ -316,8 +318,9 @@ private:
virtual status_t getNextBuffer(BufferProvider::Buffer* buffer);
virtual void releaseBuffer(BufferProvider::Buffer* buffer);
- void lock() { mLock.lock(); }
- void unlock() { mLock.unlock(); }
+ int prepareLock();
+ void lock();
+ void unlock();
private:
Mutex mLock;
@@ -339,6 +342,7 @@ private:
// trace driver operations for dump
int mDriverOp;
int mStandbyCnt;
+ bool mSleepReq;
};
};