summaryrefslogtreecommitdiffstats
path: root/services/audioflinger
Commit message (Collapse)AuthorAgeFilesLines
* Make Audio wakelock names less unique.Narayan Kamath2013-10-142-2/+23
| | | | | | | | | | | | | | | These wakelocks now show up in the client process, where they might cause wakelock overflows if AudioFlinger threads die often. The client process should be agnostic of audio flinger threading, so don't make the wakelock names rely on audioflinger thread names. Wakelock names now depend only on the audio flinger thread type, and not the ID itself. bug: 11200551 Change-Id: Ia1f71b569cb7502d617b77596abc245f461a6ec0
* Merge "Cleanup openRecord error handling" into klp-devGlenn Kasten2013-10-072-1/+7
|\
| * Cleanup openRecord error handlingGlenn Kasten2013-09-242-1/+7
| | | | | | | | | | Bug: 10888816 Change-Id: I84897dd7d30b370640b54e928f230604b873cb68
* | audioflinger: offload: fix pause/flush/resumeEric Laurent2013-10-041-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If a pause/flush/resume sequence is fast enough, resume is received while we are still in PAUSING state in which case it is a NOP. If this happens, flush is still forwarded to the audio HAL but is not preceeded by a pause which can cause problems to the audio DSP. It is necessary to preserve the flush as this sequence is typical to a seek. The fix consists in forcing a pause/resume when a flush request must be executed and the audio HAL has not been paused previously. Bug: 11081559. Change-Id: Ib84ed26d503a61c05933b923ec556b10cedfe140
* | audioflinger: fix wake lock acquisition checkEric Laurent2013-10-041-2/+2
| | | | | | | | | | | | | | | | | | | | Commit e14a5d6 introduced a bug in ThreadBase::acquireWakeLock() where the wake lock acquisition return code is not initialized before being checked causing the wake lock token to be sometines not set and potential failure to release the wake lock later. Bug: 10985160. Change-Id: Iffd40e773ae3bcfec3c148a844d5dbebbf474eaf
* | Merge "Better recording wake lock accounting" into klp-devMarco Nelissen2013-10-032-13/+22
|\ \
| * | Better recording wake lock accountingMarco Nelissen2013-10-032-13/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | Count wake lock use against the app that initiated the recording, not against the media server. b/10985160 Change-Id: Iae6e6c030b7f1c6081d9c79725d6990f60dadaaa
* | | fix volume and effect enable delay on offloaded tracksEric Laurent2013-09-305-6/+45
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Volume: add a method to wake up the mediaserver playback thread when a volume command is received on an offloaded track. Effects: call effect chain process on offloaded playback threads asynchronously from writes to allow effect state updates while waiting for async write callback. Bug: 10796540. Change-Id: Id2747ae88783575d1d7ffd6fc86fbd054ab2c739
* | Merge "Don't call audio effect process on offloaded playback threads" into ↵Jean-Michel Trivi2013-09-271-3/+4
|\ \ | | | | | | | | | klp-dev
| * | Don't call audio effect process on offloaded playback threadsJean-Michel Trivi2013-09-261-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | An audio effect process command is not meant to be called for playback threads belonging to offloaded playback. Bug 10933817 Change-Id: Idc7b6a0224791bbf8d61648474d3c288617c498f
* | | audioflinger: fix crash when starting offload threadEric Laurent2013-09-262-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing a sp to parent thread to AsyncCallbackThread() constructor causes a strong reference to be acquired on the OffloadThread inside its constructor which causes an early launch of the thread loop with unpredictable consequences. Pass a wp to parent thread instead. Also move the creation of the AsyncCallbackThread to readOutputParameters() where mUseAsyncWrite is initialized which makes more sense. Also change the type of AsyncCallbackThread parent thread to PlaybackThread instead of OffloadThread to allow a broder use of non blocking write which in theory is not limited to audio offload use case. Bug: 8174034. Change-Id: I4b093b022030cd4f5eb8b8e477333e91098a6549
* | | fix deadlock in audioflinger::createEffect()Eric Laurent2013-09-252-21/+22
|/ / | | | | | | | | | | | | | | | | | | commit 5baf2af5 introduced a regression by calling getOutputForEffect() with AudioFLinger main mutex locked. The locking order must always be AudioPolicyService mutex then AudioFlinger then ThreadBase mutex. Bug: 10916796. Change-Id: Ide34a2d84dbb06dbb35abd0640d91b01b0ac4d40
* | audioflinger: fix ro.audio.silent in offload againEric Laurent2013-09-231-0/+2
|/ | | | | | | | | | | Commit 1abbdb4 was not working 100% of the times because it is possible that the offload thread loop never sleeps after being created in which case the property is never read. The loop now reads the property once when starting. Bug: 10899309. Change-Id: I2e2ca332f2d7086e59d65f6010378c4d9618ba9e
* fix incoming call audio start time.Eric Laurent2013-09-231-9/+10
| | | | | | | | | | | | | commit cec4abb fixing issue 6720482 had a flaw that would insert commmands at the wrong position in the audio policy service command thread queue causing other commands to be delayed more than expected. A change in track stop timing introduced by commit bfb1b83 made this issue visible when answering a call. Bug: 10860012. Change-Id: Iec769112f14e13d13b64628b808e43663e33771c
* Merge "audioflinger: implement getTimestamp() for offloaded tracks" into klp-devEric Laurent2013-09-203-12/+34
|\
| * audioflinger: implement getTimestamp() for offloaded tracksEric Laurent2013-09-203-12/+34
| | | | | | | | | | Bug: 9587132. Change-Id: Ie9d5f4cca96306d08bc9a2dbd6edd8953096702d
* | Merge "audioflinger: fix lost offload thread resume event" into klp-devEric Laurent2013-09-203-30/+37
|\ \
| * | audioflinger: fix lost offload thread resume eventEric Laurent2013-09-193-30/+37
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was possible that a resume request signaled by addTrack_l() while waiting for an async write callback is lost. This is because mSignalPending was not set and waitingAsyncCallback_l() would pause the thread loop before executing prepareTracks_l(). The fix consists in using signal_l() method to wake the thread loop o that mSignalPending is set. Also make sure that sleepTime is reset to 0 when resuming to make sure that we write any remaining bytes to the HAL. Bug: 10810347. Change-Id: If9a3b22cc3b9e6eb384a56c48c40e6258d0896ad
* | audioflniger: fix leaked audiosession referencesEric Laurent2013-09-181-1/+19
|/ | | | | | | | | | | | | | acquireAudioSessionId() should not create session references if the caller is not listed in the known notification clients. It happens when the MediaPlayer or AudioTrack is created by the mediaserver on behalf of a client (e.g CameraService). In this case releaseAudioSessionId() can be called from a different pid and the session reference will not be removed. Also we will not be able to remove the reference if the client process dies. Bug: 10606426. Change-Id: Ibb5e27518daeb484a2e66302e4c6221cbaca5b70
* more support for audio effect offloadEric Laurent2013-09-186-57/+136
| | | | | | | | | | | | | | | | Offloading of audio effects is now enabled for offloaded output threads. If an effect not supporting offload is enabled, the AudioTrack is invalidated so that it can be recreated in PCM mode. Fix some issues in effect proxy related to handling of effect commands to offloaded and non offloaded effects. Also fixed a bug on capture index in software Visualizer effect. Bug: 8174034. Change-Id: Ib23d3c2d5a652361b0aaec7faee09102f2b18fce
* Merge "audioflinger: fix ro.audio.silent in offload mode" into klp-devEric Laurent2013-09-141-2/+4
|\
| * audioflinger: fix ro.audio.silent in offload modeEric Laurent2013-09-131-2/+4
| | | | | | | | Change-Id: I5a1a79000d53146689b0a198cc5419c36509703f
* | audioflinger: longer offload thread standby delayEric Laurent2013-09-132-9/+24
|/ | | | | | | | | | | | | | - Increase offloaded output thread standby delay to 1 second to allow transition between tracks with going to stanby if reusing the same audio track (gapless) - Make sure pause/flush/resume sequence is sent to the HAL in the right order - Fix format display in track dump Bug: 8174034. Change-Id: I43ef6f8fdbf7427e4eff6cc2d0665d7d1463ea8a
* Merge "Fix AudioTrack shared memory leak" into klp-devGlenn Kasten2013-09-122-1/+14
|\
| * Fix AudioTrack shared memory leakGlenn Kasten2013-09-112-1/+14
| | | | | | | | | | Bug: 2801375 Change-Id: I50e15164fe310f69ea019dca5b49171a02bc6992
* | Merge "audioflinger: add HOTWORD audio source." into klp-devEric Laurent2013-09-126-2/+33
|\ \ | |/ |/|
| * audioflinger: add HOTWORD audio source.Eric Laurent2013-09-106-2/+33
| | | | | | | | | | | | | | | | | | | | HOTWORD is a special capture audio source that uses the same audio tuning as VOICE_RECOGNITION but allows an active capture to be preempted. Bug: 10640877. Change-Id: Iea09a11cbcdbacc8d434e5230e7559dcd1b44ac0
* | audioflinger: no effects on offloaded tracksEric Laurent2013-09-095-13/+83
|/ | | | | | | | | | | Invalidate offloaded tracks when an effect is enabled so that the track is recreated in PCM mode and the effect can be applied. This is temporary until effect offloading is implemented. Bug: 8174034. Change-Id: I77b8b54a10db6cb8334be76d863ea7e720eaad09
* audioflinger: remove async write race conditionsEric Laurent2013-09-062-53/+100
| | | | | | | | | Remove possible race conditions between async callback thread and offload thread when clearing and setting the draining and write blocked flags. Bug: 8174034. Change-Id: I7af10491f39dc0e7d7414862a9d8e763daa2e2b7
* Fix miscellanous AudioTrack::getTimestamp() bugsGlenn Kasten2013-09-031-1/+5
| | | | | | | | | | | | | | Check that get_presentation_position is non-NULL before calling. AudioTrack::getTimestamp not implemented for fast tracks. Fix typo in Track::getTimestamp(). Fix bugs in AudioTrack::getTimestamp after stop: - getTimestamp while stopped is not allowed. - stop, start, getTimestamp now returns the correct value. Change-Id: Ie8d9dc1f28d8927634e04175a68b147ffc2ea8eb
* FastMixer computes presentation timestamps for fast tracksGlenn Kasten2013-09-031-1/+46
| | | | | | and forwards them to each track's ExtendedAudioBufferProvider::onTimestamp(). Change-Id: I06fb9586bb7e20d5c0289abdc8cac6cd3fd2f6e8
* Add ExtendedAudioBufferProvider::framesReleased and onTimestampGlenn Kasten2013-09-032-0/+11
| | | | | | | and implement them in SourceAudioBufferProvider using the associated NBAIO_Source, and in Track using the associated AudioTrackServerProxy. Change-Id: I60dc4adba63fc1dc452ff16caf347e4a7c8242c2
* Add NBAIO_Sink::getTimestamp()Glenn Kasten2013-09-031-1/+3
| | | | | | | | | | with a real implementation in AudioStreamOutSink for dummy implementation initially in MonoPipe. Use in AudioFlinger::PlaybackThread::threadLoop_write() to keep the input to the timestamp latch up-to-date. Change-Id: I10ef277991b63bb43d55d6f3df75116ef32246cd
* audioflinger: offloaded tracks flush/pause orderEric Laurent2013-08-301-4/+6
| | | | | | | Make sure that a flush received after a pause is forwarded to the HAL after the pause. Change-Id: Ib3221f70c59f8b3dbbac20b23104f6b779b75be0
* Implement Track::getTimestamp()Glenn Kasten2013-08-293-2/+41
| | | | | | | using a new timestamp latch in PlaybackThread, and AudioTrackServerProxy::framesReleased() which returns mServer. Change-Id: I1ebfba968c773faaab95648c272fd3ebd74718d6
* Add AudioFlinger::PlaybackThread::Track::getTimestamp()Glenn Kasten2013-08-292-1/+13
| | | | | | | with a dummy implementation initially, and use it in AudioFlinger::TrackHandle::getTimestamp() Change-Id: I2da88fc52a135a7f0d9fd9538986e919dc8ccd3b
* Add IAudioTrack::getTimestamp()Glenn Kasten2013-08-292-0/+6
| | | | | | | | | | with dummy implementation in AudioFlinger::TrackHandle, and implement AudioTrack::getTimestamp() using IAudioTrack. Also document invariant that mAudioTrack and control block are always non-0 after successful initialization. Change-Id: I9861d1454cff7decf795d5d5898ac7999a9f3b7e
* Enforce permission for recording from remote submix.Jeff Brown2013-08-163-0/+20
| | | | | Bug: 10265163 Change-Id: I2395036bac6e10baeaf6ea4bc3093bd9dd98742d
* RecordThread::createRecordTrack_l use flags for fast tracksGlenn Kasten2013-08-022-0/+59
| | | | | | | Look at client's request for a fast track in the flags parameter, and check whether the request can be satisfied. Change-Id: I65ddaeb1b85670fe9066076f638bfed0cda01c0d
* RecordTrack::createRecordTrack_l flags are in/outGlenn Kasten2013-08-023-3/+3
| | | | | | | | The flags are currently unused, but will be used for requesting a fast track. Making flags in/out will allow reporting back up to client that the request is denied. Change-Id: Ifbee57da3632ce130551065a426577fb97b1a68d
* IAudioFlinger::openRecord track_flags_t flags is in/outGlenn Kasten2013-08-022-3/+3
| | | | | | This will allow AudioFlinger to tell client it is denying a request. Change-Id: Iff2be3ad6636371bbda9c9899a283c94620c1f06
* Merge "Report underruns for fast tracks also"Glenn Kasten2013-08-023-16/+8
|\
| * Report underruns for fast tracks alsoGlenn Kasten2013-07-313-16/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression that was introduced earlier by commit 9f80dd223d83d9bb9077fb6baee056cee4eaf7e5 called "New control block for AudioTrack and AudioRecord". That commit broke underrun reporting for fast tracks. Also remove Track::mUnderrunCount, which counted the number of underrun events, and was only used by dumpsys media.audio_flinger. Now dumpsys media.audio_flinger reports the number of underrun frames, Isolated underrun-related control block accesses via the proxy, so that the server is not directly poking around in the control block. The new proxy APIs are AudioTrackServerProxy::getUnderrunFrames() and AudioTrackServerProxy::tallyUnderrunFrames(). getUnderrunFrames() returns a rolling counter for streaming tracks, or zero for static buffer tracks which never underrun, but do a kind of 'pause' at end of buffer. tallyUnderrunFrames() increments the counter by a specified number of frames. Change-Id: Ib31fd73eb17cbb23888ce3af8ff29f471f5bd5a2
* | am 6d4d8790: am b687ff9f: Merge "Fix mismatched delete/new couple"Glenn Kasten2013-08-011-2/+2
|\ \ | |/ |/| | | | | * commit '6d4d879037a495f9a4276a6996d1845594ce9090': Fix mismatched delete/new couple
| * Fix mismatched delete/new coupleAndrei V. FOMITCHEV2013-07-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | In RecordThread::readInputParameters(), mRsmpInBuffer is allocated with new[] and should be freed with delete[] instead of delete. This error has been found by valgrind. Change-Id: I2f947abb658a21a7d1e61eebb99270cb37d2d147 Signed-off-by: Andrei V. FOMITCHEV <andreix.fomitchev@intel.com> Signed-off-by: David Wagner <david.wagner@intel.com> Signed-off-by: Jack Ren <jack.ren@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
* | Merge "Add resampler comments and fix a typo"Glenn Kasten2013-07-304-4/+16
|\ \
| * | Add resampler comments and fix a typoGlenn Kasten2013-07-304-4/+16
| | | | | | | | | | | | Change-Id: Ie071673875f663de4212eed4a4dff89d51a5a915
* | | Move control block mName to createTrack() outputGlenn Kasten2013-07-304-2/+6
| | | | | | | | | | | | | | | | | | | | | This is part of a series of CLs to clean up the shared memory control block, by removing any fields that don't have to be there. Change-Id: I6e51003a1293b6800258c31b22cff2eba42162e7
* | | Rename control block flags to mFlagsGlenn Kasten2013-07-302-11/+11
| | | | | | | | | | | | Change-Id: I7b6d31e24531954ab1ecdf3ed56c19433700bd89
* | | Merge "AudioRecord and HAL input stream must be 16-bit PCM only"Glenn Kasten2013-07-302-7/+17
|\ \ \