summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/Threads.cpp
Commit message (Collapse)AuthorAgeFilesLines
* am d5516339: Merge "Move frameworks/av from fdprintf to POSIX dprintf."Calin Juravle2014-05-221-2/+2
|\ | | | | | | | | * commit 'd551633916d3677da4dda10aba6837bdc6803ee0': Move frameworks/av from fdprintf to POSIX dprintf.
| * Move frameworks/av from fdprintf to POSIX dprintf.Elliott Hughes2014-05-221-2/+2
| | | | | | | | | | Bug: 11156955 Change-Id: Ia98cd16b4c1f7be87cf060b7456de4f40896bacb
* | am 3b6da6bf: Merge "Move frameworks/av off private API."Elliott Hughes2014-05-221-2/+2
|\ \ | |/ | | | | | | * commit '3b6da6bfb50a1c0324fb4c87326d3a477944d5fe': Move frameworks/av off private API.
| * Move frameworks/av off private API.Elliott Hughes2014-05-211-2/+2
| | | | | | | | | | Bug: 11156955 Change-Id: Ib3bb9d66a2bf92977c2445b62aa074a2d7a45aea
* | am d084206d: Merge "Move frameworks/av off __futex_syscall3."Elliott Hughes2014-05-221-2/+2
|\ \ | |/ | | | | | | * commit 'd084206d5a4a5364211af46e4201311933e83bfc': Move frameworks/av off __futex_syscall3.
| * Move frameworks/av off __futex_syscall3.Elliott Hughes2014-05-211-2/+2
| | | | | | | | | | Bug: 11156955 Change-Id: I943080bc51b6efa781059b48b5b5ecc4fa287512
* | am ce473c32: Merge "Codec Offload: Add NULL check as mCallbackThread is NULL ↵Eric Laurent2014-05-191-1/+4
|\ \ | |/ | | | | | | | | | | when offloaded HAL is running BLOCKING mode" * commit 'ce473c32705e2d1c5fcc817198101e1220b3c8f7': Codec Offload: Add NULL check as mCallbackThread is NULL when offloaded HAL is running BLOCKING mode
| * Codec Offload: Add NULL check as mCallbackThread is NULLUday Gupta2014-05-131-1/+4
| | | | | | | | | | | | | | | | | | | | when offloaded HAL is running BLOCKING mode b/14897952 Change-Id: I159a33e1181c1a62d80ab4bd3337a35dafaad884 Signed-off-by: Uday Gupta <guptau@broadcom.com> Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
| * audioflinger: Fix for a deadlock in track creationHaynes Mathew George2014-03-061-1/+2
| | | | | | | | | | | | | | | | | | AudioFlinger enters a deadlock (with itself) on trying to free a RecordTrack or Track object that failed initialization. Clear this bad object from the caller instead. Bug: 12423233 Change-Id: I926f2beb922a70f6924e593e2bbf1a5b5df85b16
* | am 3c9130a8: Merge "Make frameworks/av 64-bit compatible"Narayan Kamath2014-03-071-14/+18
|\ \ | |/ | | | | | | * commit '3c9130a8a12ce962dc8d22e04243b135b9e98b01': Make frameworks/av 64-bit compatible
| * Make frameworks/av 64-bit compatibleKévin PETIT2014-02-111-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | Contains the necessary changes to make frameworks/av build and work on a 64-bit machine. Signed-off-by: Craig Barber <craig.barber@arm.com> Signed-off-by: Kévin PETIT <kevin.petit@arm.com> Signed-off-by: Ashok Bhat <ashok.bhat@arm.com> Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> Change-Id: I725feaae50ed8eee25ca2c947cf15aee1f395c43
* | am 5930e8eb: Merge "AudioFlinger: Remove code for supporting resampling in ↵Glenn Kasten2014-03-071-1/+0
|\ \ | |/ | | | | | | | | | | fast tracks" * commit '5930e8ebdacf3a59c13eef11fd03658ba58b443e': AudioFlinger: Remove code for supporting resampling in fast tracks
| * AudioFlinger: Remove code for supporting resampling in fast tracksMartin Storsjo2014-02-051-1/+0
| | | | | | | | | | | | This isn't used at the moment. Change-Id: I4e0fb2af5f7d959dbafd5ddb7defa1c6b8e8636a
* | am 4361749d: Merge "AudioTrack: Never try to use the fast path if resampling ↵Glenn Kasten2014-03-071-2/+0
|\ \ | |/ | | | | | | | | | | is required" * commit '4361749d74113069aafb0620a1189404205c58d0': AudioTrack: Never try to use the fast path if resampling is required
| * AudioTrack: Never try to use the fast path if resampling is requiredMartin Storsjo2014-01-311-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unless AudioFlinger was built with FAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE enabled, AudioFlinger would deny using the fast path (and internally fall back to the normal codepath) when it realized that resampling was required. Since the buffer size calculations within AudioFlinger don't take resampling into account properly (see the calculation below "AUDIO_OUTPUT_FLAG_FAST denied" in audioflinger/Threads.cpp, just below the hunk that this patch changes), make sure AudioTrack doesn't try to use the fast path if resampling is required. This removes the possibility to enable FAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE in AudioFlinger since it AudioTrack now won't even try to use the fast path for content that requires resampling, regardless of the AudioFlinger configuration. Change-Id: Icf0f8ad50bf0fdb84657f518c0120aa0535f23f9
| * audioflinger: fix static track end detectionEric Laurent2014-01-301-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If a static track is not a fast track, prepareTracks_l() must rely on framesReady() to detect end of buffer and remove the track from the active track list. Failing to do so results in the track staying active but not processed by the mixer because in underrun. This leaves the mix buffer content uninitialized and causes the effect process function to accumulate its output onto undefined data. Bug: 12013676. Change-Id: Iad72c921fa18d34811abf7d1073890c093a27725
* | am 281dd4e1: audioflinger: fix static track end detectionEric Laurent2014-03-051-9/+2
|\ \ | | | | | | | | | | | | * commit '281dd4e13309973dbb85bce531f884237e0d8fb0': audioflinger: fix static track end detection
| * | audioflinger: fix static track end detectionEric Laurent2014-03-051-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a static track is not a fast track, prepareTracks_l() must rely on framesReady() to detect end of buffer and remove the track from the active track list. Failing to do so results in the track staying active but not processed by the mixer because in underrun. This leaves the mix buffer content uninitialized and causes the effect process function to accumulate its output onto undefined data. Bug: 12013676. Change-Id: I4b0819a9d93141ac3307b8786fc6a451dd585220
* | | am 7e92abea: audioflinger: fix offload write buffer offsetEric Laurent2014-03-051-2/+2
|\ \ \ | |/ / | | | | | | | | | * commit '7e92abeafb184e8a34213d7149592e95a72601b0': audioflinger: fix offload write buffer offset
| * | audioflinger: fix offload write buffer offsetEric Laurent2014-03-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Fix current audio HAL write buffer offset calculation which assumes that the frame size is a multiple of 2. ' Bug: 12823725. Change-Id: I0195ed5cfef225a6f114e7dd405a02680bb7254e
| * | audioflinger: check for condition before waitingHaynes Mathew George2014-03-041-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | AsyncCallbackThread must check for any condition that was already been satisfied before waiting. Bug: 11824817 Change-Id: I04683a1f355de4f440106cab47fd916aa39d5e35
* | | am e010f65e: audioflinger: Fix for a deadlock in track creationHaynes Mathew George2014-03-051-1/+3
|\ \ \ | |/ / | | / | |/ |/| * commit 'e010f65e6337267cb15f8894c950a3f64370dd36': audioflinger: Fix for a deadlock in track creation
| * audioflinger: Fix for a deadlock in track creationHaynes Mathew George2014-03-041-1/+3
| | | | | | | | | | | | | | | | | | AudioFlinger enters a deadlock (with itself) on trying to free a RecordTrack or Track object that failed initialization. Clear this bad object from the caller instead. Bug: 12423233 Change-Id: I926f2beb922a70f6924e593e2bbf1a5b5df85b16
* | audioflinger: check for condition before waitingHaynes Mathew George2013-12-171-1/+6
| | | | | | | | | | | | | | | | AsyncCallbackThread must check for any condition that has already been satisfied before waiting. Bug: 11824817 Change-Id: Ic8c2090d521ecd6a30b76ee75635258d35eb1eff
* | Merge "Increase kFastTrackMultiplier from 1 to 2"Glenn Kasten2013-12-171-7/+7
|\ \ | |/ |/|
| * Increase kFastTrackMultiplier from 1 to 2Glenn Kasten2013-12-041-7/+7
| | | | | | | | Change-Id: I158f147295eebcea96e4047d7618069bc48bdd7d
* | audioflinger: do not use raw pointer for tracksEric Laurent2013-11-151-7/+7
| | | | | | | | | | | | | | | | | | | | 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
* | 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
* | AudioFlinger: more fixes for offload audio lostEric Laurent2013-10-281-14/+25
| | | | | | | | | | | | | | | | | | | | | | 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-251-19/+76
| | | | | | | | | | | | | | | | | | | | | | 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
* | audioflinger: fix track terminated before playingEric Laurent2013-10-171-11/+8
|/ | | | | | | | | | | | 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
* Make Audio wakelock names less unique.Narayan Kamath2013-10-141-2/+21
| | | | | | | | | | | | | | | 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-071-1/+3
|\
| * Cleanup openRecord error handlingGlenn Kasten2013-09-241-1/+3
| | | | | | | | | | 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-031-11/+19
|\ \
| * | Better recording wake lock accountingMarco Nelissen2013-10-031-11/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-301-1/+10
|/ / | | | | | | | | | | | | | | | | | | | | | | | | 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
* | audioflinger: fix crash when starting offload threadEric Laurent2013-09-261-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | 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
* Merge "audioflinger: implement getTimestamp() for offloaded tracks" into klp-devEric Laurent2013-09-201-0/+16
|\
| * audioflinger: implement getTimestamp() for offloaded tracksEric Laurent2013-09-201-0/+16
| | | | | | | | | | Bug: 9587132. Change-Id: Ie9d5f4cca96306d08bc9a2dbd6edd8953096702d
* | audioflinger: fix lost offload thread resume eventEric Laurent2013-09-191-27/+32
|/ | | | | | | | | | | | | | | | | 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
* more support for audio effect offloadEric Laurent2013-09-181-7/+23
| | | | | | | | | | | | | | | | 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