summaryrefslogtreecommitdiffstats
path: root/services/audioflinger
Commit message (Collapse)AuthorAgeFilesLines
* audioflinger: do not use raw pointer for tracksEric Laurent2013-11-152-8/+8
| | | | | | | | | | Commit 9da3d95 surfaced a problem caused by the use of a raw pointer to a track in offload thread implementation. Pointers to tracks should always be weak or strong pointers. Bug: 11708529. Change-Id: Ic48632532d186c9be8261f73cefdf824b9fbbd2b
* audioflinger: fix offload track transitionEric Laurent2013-11-121-17/+24
| | | | | | | | | | | | | Make sure that when transitioning from one active offloaded track to the next we flush DSP content if both tracks are not on the same audio session. This happens when switching between two applications playing the same type of content (e.g MP3, stereo, 44.1). In this case, we reuse the same output thread because the track formats are compatible. Bug: 11247103. Change-Id: I2b9031591149adeb70766da5e0d21ff2933a37e8
* audioflinger: fix offload resume after drainEric Laurent2013-11-121-5/+9
| | | | | | | | | | | When pausing and resuming during the drain, the drain sequence number shuold not be modified otherwise the drain callback will be ignored. This causes failure to notify end of stream to audio player and transition to next song. Bug: 11247103. Change-Id: I2a35c5cc3fd6aa667cdd257f9e9cc8715cef5159
* audioflinger: fix direct output underrunEric Laurent2013-11-051-0/+6
| | | | | | | | | Underruns on tracks handled by a direct or offloaded threads were not properly reported to the applications causing a failure to automatically recover. Bug: 11535001. Change-Id: I7a8696b4d646f78b16710addfe7c108d0dd0038d
* Merge "AudioFlinger: fix duplicating thread standby." into klp-devEric Laurent2013-10-311-0/+1
|\
| * AudioFlinger: fix duplicating thread standby.Eric Laurent2013-10-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit fd47797 fixing issue 11247103 introduced a regression where the duplicating thread does not exit standby state as expected. This in turn prevents the tracks sending audio to other threads to complete their activity cycle normally. The fix conists in clearing mStandby state also in the specialized threadLoop_write() method of DuplicatingThread subclass. Bug: 11451415. Change-Id: Ie8a92c819a56a2834ea25fa70a8b7b2125721775
* | Merge "audioflinger: enable effects after registration if needed" into klp-devEric Laurent2013-10-302-0/+3
|\ \ | |/ |/|
| * audioflinger: enable effects after registration if neededEric Laurent2013-10-122-0/+3
| | | | | | | | | | | | | | | | | | This fixes a bug where effects were not properly reenabled after being moved from one playback thread to another. The effect is enabled but the audio policy manager sees it as disabled. Bug: 11181933. Change-Id: I19cac7acbaf61c546e667fd85ed7d4eda1c716d8
* | AudioFlinger: more fixes for offload audio lostEric Laurent2013-10-282-14/+26
| | | | | | | | | | | | | | | | | | | | | | mStandby being false was not a reliable indication that something had been written to audio HAL. Considering the last track in mActiveTracks vector as the latest activated track was wrong as this is a SortedVector. Bug: 11247103. Change-Id: I397d011c5afcdd779def3fe25aaae7669a472cfc
* | Assign blame for playback wakelocks.Marco Nelissen2013-10-258-35/+130
| | | | | | | | | | | | | | | | | | | | | | Set a work source for the playback wakelock, so that playback is counted against the requesting app instead of the media server. Cherrypicked from master. b/9464621 Change-Id: I7329f88a288a95a582a78005a1c3d16a5a611e31
* | Merge "Allow releaseBuffer after flush" into klp-devGlenn Kasten2013-10-181-1/+1
|\ \
| * | Allow releaseBuffer after flushGlenn Kasten2013-10-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After AudioTrack start checks for pending flush, allow releaseBuffer on any previously obtained buffer. For example, this can happen if the resampler has obtained a buffer but not released the whole buffer yet. Note that the resampler will be reading obsolete data. Bug: 11285590 Change-Id: I0614fbb62e43604aac3089cce4b7797c87a306b5
* | | audioflinger: fix track terminated before playingEric Laurent2013-10-172-13/+10
|/ / | | | | | | | | | | | | | | | | | | | | | | When a track is terminated before any audio was written, we should not send a drain request to the HAL. The drain will be ignored and we will wait the async callback for ever. Also fix a potential deadlock by not deleting a track with the thread mutex held: mPreviousTrack changed from a sp to a raw pointer. Bug: 11247103. Change-Id: I0a4b47b099204c7c326d45d700234ab8f72d8eae
* | Fix flush() followed by start()Glenn Kasten2013-10-171-0/+9
| | | | | | | | | | Bug: 11259166 Change-Id: I72526cdfd4e3ff4b06e6a317e577f57cc285205d
* | 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