summaryrefslogtreecommitdiffstats
path: root/include/media/AudioRecord.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix slow AudioTrack and AudioRecord destructionGlenn Kasten2013-09-201-4/+6
| | | | | | | | | | | | | | | | | | | | There were two causes for the slowness: When thread was paused, it used nanosleep and sleep. These usually run to completion (except for POSIX signal, which we avoid because it is low-level). Instead, replace the nanosleep and sleep by condition timed wait, as that can be made to return early by a condition signal. Another advantage of condition timed wait is that a condition wait was already being used at top of thread loop, so it is a simpler change. The AudioRecord destructor was missing a proxy interrupt that was correct in AudioTrack. This proxy interrupt is needed in case another thread is blocked in proxy obtainBuffer. Does not address the 1 second polling for NS_WHENEVER. Bug: 10822765 Change-Id: Id665994551e87e4d7da9c7b015f424fd7a0b5560
* Fix potential leak of audio input handle.Jeff Brown2013-08-091-8/+1
| | | | | | | | | | | | | The audio input handle is ultimately owned by the audio recorder object but it could be dropped on the floor if an error occurred before that object was fully initialized. Rearranged some of the argument validation and merged getInput_l with openRecord_l to simplify the code and prevent such a leak from occurring. Bug: 10265163 Change-Id: I124dce344b1d11c2dd66ca5e2c9aec0c52c230e2
* Merge "Cleanup comments for the new control block implementation"Glenn Kasten2013-08-071-2/+1
|\
| * Cleanup comments for the new control block implementationGlenn Kasten2013-08-021-2/+1
| | | | | | | | | | | | | | | | There was some obsolete and incomplete text left over after the new control block code was submitted. This cleans up all those comments to be accurate again. Change-Id: Ic52f5869cb723cde25d709514d6deea6aa6f20aa
* | Merge "AudioRecord notification frames"Glenn Kasten2013-08-061-1/+4
|\ \
| * | AudioRecord notification framesGlenn Kasten2013-08-021-1/+4
| | | | | | | | | | | | Change-Id: I76ec536d1504eb9a558178b62bf225aace4b40d1
* | | Merge "AudioRecord::openRecord_l now take flags"Glenn Kasten2013-08-061-0/+1
|\ \ \ | |/ /
| * | AudioRecord::openRecord_l now take flagsGlenn Kasten2013-08-021-0/+1
| | | | | | | | | | | | | | | | | | | | | The new parameter 'flags' of type audio_input_flags_t will be used for requesting a fast track, but is currently ignored. Change-Id: If68dfda8b2d4eaaca42927d721b4630c47f71f3b
* | | Merge "AudioRecord::set and constructor now take flags"Glenn Kasten2013-08-051-2/+6
|\ \ \ | |/ /
| * | AudioRecord::set and constructor now take flagsGlenn Kasten2013-08-021-2/+6
| | | | | | | | | | | | | | | | | | | | | The new optional parameter 'flags' of type audio_input_flags_t will be used for requesting a fast track. Change-Id: Ia7e070cb57c833e608352da354fb30dc26df6918
* | | Merge "Make AudioRecord and AudioTrack comments more similar"Glenn Kasten2013-08-051-2/+9
|\ \ \
| * | | Make AudioRecord and AudioTrack comments more similarGlenn Kasten2013-08-021-2/+9
| | |/ | |/| | | | | | | Change-Id: I122a7cf7bfc162090cb27f37c325db7a23985bc7
* | | Merge "AudioRecord callback thread waits for priority boost"Glenn Kasten2013-08-051-0/+1
|\ \ \ | | |/ | |/|
| * | AudioRecord callback thread waits for priority boostGlenn Kasten2013-08-021-0/+1
| |/ | | | | | | Change-Id: Iae38fa4ac20a45751566169213a08a15deb0a2f6
* | AudioRecord has no default sample rateGlenn Kasten2013-08-021-2/+0
|/ | | | Change-Id: I72feefdd6f3a623fd3669b80d4b264518fdc0929
* Remove default channel mask in AudioRecord constructor and set()Glenn Kasten2013-07-301-8/+8
| | | | Change-Id: I22ad4ba8777842bf6705e79c6ad796fdb9a4104c
* AudioRecord must be used as sp<> onlyGlenn Kasten2013-06-131-1/+3
| | | | | Bug: 9423855 Change-Id: I78ba8228c60dff11fb466156bb632c5dda45cdaf
* New control block for AudioTrack and AudioRecordGlenn Kasten2013-06-121-76/+175
| | | | | | | | Main differences between old and new control block: - removes the mutex, which was a potential source of priority inversion - circular indices into shared buffer, which is now always a power-of-2 size Change-Id: I4e9b7fa99858b488ac98a441fa70e31dbba1b865
* Start isolating control block accesses in a proxyGlenn Kasten2012-12-121-0/+3
| | | | | | | | | | | | | | | | | | | | | The proxy object will eventually be the only code that understands the details of the control block. This should make it easier to change the control block in the future. Initial set of control block fields that are isolated: - sample rate - send level - volume Prepare for streaming/static separation by adding a union to the control block for the new fields. Fix bug in handling of max sample rate on a track. It was only checking at re-configuration, not at each mix. Simplify OutputTrack::obtainBuffer. Change-Id: I2249f9d04f73a911a922ad1d7f6197292c74cd92
* Clean up channel count and channel maskGlenn Kasten2012-11-191-2/+1
| | | | | | | | Channel count is uint32_t. Remove redundant mask parameter to AudioTrack::createTrack_l() and AudioRecord::openRecord_l(). Change-Id: I5dc2b18eb609b2c0dc3091994cbaa4628062c17f
* Use size_t for frame countsGlenn Kasten2012-11-151-4/+4
| | | | | | Also fix typo: bufferCount should be frameCount. Change-Id: Ibed539504db75ef99dc21c8ff1bf2987122063a5
* Move frame size out of the control blockGlenn Kasten2012-11-121-1/+2
| | | | | | This is part of a series to clean up the control block. Change-Id: Ifab1c42ac0f8be704e571b292713cd2250d12a3f
* Move buffers pointer out of the control blockGlenn Kasten2012-11-081-0/+1
| | | | | | This is part of a series to clean up the control block. Change-Id: Ie474557db7cb360f2d9a0f11600a68f5a3d46f07
* Removed unused fields in AudioRecord::BufferGlenn Kasten2012-11-061-7/+0
| | | | Change-Id: I89fc6d8f695b48516d956b0a9a4a43d408f369f9
* AudioRecord commentsGlenn Kasten2012-11-021-30/+45
| | | | Change-Id: Ibec910608948d778dc655d900255a80384e9b06f
* AudioRecord lockingGlenn Kasten2012-07-171-2/+2
| | | | | | | | | | | | | | | | Fix race conditions for EVENT_MARKER and EVENT_NEW_POS callbacks. Marker and new position update fields are protected by lock. getSampleRate() doesn't need a lock because it reads from shared memory control block. Enforce that the parameter passed with EVENT_MARKER and EVENT_NEW_POS cannot not be changed by the callback handler, and will not change during the call by another thread. Session ID should never change; log if it does. Change-Id: Ia2c63cf1a71b10bb06c37981bd76437f83fffa91
* AudioRecord::stop() return voidGlenn Kasten2012-07-131-1/+1
| | | | | | like AudioTrack::stop() Change-Id: Iab62f4665151345f1ad5874c97a21d1a331f0154
* AudioRecord client threading cleanupGlenn Kasten2012-07-131-8/+19
| | | | | | | | | | | | | | | | | | | Rename ClientRecordThread to AudioRecordThread to be more similar to AudioTrack naming. Only create the thread once, and use resume() and pause() for start() and stop(). This will allow us to have a known client callback thread tid that we can pass to AudioFlinger before start(). mActive: Made mActive a bool not int. mActive is protected by mLock; volatile is meaningless. Fixed a few places where mActive was accessed without a lock: - stopped() - processAudioBuffer() These aren't used internally, so no need for _l() versions. Change-Id: I4b8a5c90f3a22d3894b344564cb1c5aef4f1fda2
* Remove dead code in libmediaGlenn Kasten2012-07-121-7/+0
| | | | Change-Id: I7d8201590cda29c9fa99662a4fdba222091febfe
* Use audio_channel_mask_t more consistentlyGlenn Kasten2012-07-031-1/+1
| | | | | | | | | | | | | | | In IAudioFlinger::createTrack() and IAudioFlinger::openRecord(), declare input parameter to use correct type audio_channel_mask_t. In IAudioFlinger::getInputBufferSize(), input parameter is now channel mask instead of channel count. Remove unused IAudioFlinger::channelCount(audio_io_handle_t). In AudioRecord::getMinFrameCount() and AudioSystem::getInputBufferSize(), input parameter is channel mask instead of channel count. Change-Id: Ib2f1c29bea70f016b3cfce83942ba292190ac965
* AudioRecord commentsGlenn Kasten2012-06-251-25/+31
| | | | | | Group the private fields according to how they are used Change-Id: I7ce3d0939510c10f34bd91a55f6e03afc8e7d43c
* Use audio_channel_mask_t in AudioRecordGlenn Kasten2012-06-251-4/+4
| | | | Change-Id: I9e1b918b2635d961604a4a9d88eb1c7179a167a7
* Remove unused AudioRecord::channels()Glenn Kasten2012-06-251-1/+0
| | | | | | It was declared but never implemented or called. Change-Id: If5846147fcbd7f6d4187971e2044dd6fd3252b42
* Include what you useGlenn Kasten2012-06-251-11/+4
| | | | Change-Id: I12ef9367d05dbe069c037b1b4acd6347a8cf3ece
* Remove AudioRecord record_flagsGlenn Kasten2012-06-221-13/+0
| | | | Change-Id: I021ddcc1bcb63132a4597d13e3d09db2a5f2c628
* Use C APIs instead of C++ APIs for policyGlenn Kasten2012-04-231-1/+2
| | | | | | | | | The C++ APIs are going away. Note: we use tid == 0 which is not supported yet by the C APIs, do not submit this until that is added. Change-Id: I0e90789e6c81c69f2544e899c52421ea5d1342be
* Made AudioRecord a subclasss of RefBaseEric Laurent2012-04-201-1/+1
| | | | | | | | | Made AudioRecord a subclass of RefBase to allow using strong references and solve concurrency issues. Issue 6254582. Change-Id: Ic1f3845958f477e8b2d23d3d25bf0f666addcb3b
* implemented synchronous audio captureEric Laurent2012-03-291-1/+5
| | | | | | | | | | | | | | Added the infrastructure to support the synchronization of playback and capture actions on specific events. The first requirement for this feature is to synchronize the audio capture start with the full rendering of a given audio content. The applications can further be extended to other use cases (synchronized playback start...) by adding new synchronization events and new synchronous control methods on player or recorders. Also added a method to query the audio session from a ToneGenerator. Change-Id: I51f1167290d9cafdf2fbcdf9e4785156973af44c
* IAudioFlinger::createTrack and openRecord flagsGlenn Kasten2012-03-191-1/+0
| | | | | | | | | | | | | | | | | | | | createTrack and openRecord don't need the "old" flags parameter, which was either audio_policy_output_t or audio_in_acoustics_t shifted left by 16 bits. But they do need "new" flags, which are defined by the application use case. Initially, the only application use case flag is timed output, but others are planned. For output, the audio_policy_output_t flags are passed to AudioSystem::getOutput, which returns an audio_io_handle_t, and that handle is then passed to createTrack. So createTrack doesn't need the old flags parameter. For input, the audio_in_acoustics_t flags are passed to AudioSystem::getInput, which returns an audio_io_handle_t, and that handle is then passed to openRecord. So openRecord doesn't need the old flags parameter. Change-Id: I18a9870911846cca69d420c19fe6a9face2fe8c4
* Use AudioRecord::record_flags consistentlyGlenn Kasten2012-03-081-3/+5
| | | | Change-Id: I6f369a2b99eb515603bc7d5629a07db2b96783fe
* Merge "Fix typos and line length in AudioRecord comments"Glenn Kasten2012-03-021-5/+6
|\
| * Fix typos and line length in AudioRecord commentsGlenn Kasten2012-02-241-5/+6
| | | | | | | | Change-Id: I85cfb9a2b9b3ade098161aa7687b4d4f7eb226ea
* | AudioRecord const methodsGlenn Kasten2012-02-281-8/+8
|/ | | | Change-Id: Ifae4fd7820b650aaca2b13c8658c292db1c46c0f
* AudioRecord and AudioTrack client tidGlenn Kasten2012-02-141-1/+3
| | | | | | Inform AudioFlinger of the tid of the callback thread. Change-Id: I670df92dd06749b057238b48ed1094b13aab720b
* Merge "Remove dead mutex in AudioTrack/AudioRecord thread"Glenn Kasten2012-02-081-1/+0
|\
| * Remove dead mutex in AudioTrack/AudioRecord threadGlenn Kasten2012-02-021-1/+0
| | | | | | | | | | | | | | | | | | | | The client callback threads had mutexes called AudioTrackThread::mLock and ClientRecordThread::mLock. These mutexes were only used by start() and stop(), and were unused by the thread itself. But start() and stop() already have their own protection provided by AudioTrack::mLock and AudioRecord::mLock. So the thread mutexes can be removed. Change-Id: I098406d381645d77fba06a15511e179a327848ef
* | Use NULL not 0 for raw pointersGlenn Kasten2012-02-031-4/+4
|/ | | | | | Use if (p != NULL) instead of if (ptr) Change-Id: Iaec3413a59ccbf233c98fcd918cc7d70ac5da9fa
* Use audio_source_t consistentlyGlenn Kasten2012-01-261-5/+4
| | | | | | | | | | | | | | | | Was a mix of audio_source_t, uint8_t, and int. Related fixes: - fix comments in MediaRecorder.java - AudioPolicyService server side was not checking source parameter at all, so if the client wrapper was bypassed, invalid values could be passed into audio HAL - JNI android_media_AudioRecord_setup was checking source for positive values, but not negative values. This test is redundant, since already checked at Java and now checked by AudioPolicyService also, but might as well make it correct. Change-Id: Ie5e25d646dcd59a86d7985aa46cfcb4a1ba64a4a
* Use audio_format_t consistently, continuedGlenn Kasten2012-01-201-7/+7
| | | | | | | | | | | | Was int or uint32_t. When AudioFlinger::format can't determine the correct format, return INVALID rather than DEFAULT. Init mFormat to INVALID rather than DEFAULT in the constructor. Subclass constructors will set mFormat to the correct value. Change-Id: I9b62640aa107d24d2d27925f5563d0d7407d1b73
* Fix incorrect includes of AudioTrack.hGlenn Kasten2012-01-181-1/+2
| | | | | | | Remove unnecessary includes of AudioTrack.h. Use forward declaration of class names in preference to #include when possible. Change-Id: I12982811fa75c2c7695d8bbfa595a7aaec047dc0