summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioRecord.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use new channel count functions for audio masksAndy Hung2014-05-161-2/+3
| | | | | Change-Id: Ia658ab4b6320d19fdb50f123c930918724ff0ef3 Signed-off-by: Andy Hung <hunga@google.com>
* IAudioFlinger::openRecord returns IMemory(s)Glenn Kasten2014-05-091-8/+24
| | | | | | | | openRecord() now explicitly returns the control block and data buffer as separate IMemory references. If the IMemory for data buffer is 0, this means it immediately follows the control block. Change-Id: Ic098f88f0e037f8fbe30006689e18cacacf09d06
* Fix a couple of fast capture typo bugsGlenn Kasten2014-05-071-2/+2
| | | | | | | AudioRecord constructor was not passing flags through to set(). Server-side check was using wrong kind of channel mask. Change-Id: Ifaa880ec323771e9fd168262be05f3e539f53390
* Use symbol AUDIO_IO_HANDLE_NONE from <system/audio.h>Glenn Kasten2014-03-261-1/+1
| | | | Change-Id: Id6b1aa17558eb73e17f22b8eab6cd02e00a96dff
* Make openRecord_l more like createTrack_l for fast tracks: part 3Glenn Kasten2014-02-281-7/+12
| | | | | | | | | Create the callback thread earlier, before creating the IAudioRecord, so that the thread's tid is available as a parameter to openRecord(). Also move initialization of mCbf to same point as in AudioTrack.cpp. Change-Id: I61ea4c5e2724ccfc691aaf51bc02a7c10d5a7495
* Make openRecord_l more like createTrack_l for fast tracks: part 2Glenn Kasten2014-02-281-10/+11
| | | | | | | | Assume double-buffering because we don't know the true HAL sample rate, and for fast tracks we must accomodate kernel scheduling and app computation jitter. Change-Id: I983d6048a8b4814cfa5bf789397cdd9f1572256c
* Merge "Make openRecord_l more like createTrack_l for fast tracks: part 1"Glenn Kasten2014-02-281-9/+21
|\
| * Make openRecord_l more like createTrack_l for fast tracks: part 1Glenn Kasten2014-02-271-9/+21
| | | | | | | | | | | | | | | | | | | | Use the transfer mode to distinguish use cases, as the presence of a callback handler is not sufficient. For example, the track could be configured for synchronous transfer with write() or read(), and also have a callback handler for position updates. But that does not mean the track can operate in fast track mode. Change-Id: I2a7f1f0ca98e68efe180b524496985109d8ce291
* | Fix type of AudioTrack/AudioRecord parameter frameCountGlenn Kasten2014-02-281-11/+4
| | | | | | | | | | | | It's size_t consistently Change-Id: I29638ef59ac773218025f2403a3508a307b487e0
* | Fix type of AudioTrack/AudioRecord parameter notificationFramesGlenn Kasten2014-02-281-4/+4
|/ | | | | | It's uint32_t consistently Change-Id: If8298c7e9aeea2b951fe47b675adbdf48d104846
* Simplify error handling after track creationGlenn Kasten2014-02-251-1/+3
| | | | | | | IAudioFlinger::createTrack and IAudioFlinger::openRecord both guarantee that (status == OK) == (sp<> != 0). Change-Id: I91cb4f7e843019efb65cace7ba146f7da7aa5b59
* Move initialize of mInput to match AudioTrackGlenn Kasten2014-02-251-3/+3
| | | | Change-Id: I4dc977f22f51cd618dc83d800b4b8756929a4612
* Update comments to match AudioTrackGlenn Kasten2014-02-251-1/+3
| | | | Change-Id: I7dd14eabd78c9130a157da2063a1d65ec4f9c65a
* Move initialization of mRefreshRemaining to match AudioTrackGlenn Kasten2014-02-251-1/+2
| | | | | | | This also fixes a bug where, for a re-created IAudioRecord, mRefreshRemaining was not being reset correctly. Change-Id: I9f721a4edf92aab859cf3f247ab7f65562d14fb0
* Merge "mAudioRecord is always non-0 if set() is successful"Glenn Kasten2014-02-251-4/+4
|\
| * mAudioRecord is always non-0 if set() is successfulGlenn Kasten2014-02-241-4/+4
| | | | | | | | Change-Id: I0c2483210903c922f06f097ada373a37b9a90a02
* | Merge "Unify comments and whitespace between AudioTrack and AudioRecord"Glenn Kasten2014-02-251-1/+2
|\ \ | |/
| * Unify comments and whitespace between AudioTrack and AudioRecordGlenn Kasten2014-02-241-1/+2
| | | | | | | | Change-Id: I5320a6b2d7f7077cb12d7da4f2ca30a940100bf2
* | Merge "Update mReqFrameCount at same point in AudioTrack and AudioRecord"Glenn Kasten2014-02-251-5/+5
|\ \ | |/
| * Update mReqFrameCount at same point in AudioTrack and AudioRecordGlenn Kasten2014-02-241-5/+5
| | | | | | | | Change-Id: I12369dfbb9e75389f2cab015a706decdaf310a0d
* | Merge "Permit AudioRecord to support non-linear formats in future"Glenn Kasten2014-02-251-2/+5
|\ \ | |/
| * Permit AudioRecord to support non-linear formats in futureGlenn Kasten2014-02-241-2/+5
| | | | | | | | | | | | But still restricted to 16-bit PCM currently Change-Id: I5df0e5033da9144ca73e44addf14a63d31406034
* | Merge "Simplify and cleanup error handling in AudioRecord::getMinFrameCount"Glenn Kasten2014-02-251-17/+10
|\ \ | |/ |/|
| * Simplify and cleanup error handling in AudioRecord::getMinFrameCountGlenn Kasten2014-02-251-17/+10
| | | | | | | | Change-Id: I8721ecedfb429c4e233453d1e768ddf69ecabbe4
* | Add log at entry to set() in AudioTrack and AudioRecordGlenn Kasten2014-02-241-3/+5
|/ | | | Change-Id: Ife23b88474c1d62c0cf682c1a310d951f2c0f54a
* Multi-client recordingGlenn Kasten2014-02-181-1/+3
| | | | | | Supports multiple clients both at native sample rate and with resampling. Change-Id: Icea55b4fd30751761b7debaa3ce016c79e712d8d
* Track pid for each sessionMarco Nelissen2014-02-111-2/+2
| | | | | | so they can be properly freed. Change-Id: I6f389035bc29e74e7c367c1c6d0252b180f666b3
* Use printf format %#x for audio_format_t in logsGlenn Kasten2014-02-071-3/+3
| | | | Change-Id: I1c611d1037685d52ccc84efe0fccd6413ec938e9
* Add AudioRecord::mReqFrameCount similar to AudioTrackGlenn Kasten2014-02-051-7/+16
| | | | Change-Id: I62d6534a9581e84ae20c2422f7ad9aeda9b7c4df
* Fix unused parameter warnings in audioGlenn Kasten2014-02-031-1/+1
| | | | Change-Id: I665ba3358dd9502f0adec70d486e7bf8a2e1b0fe
* AudioTrack: fix obtainBuffer timeout calculationEric Laurent2014-01-271-1/+1
| | | | | | | | | | | AudioTrack::obtainBuffer() passes a pointer to a timeout variable that has gone out of scope when calling ClientProxy::obtainBuffer(). Same fix for AudioRecord. Bug: 11968591. Change-Id: I22af8f94fa2f8cc54ab5c25c89167c805e754317
* Refactor code related to I/O handles to reduce chance for leaksGlenn Kasten2014-01-241-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | The AudioRecord input handle code was refactored earlier to fix a potential handle leak, and to simplify the code: > Change-Id: I124dce344b1d11c2dd66ca5e2c9aec0c52c230e2 This changelist refactors AudioTrack similarly, and adds further cleanup of both AudioTrack and AudioRecord. We attempt to implement the rules for referencing counting I/O handles, but there is still the possibility of a handle leak if the client process dies after allocating the handle reference but before releasing it. That issue is being tracked separately. Details: - AudioSystem::getOutput() is now called within createTrack_l - restoreTrack_l was missing offload info now it has the info available, but is not yet being called for offloaded tracks - AudioTrack::getOutput() is now const - Remove getOutput_l() Change-Id: I44a0a623d24fc5847bcac0939c276400568adbca
* Merge "Replace control block frameCount_ by explicit in/out parameter"Glenn Kasten2014-01-241-4/+9
|\
| * Replace control block frameCount_ by explicit in/out parameterGlenn Kasten2013-12-201-4/+9
| | | | | | | | | | | | in IAudioFlinger::createTrack and IAudioFlinger::openRecord Change-Id: I09c644c80e92c8e744b1b99055988a2588b2a83d
* | Merge "Use uint32_t sequence numbers for IAudioRecord"Glenn Kasten2014-01-171-1/+1
|\ \
| * | Use uint32_t sequence numbers for IAudioRecordGlenn Kasten2014-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This makes it the same as for IAudioTrack. Previously we had a mix of int, int32_t and uint32_t, which could cause comparisons to fail. Change-Id: Ic72ef650ee81f65db11e42ed16d818fdf3e310f4
* | | Merge "Cleanup loop termination logic in AudioRecord::obtainBuffer()"Glenn Kasten2014-01-171-0/+3
|\ \ \
| * | | Cleanup loop termination logic in AudioRecord::obtainBuffer()Glenn Kasten2014-01-161-0/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apply the same change to AudioRecord, that was already done for AudioTrack in this CL: > Change-Id: I0fc48117946364cb255afd653195498891f622bd If the proxy->obtainBuffer at the end of the "do" loop fails with status DEAD_OBJECT, and the restoreRecord_l during the next trip of the "do" loop also fails, then the value of the buffer fields will be based on the previous proxy->obtainBuffer that returned DEAD_OBJECT. This will have cleared the buffer, but it's tricky. So instead explicitly clear the buffer after restoreRecord_l, before breaking out of the loop. Change-Id: Ifc97f2ab7b8195d6b149502bb5d765d2983b07be
* | | Merge "AudioRecord: fix unwanted overrun when restarting"Glenn Kasten2014-01-171-0/+3
|\ \ \
| * | | AudioRecord: fix unwanted overrun when restartingGlenn Kasten2014-01-161-0/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apply the same fix to AudioRecord as this CL did for AudioTrack: > Change-Id: Id703f8dc092a6f07c905eee194054b4a978f979d Details: When restarting an AudioRecord from stopped state, it is necessary to force refresh of mRemainingFrames by processAudioBuffer() as the last read before stop() could be partial. No doing so will lead into unnecessary sleep before filling the non contiguous part of the buffer returned by obtainBuffer() when processAudioBuffer() is executed for the first time after start(). Change-Id: I0ff04648e990e97bad5ea3db5be0c4151250d5e1
* | | Merge "AudioRecord::getInputFramesLost() cleanup"Glenn Kasten2014-01-171-1/+1
|\ \ \
| * | | AudioRecord::getInputFramesLost() cleanupGlenn Kasten2014-01-141-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed bug that if the binder call failed (for example if the IAudioFlinger binder is dead), then getInputFramesLost was returning garbage. Now it correctly returns zero, which is the error value for this method. The type declarations for getInputFramesLost were inconsistent: a mixture of unsigned int, size_t, and uint32_t. Now it returns uint32_t everywhere, which is what the underlying HAL API returns. Added a FIXME about the side effect behavior. This will need review for multi-client. Change-Id: Ifa2e117a87dbd0c1f2c892a31d1c3dd919bf1a0a
* | | Merge "Unify comments between AudioTrack and AudioRecord"Glenn Kasten2014-01-171-3/+5
|\ \ \ | |/ / |/| |
| * | Unify comments between AudioTrack and AudioRecordGlenn Kasten2014-01-141-3/+5
| | | | | | | | | | | | Change-Id: I00a1025e2891a1c96218b3c2187eaddda6614ebc
* | | Merge "Use AUDIO_SESSION_ALLOCATE instead of 0"Glenn Kasten2014-01-151-4/+4
|\ \ \ | |/ / |/| |
| * | Use AUDIO_SESSION_ALLOCATE instead of 0Glenn Kasten2013-12-201-4/+4
| |/ | | | | | | | | | | | | Also fix a couple of places where we were using AUDIO_SESSION_OUTPUT_MIX, which happens to also be equal to 0, but has a different meaning. Change-Id: I90e39be3b89f5021a96d9e3b8d10929013ca977f
* | Fix race condition in AudioRecord::pause followed by startGlenn Kasten2014-01-131-7/+8
| | | | | | | | | | Bug: 11148722 Change-Id: Ia1e14133d73ac301fe06a047e70a573911822630
* | Fix some (but not all) unused parameter warningsGlenn Kasten2013-12-191-3/+3
|/ | | | Change-Id: Ia99e23a0b46db3f3e6aa46f9018e63c14f4af369
* Cleanup openRecord error handlingGlenn Kasten2013-09-241-2/+7
| | | | | Bug: 10888816 Change-Id: I84897dd7d30b370640b54e928f230604b873cb68
* AudioTrack: fix music resumeEric Laurent2013-09-231-2/+3
| | | | | | | | Fix regression introduced by commit 5a6cd22 in AudioTrack resume: the callback thread was not signaled if paused internaly. Bug: 10895013. Change-Id: Ic356b115132d6fccbcee2d9bb855e92671dc20c5