summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioRecord.cpp
Commit message (Collapse)AuthorAgeFilesLines
* libmedia: Initialize mState/mActive value to avoid possible crashZhou Song2016-04-131-3/+3
| | | | | | | | | | | If track creation fails on server side, mState/mActive is left unitialized. After this a crash can happen when track stop() is called because of a reference to a NULL object. Initialize mState/mActive to specific value in initialized list of track constructor. Change-Id: If8c3611e3229c0c1b14b81285e07b9357fec7658 CRs-Fixed: 992608
* Update Instrumentation codeWilliam Clark2016-04-131-2/+1
| | | | | | Add support for enhancements in QSSP instrumentation code. Change-Id: I00aa0b2bee5044d91eeeddaa43d3d28518a5ba93
* libmedia: correct latency computing for TRANSFER_SYNCMingming Yin2015-12-311-1/+2
| | | | | | | - Compute the track latency by frame count returned from audio hal when in TRANSFER_SYNC mode Change-Id: If7bbf780abc8e141eb35eea44c01c583b1290d3c
* libmedia: correct latency computing of AudioRecordMingming Yin2015-12-191-1/+5
| | | | | | | | | | - Originally, audio record latency is calculated by frame buffers allocated for this track, while the actual latency is determined by audio hal. - Compute the track latency by frame count returned from audio hal when in TRANSFER_CALLBACK mode Change-Id: I26e5e47e8cc3720895b962f7aab8a595a54b7c83
* SEEMP: add more framework instrumentationWilliam Clark2015-10-061-0/+3
| | | | | | Instrument framework files to log events of interest. Change-Id: I5157649ccd88a20459c1a72562960f6d5b43e7c0
* Fix race condition in AudioRecordThread::wakeAndy Hung2015-07-221-4/+8
| | | | | Bug: 22533684 Change-Id: Iba73d633b088dbc84159ed692019da39cc8e2233
* Merge "Implement audio device callback" into mnc-devEric Laurent2015-05-061-1/+70
|\
| * Implement audio device callbackEric Laurent2015-05-061-1/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add class AudioSystem::AudioDeviceCallback notifying AudioSystem clients upon device selection change on a given input or output thread. Maintain a list of installed callback per I/O handle in AudioSystem and call registered callbacks when an OPEN of CONFIG_CHANGED event is received on IAudioFlingerClient::ioConfigChanged(). Add methods to AudioTrack and AudioRecord to add and remove device change callbacks. Add methods to AudioTrack and AudioRecord to query currently selected device. ioConfigChanged() events now convey the audio patch describing the input or output thread routing. Fix AudioRecord failure to start when invalidation is handled by start(). Change-Id: I9e938adf025fa712337c63b1e02a8c18f2a20d39
* | AudioRecord keeps track of UIDJean-Michel Trivi2015-05-051-3/+22
|/ | | | | | Bug 20832981 Change-Id: If5f3c61fae02d86b9d6fdf411711f854fd56c77d
* Merge "audio policy: session routes continued." into mnc-devEric Laurent2015-04-301-0/+1
|\
| * audio policy: session routes continued.Eric Laurent2015-04-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | - Clear session routes when client process dies. - Enforce the route only when the requesting session is active. - Fix requested route not working if an output mix change is required (e.g forcing to SPEAKER when the default route is USB or A2DP). - Make sure all sessions sharing the strategy with a rerouted session have the same route (needed for volume control consistency) Change-Id: I0ab347a8fb97e73e2c5965374544c5f4fe509ef1
* | Respect the record audio app op - mediaSvet Ganov2015-04-291-9/+14
|/ | | | Change-Id: I3a97977b6e9a09355e2008f780d22d480fb7308b
* Explicit routing in AudioRecordPaul McLean2015-04-281-3/+21
| | | | Change-Id: I9cc5d54883a3e5c75d553fabb619fc8e49f4f9e5
* Merge "AudioRecord::obtainBuffer() can return nonContig like AudioTrack"Glenn Kasten2015-04-141-2/+8
|\
| * AudioRecord::obtainBuffer() can return nonContig like AudioTrackGlenn Kasten2015-04-131-2/+8
| | | | | | | | | | | | And fix error handling in both AudioRecord and AudioTrack. Change-Id: I4853d736cc6d2c05de5b18b0eac62716edfa62ec
* | Enable 8 bit and float pcm record formats for AudioFlingerAndy Hung2015-04-081-7/+3
|/ | | | | | | Update sampling rate handling as well. Bug: 19570772 Change-Id: I872248e64c0578b2e48869a68fee0d51bd0640c3
* Merge "AudioRecord TRANSFER_OBTAIN can be used with FAST flag"Glenn Kasten2015-03-241-3/+6
|\
| * AudioRecord TRANSFER_OBTAIN can be used with FAST flagGlenn Kasten2015-03-231-3/+6
| | | | | | | | Change-Id: I001ba1a88150dddf79d99baf5927f31799745eef
* | Merge "AudioRecord::read() can be non-blocking to match AudioTrack"Glenn Kasten2015-03-241-2/+3
|\ \
| * | AudioRecord::read() can be non-blocking to match AudioTrackGlenn Kasten2015-03-231-2/+3
| |/ | | | | | | Change-Id: I23b9466b81ab6037d0bccd5e6f5974b7bd4aeacb
* | set() in AudioRecord and AudioTracks needs no lockGlenn Kasten2015-03-231-2/+1
|/ | | | Change-Id: I9d61b3d117e9b21fbbfad772d8981a5abb8fafae
* LoggingGlenn Kasten2015-03-231-3/+5
| | | | | | | | | | Move log of latency to where it is first computed. Log more parameters when a fast track is denied by client. Log session ID in destructor. Remove obsolete ALOGV that were for debugging a particular problem. Log more parameters of set(). Change-Id: I0156bceaf397f2faa053214572c57136705685ee
* AudioRecord::releaseBuffer() buffer is const *, like AudioTrackGlenn Kasten2015-03-231-1/+1
| | | | Change-Id: If09689a8411392281ad06fcf781f3198941c642d
* Deprecate AudioRecord::getInput() and AudioTrack::getOutput()Glenn Kasten2015-03-231-2/+2
| | | | | | | Does not completely fix the bug, but is a step in the right direction. Bug: 12593118 Change-Id: Id591cd700ab58fd927ae44c71c81dac55b5cac2d
* namespace does not need a closing semicolonGlenn Kasten2015-03-231-1/+1
| | | | Change-Id: Ie8f9d42fc061f6d558f23b98414e04eb3d14b376
* Declare and initialize in one statementGlenn Kasten2015-03-231-4/+3
| | | | Change-Id: Ie8593692907e67558f9d7654c9a4bf8cbce99bd8
* Update AudioRecord comments to match AudioTrackGlenn Kasten2015-03-231-1/+1
| | | | Change-Id: I6c3620c60c0ba159e4688b42de4ec8b91920e048
* Event driven wake for AudioRecordThread notification changesAndy Hung2015-03-181-2/+21
| | | | | | Used for setMarkerPosition and setPositionUpdatePeriod. Change-Id: Iedd1be8725dea32bdba6908b78c5166780a66fec
* Fix periodic notification timing error for AudioRecordAndy Hung2015-03-131-2/+5
| | | | Change-Id: I768d8a30c6845372ad7c306ed1bc0ec030ae1804
* am fb5d35c0: am 7ae3dfab: Merge "fix record from default input source" into ↵Eric Laurent2015-01-071-4/+0
|\ | | | | | | | | | | | | lmp-mr1-dev * commit 'fb5d35c00d1c4d672d245b6820551808617eba46': fix record from default input source
| * fix record from default input sourceEric Laurent2015-01-061-4/+0
| | | | | | | | | | | | | | | | | | Commit caf7f48a0e broke capture from default input source on some devices: the input source is now specified as part of the audio attributes and the default source was not remapped to mic source. Bug: 18736417. Change-Id: I3f5da33cdb56f959aaef68ed1952342babc63aa0
* | am 390ef843: am f20c4356: Merge "AudioRecord: use audio attributes instead ↵Eric Laurent2014-11-271-8/+21
|\ \ | |/ | | | | | | | | | | of audio source." into lmp-mr1-dev * commit '390ef84373b7edd1397381f780ca235326357094': AudioRecord: use audio attributes instead of audio source.
| * AudioRecord: use audio attributes instead of audio source.Eric Laurent2014-11-251-8/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added AudioRecord constructor with audio attributes. Replaced AudioPolicymanager::getInput() by getInputForAttr(). No new functionality for now. Also: - Fixed warnings in AudioPolicyManager - Allocate audio session ID before calling getOutputForAttr() in AudioTrack. Bug: 16006090. Change-Id: I15df21e4411db688e3096dd801cf579d76d81711
* | am bf14c62e: am 72bf901c: Merge "audio policy: new getOutputForAttr() ↵Eric Laurent2014-11-261-1/+1
|\ \ | |/ | | | | | | | | | | prototype." into lmp-mr1-dev * commit 'bf14c62e7973ed793a3b00c2c67beca4484c1c7a': audio policy: new getOutputForAttr() prototype.
| * audio policy: new getOutputForAttr() prototype.Eric Laurent2014-11-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update getOutputForAttr() prototype and group all logic dealing with audio attributes to stream type conversion in audio policy manager. getOutputForAttr(): - specifies the audio session (for future use) - returns a status code - receives either stream type (for legacy) or audio attributes - returns an updated streamtype Remove logic dealing with legacy stream types to attributes conversion from AudioTrack. Use correct type for audio sessions in other APIs (startOutput() ...). releaseOutput() specifies the audio session (for future use). Bug: 18067208. Change-Id: I1bfbe9626c04c7955d77f8a70aecfad2cb204817
* | Update calls to IInterface::asBinder()Marco Nelissen2014-11-171-3/+3
|/ | | | | | | | | | | to use the new static version. Change-Id: Ia7b10eb38ca55b72278bfd33d3bf647f338b4e6a Conflicts: media/libmedia/IAudioFlinger.cpp media/libmedia/IMediaPlayer.cpp media/libstagefright/CameraSource.cpp
* audio policy: pass session ID to capture activity methodsEric Laurent2014-07-281-1/+1
| | | | | | | | Indicate the audio session ID when calling getInput(), startInput(), stopInput(), releaseInput(). Bug: 12378680. Change-Id: I763793752f93e2f4e1445a5ab217c895af011038
* rename AudioSystem::newAudioSessionId()Eric Laurent2014-07-281-1/+1
| | | | | | | | | Rename AudioSystem::newAudioSessionId() to AudioSystem::newAudioUniqueId() as it can be used also for I/O handles. Bug: 12378680. Change-Id: I611ea3b5eb57a4b0774437f477ee87dc4ccc2cc2
* Move AudioRecord frame count calculations to serverGlenn Kasten2014-07-171-44/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Buffer frame count and notification frame count are now calculated by server instead of by client. The server has more information and can do a better job. Also fix a few bugs: - If a fast track was re-created, even with same pipe depth, it would fail. Now it can correctly re-create a fast track provided the pipe depth is same. - Notification frame count for fast tracks was calculated by client as 1/2 of the total frame count, which is a large value due to the pipe. Now the notification frame count is set by server to the HAL frame count. This should reduce latency for fast tracks. - EVENT_OVERRUN were happening frequently when there was sample rate conversion, because the client didn't know about the sample rate conversion, and under-estimated the necessary buffer size. Now since server calculates the buffer sizes, EVENT_OVERRUN is unlikely. - RecordThread::createRecordTrack_l was checking for mono and stereo for fast tracks. This is not necessary, and now we can handle a multi-channel fast track. Bug: 7498763 Change-Id: I0c581618e8db33084d5ff9ed50a592990c9749e8
* Add audio_input_flags_t to IAudioPolicyService::getInputGlenn Kasten2014-07-171-3/+3
| | | | Change-Id: I9f37be05f8dc7b85a8827a94e76ca0f45453e170
* IAudioFlinger::openRecord now suggests notificationFramesGlenn Kasten2014-07-031-0/+5
| | | | Change-Id: I08885cc381d03c522a23289e74f0e1ed46563863
* libmedia: 64-bit compile warningsMark Salyzyn2014-06-201-10/+12
| | | | Change-Id: I600f062fa7148c01851023c1240c39939e648002
* force command flush after releasing a reference to shared memoryEric Laurent2014-06-131-1/+4
| | | | | | | | | | | | | After releasing a reference to a shared memory interface, IPCThreadState::self()->flushCommands() must be called to ensure that the corresponding reference is also cleared immediately in the remote process. Otherwise the binder implementaiton will not push the clear systematically causing the memory region not to be freed. See issues 10711502 and 2801375. Bug: 14057166. Change-Id: If55f36f00d452d6cf00cf83bd2fba1c8f3abcb57
* Squashed commit of the following:Glenn Kasten2014-06-051-18/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 9128d6ffec43731d723f9b394f243d940f4c7e41 Author: Glenn Kasten <gkasten@google.com> Date: Tue May 13 10:38:42 2014 -0700 Use of fast capture by normal capture Will only configure fast capture path if the input buffer size is less than 10 ms and the input sample rate is same as the primary output sample rate. Change-Id: I4a7cdc6069d750845412c626d27e83f72a1ab397 commit 2e5e0806a5abe7499848358ef5fde5c26405000d Author: Glenn Kasten <gkasten@google.com> Date: Mon Jun 2 08:29:22 2014 -0700 Add mPrimaryOutputSampleRate Change-Id: I46b527fc3f2b5a5720a74b4f0b9a8f2e0d570b09 commit baf1d73467923996d1b1f2a9237260cc5697e050 Author: Andy Hung <hunga@google.com> Date: Fri May 30 10:42:03 2014 -0700 Change parameter type for volume to float in AudioMixer Change-Id: I4da1505ce852505f86f8e5b87f60e8edceeb30e0 commit 40fe20fa9760cd03c69778c2021cf7a490d75ece Author: Andy Hung <hunga@google.com> Date: Fri May 30 10:35:47 2014 -0700 Rename UNITY_GAIN to UNITY_GAIN_INT in AudioMixer Change-Id: Ic040311305026f0b4c4280a5b3bef7a447ac1da3 commit 37c9a2b49f876abc5ff537a9ec036d7f0a423775 Author: Andy Hung <hunga@google.com> Date: Thu May 29 21:33:13 2014 -0700 Refactor setVolumeRampVariables in AudioMixer Change-Id: I8fcf3101bcea292de7c65433fa578f1c9cdd0974 commit 397070eca31f121d5d3993de1bfea99aaea5d4f3 Author: Andy Hung <hunga@google.com> Date: Thu May 29 18:52:38 2014 -0700 Fix floating point output from mixer A buffer pointer was being erroneously reset to buffer start, potentially causing an audio glitch. The floating point output mode is not enabled at this time, but will be in the future. Change-Id: If8b6414d232f064f3a2e2c5a6da889a91b27fb24 commit 2e61aa5b33b2247bbc5d4eaa0b519df9accd4bbc Author: Andy Hung <hunga@google.com> Date: Fri May 23 21:22:17 2014 -0700 Add multiple format capability to FastMixer Floating point data from MixerThread into FastMixer. Multiple output format capability from FastMixer to Sink. Change-Id: I0da17810ee71381a39a006c46faec71108d22c26 commit b9ea653c702a785bbd23a66c5e588d40b4192c4e Author: Andy Hung <hunga@google.com> Date: Thu May 29 15:53:09 2014 -0700 Avoid resetting BufferProviders in mixer unnecessarily Change-Id: Iad85c4dfd21be1dbf89dc11906106b34219376f8 commit 7f1a6d6da21c616f80cf9ba21bea11b419ec561b Author: Andy Hung <hunga@google.com> Date: Tue May 27 12:32:17 2014 -0700 Update dynamic resampler buffer fetching Make the criteria tight for fetching to avoid storing excessive frame data internal to the resampler. This should reduce jitter in frame delivery computation. Bug: 14962343 Change-Id: I7adaf714d11c272696ccdbf218bda994c7217477 commit b5e4aac07b9a02f0c803c090058602b03ac09ebb Author: Glenn Kasten <gkasten@google.com> Date: Tue May 27 12:30:54 2014 -0700 Allow kFastTrackMultiplier to be specified per device Change-Id: I4eaaaf038df720cec4f5d9221d1b632970f9e3dd commit b93cd97a52af31122df2da2cc0415cda888c8c73 Author: Andy Hung <hunga@google.com> Date: Fri May 23 21:13:31 2014 -0700 Rename mixBuffer to mMixerBuffer in FastMixer Likewise mixBufferState becomes mMixerBufferState. This harmonizes with the naming in AF::MixerThread. Change-Id: I1255d7c07cc2c6ee925d7430925236d2bd163122 commit 8340758622b9711365a8801806cbdf934803c63f Author: Andy Hung <hunga@google.com> Date: Mon May 12 16:51:41 2014 -0700 Add multiple format capability to AudioMixer Change-Id: I04ac1cafd90b6ed652f8d51888ad07576678f0bc Signed-off-by: Andy Hung <hunga@google.com> commit 6b695b9d094820c232a897a3fabbe83d2b7193fe Author: Glenn Kasten <gkasten@google.com> Date: Thu Mar 13 14:59:31 2014 -0700 Start adding FastCapture based on FastThread WIP This version supports at most one fast capture client. Change-Id: Idf609bfc80ae22433433d66a5232c043c65506df commit e951ad05a2c388471d7e2806d91e7d51325a150a Author: Glenn Kasten <gkasten@google.com> Date: Mon May 12 11:06:26 2014 -0700 Move validation of frameCount from set to openRecord_l This move is needed because frameCount is validated on server side for fast tracks (as should be done for normal tracks too). Change-Id: I6d99e80869fd90fab373cf60ef348c01f075fbca commit 73e76992dbba794894837c38e5472312ea829cf3 Author: Glenn Kasten <gkasten@google.com> Date: Tue May 13 10:41:52 2014 -0700 Allow track buffer "allocation" to be from pipe Change-Id: Ib9ac170f8e8b7746b3588157a56cbee3b753a1cb commit 60de1d7ded05c6304037d4858b401094b1d2b4d3 Author: Andy Hung <hunga@google.com> Date: Fri May 9 15:02:21 2014 -0700 Add format parameter to getTrackName() and track_t Change-Id: Ia152a839014e235fbfb656104c15d7c1b456d02e Signed-off-by: Andy Hung <hunga@google.com> Change-Id: Ied0ade8b25d23e89bb03319a7e3135c238f735b9
* 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