summaryrefslogtreecommitdiffstats
path: root/services/audioflinger
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | Merge "HAL stream format for mixer output threads must be stereo 16-bit PCM"Glenn Kasten2013-07-262-3/+20
|\ \ \ \
| * | | | HAL stream format for mixer output threads must be stereo 16-bit PCMGlenn Kasten2013-07-252-3/+20
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Direct and tunnel output threads can support various HAL stream formats, included encoded. But currently there are stereo 16-bit PCM assumptions in several places for mixer and duplicating output threads: - mMixBuffer and mixBuffer() - AudioMixer including resampler - FastMixer's mixBuffer - effects - NBAIO_Format - anywhere FCC_2 is used - possibly other places Until those assumptions are removed, this CL enforces stereo 16-bit PCM in mixer and duplicating threads at the place where the HAL format is read. It was already being checked in checkForNewParameters_l(), but not in readOutputParameters(). Change-Id: Ibe344cc922743da234299097aa1bb1f54795cc9b
* | | | AudioFlinger: offload playback, non-blocking writeEric Laurent2013-07-2511-321/+1153
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added specialized playback thread class for offload playback, derived from directoutput thread. This thread type handles specific state transitions for offloaded tracks and offloading commands (pause/resume/drain/flush..) to audio HAL. As opposed to other threads, does not go to standby if the track is paused. - Added support for asynchronous write and drain operations at audio HAL. Use a thread to handle async callback events from HAL: this avoids locking playback thread mutex when executing the callback and cause deadlocks when calling audio HAL functions with the playback thread mutex locked. - Better accouting for track activity: call start/stop and release Output methods in audio policy manager when tracks are actually added and removed from the active tracks list. Added a command thread in audio policy service to handle stop/release commands asynchronously and avoid deadlocks with playback thread. - Track terminated status is not a state anymore. This condition is othogonal to state to permitted state transitions while terminated. Change-Id: Id157f4b3277620568d8eace7535d9186602564de
* | | Merge "Use AudioSystem::setLowRamDevice() to configure memory"Glenn Kasten2013-07-225-18/+80
|\ \ \
| * | | Use AudioSystem::setLowRamDevice() to configure memoryGlenn Kasten2013-07-195-18/+80
| | | | | | | | | | | | | | | | | | | | Bug: 9798886 Change-Id: I9321e3f369f1ed9429ae222e3926ebdeb012b8b0
* | | | Merge "Revert "Fix Audioflinger crash when TeeSink is enabled""Glenn Kasten2013-07-221-3/+2
|\ \ \ \ | |/ / /
| * | | Revert "Fix Audioflinger crash when TeeSink is enabled"Glenn Kasten2013-07-191-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 84e391686d7eced293913d1d7993721224ee0ba1. Bug: 8834855 Change-Id: I8211ef5ea5d87d97ada115723df31c8057f38ca8
* | | | Merge "Fix compile warning"Glenn Kasten2013-07-221-1/+1
|\ \ \ \ | |/ / / |/| | |
| * | | Fix compile warningGlenn Kasten2013-07-191-1/+1
| | | | | | | | | | | | | | | | Change-Id: I80de4a013dc65eb7c532561438fd10e005354c03
* | | | Make AudioFlinger::instantiate() more resilient when called from separate moduleGlenn Kasten2013-07-1913-21/+69
|/ / / | | | | | | | | | | | | Bug: 8834855 Change-Id: I4cd842cdfb09d2aaaaab9df9ac3bec6179709bd3
* | | Fix theoretical memory leak in mConfigEventsGlenn Kasten2013-07-172-0/+7
| | | | | | | | | | | | Change-Id: I137f70676c8919661e716c33e0dd9c25c2b6285c
* | | Merge "Fix indentation"Glenn Kasten2013-07-171-74/+74
|\ \ \
| * | | Fix indentationGlenn Kasten2013-07-101-74/+74
| | | | | | | | | | | | | | | | Change-Id: Ia28720a7d0fad8cf110c2448b967d5648d42e017
* | | | Add commentsGlenn Kasten2013-07-102-1/+9
|/ / / | | | | | | | | | Change-Id: Ifbf3a46a4183c8abc0feee1c588953ab10303cc1
* | | am ace2378c: am f59a4b39: fix scheduling policy service death detectionEric Laurent2013-07-032-13/+31
|\ \ \ | | |/ | |/| | | | | | | * commit 'ace2378c934b61fbd865b5ade9ff7d0df81dabe3': fix scheduling policy service death detection
| * | am f59a4b39: fix scheduling policy service death detectionEric Laurent2013-07-032-13/+31
| |\ \ | | | | | | | | | | | | | | | | * commit 'f59a4b393f4844c5bbc8d6212364bdddea33d232': fix scheduling policy service death detection
| | * | fix scheduling policy service death detectionEric Laurent2013-07-022-13/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check status of transactions to scheduling policy service and re-acquire a binder interface in case of DEAD_OBJECT. Bug: 8875559. Change-Id: I1e00bd44e2d4723b3ec95d5c31d9652ba08e238a
* | | | Include what is neededGlenn Kasten2013-07-023-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove old includes. Header files only include other header files that they directly need themselves. Change-Id: Ic471386808d9f42ea19ccbd59cb50a5f83a89dd0
* | | | Public API changes for audio offload support.Richard Fitzgerald2013-06-275-22/+43
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NOTE: this does _not_ include all private member variables added to classes as part of offload support. Only public/protected functions and stubs functions/variables needed to make the changes buildable. - isOffloadSupported() added to audio policy service A stub implementation is required to build, this always returns false - setParameters() added to IAudioTrack A stub implementation is required to build, this always returns INVALID_OPERATION - CBlk flag for stream end - Change AudioSystem::getRenderPosition() to take an audio_output_t so caller can specify which output to query - Add AudioSystem::isOffloadSupported() This is fully implemented down to the AudioFlinger function AudioPolicyServer::isOffloadSupported() which is just a stub that always returns false. - Add EVENT_STREAM_END to AudioTrack interface. STREAM_END is used to signal when the hardware has actually finished playing all the data it was sent. - Add event type enumeration to media player interface AudioSink callbacks so that the same callback can be used to handle multiple types of event. For offloaded tracks we also have to handle STREAM_END and TEAR_DOWN events - Pass audio_offload_info_t to various functions used for opening outputs, tracks and audio players. This passes additional information about the compressed stream down to the HAL when using offload. For publicly-available APIs this is an optional parameter (for some of the internal and low-level APIs around the HAL interface it is mandatory) - Add getParameters() and setParameters() API to AudioTrack Currently dummy implementations. - Change AudioPlayer contructor so that it takes a set of bitflags defining what options are required. This replaces the original bool which only specified whether to use deep buffering. - Changes to StageFright class definition related to handling tearing-down of an offloaded track when we need to switch back to software decode - Define new StageFright utility functions used for offloaded tracks Currently dummy implementations. - AudioFlinger changes to use extended audio_config_t. Fills in audio_offload_info_t member if this info is passed in when opening an output. - libvideoeditor changes required to add the new event type parameter to AudioSink callback functions - libmediaplayerservice changes required to add the new event type parameter to AudioSink callback functions Change-Id: I3ab41138aa1083d81fe83b886a9b1021ec7320f1 Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Signed-off-by: Eric Laurent <elaurent@google.com>
* | | am d3ac2fc0: am f3e21c30: am 60f3f102: Merge "Prevent AudioCommands being ↵Glenn Kasten2013-06-201-6/+8
|\ \ \ | |/ / | | | | | | | | | | | | | | | freed before read" * commit 'd3ac2fc0c5429003f69d161e42bba7e94434ec09': Prevent AudioCommands being freed before read
| * | am f3e21c30: am 60f3f102: Merge "Prevent AudioCommands being freed before read"Glenn Kasten2013-06-201-6/+8
| |\ \ | | | | | | | | | | | | | | | | * commit 'f3e21c301b8fef49eecf9c716373fcbfbaa47670': Prevent AudioCommands being freed before read
| | * \ am 60f3f102: Merge "Prevent AudioCommands being freed before read"Glenn Kasten2013-06-201-6/+8
| | |\ \ | | | | | | | | | | | | | | | | | | | | * commit '60f3f102ba2973cc31e5c7ea00d95bbf19968e8b': Prevent AudioCommands being freed before read
| | | * | Prevent AudioCommands being freed before readChrister Fletcher2013-06-201-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When AudioCommandThread::threadLoop process AudioCommands it was possible for it to delete a command where the posting thread still hadn't read that status from it. If a second command signaled the thread loop to continue after it had inserted a new command while the thread loop was actually waiting for the first command to report that it had read the status the thread loop would continue and delete the first command. Changed the wait condition when waiting for the calling thread to read status to use command->mCond instead of mWaitWorkCV. This way it's guaranteed that the signal to continue comes from the correct thread. Change-Id: Ia69b48cb4fdfaf8b4c83b56a197fb9f2058a92d1
| | | * | Replace obsolete CLOCK_MONOTONIC_HR by CLOCK_MONOTONICGlenn Kasten2013-05-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (cherry-pick of da1a325bc0a1421f4233e62704da4fab8b0acf7b.) Bug: 8895727 Change-Id: I29d5dcf8519600fdd2910345449c66a5c1284646
* | | | | New control block for AudioTrack and AudioRecordGlenn Kasten2013-06-126-211/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | am bb35be24: am 7be48189: Merge "audioflinger: fix effects on direct output ↵Eric Laurent2013-06-121-7/+5
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | threads" into jb-mr2-dev * commit 'bb35be24239f05f59715960a93cd491a4cd3b4d6': audioflinger: fix effects on direct output threads
| * | | | am 7be48189: Merge "audioflinger: fix effects on direct output threads" into ↵Eric Laurent2013-06-121-7/+5
| |\ \ \ \ | | | |_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | jb-mr2-dev * commit '7be48189c0aefb82825a7689d9e1005175570779': audioflinger: fix effects on direct output threads
| | * | | audioflinger: fix effects on direct output threadsEric Laurent2013-06-111-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PlaybackThread::addTrack_l() uses the assumption that effects are attached to a track only if the track accumulation buffer is different from the mixer thread output buffer. This is not true for direct output threads where only one track is active an only one buffer is needed. This assumption is an optimization to avoid checking for effect chains with the same session ID each time a track is processed. The optimization is not key if only one track is attached to the thread which is the case for direct outputs. Current code fails to increment the active track count in the effect chain on direct output threads when a track is started thus making the effect framework clear the mix buffer and produce silence each time the mixer runs. The fix consists in removing the optimization described above. Bug: 9324989. Change-Id: Id7a6337450ed90d326299c2ce9fc02f4b9e2fa6f
* | | | | am d3a5b48a: am 18b46679: Merge "AudioFlinger: do not cache audio device ↵Eric Laurent2013-06-072-4/+6
|\ \ \ \ \ | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | when 0." into jb-mr2-dev * commit 'd3a5b48a1bc4f5d6ff4472f54f909abaadd5fa39': AudioFlinger: do not cache audio device when 0.
| * | | | am 18b46679: Merge "AudioFlinger: do not cache audio device when 0." into ↵Eric Laurent2013-06-072-4/+6
| |\ \ \ \ | | |/ / / | | | / / | | |/ / | |/| | | | | | | | | | jb-mr2-dev * commit '18b466790aa0a55ff4282ed8b5e550e58e0444b2': AudioFlinger: do not cache audio device when 0.
| | * | AudioFlinger: do not cache audio device when 0.Eric Laurent2013-06-062-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AudioFlinger should not cache the audio device passed to the audio HAL when it is AUDIO_DEVICE_NONE but keep previous valid selection instead. Bug: 9323399. Change-Id: I6f9480e55a21be4115453e6a5eebc5cf2536c476
| * | | am effc08ed: Merge "Replace obsolete CLOCK_MONOTONIC_HR by CLOCK_MONOTONIC"Elliott Hughes2013-05-141-2/+2
| |\ \ \ | | |/ / | |/| | | | | | | | | | * commit 'effc08ed1eb1d55ca13997ec96f72e40a0866394': Replace obsolete CLOCK_MONOTONIC_HR by CLOCK_MONOTONIC
| | * | Replace obsolete CLOCK_MONOTONIC_HR by CLOCK_MONOTONICGlenn Kasten2013-05-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (cherry-pick of da1a325bc0a1421f4233e62704da4fab8b0acf7b.) Bug: 8895727 Change-Id: I29d5dcf8519600fdd2910345449c66a5c1284646
| * | | Fix Audioflinger crash when TeeSink is enabledGlenn Kasten2013-05-061-2/+3
| | | | | | | | | | | | | | | | | | | | Bug: 8834855 Change-Id: I54665f16d79901970348a8247d9a354da2990f42
| * | | Merge "Remove timing jitter during startup of audio" into jb-mr2-devEric Laurent2013-05-036-7/+17
| |\ \ \
| | * | | Remove timing jitter during startup of audioGlenn Kasten2013-04-236-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression introduced recently, that increased timing jitter during the startup of the FastMixer and AudioTrack callback threads. The regression was to make requestPriority() asynchronous as a way to avoid an apparent priority inversion in system_server. This means that the target thread could run briefly with the initial priority, before the new priority takes effect. This change removes the startup jitter for FastMixer, by making the requestPriority() synchronous again for that case. It doesn't matter that this restores the priority inversion involving normal mixer thread, because it happens during startup of both threads. The change also removes the startup jitter for the AudioTrack callback thread, by having the target thread check whether the requestPriority() has completed yet. If not, the target thread blocks with a timeout until the priority boost finishes. Finally, we now log an error message if the expected priority boost doesn't happen. Bug: 8698989 Change-Id: Id590e9a274b70ec1ba85b44a585ee37a22e41cbc
| * | | | audioflinger: fix duplicating track sampling rateEric Laurent2013-04-251-0/+3
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add missing initialization of client proxy sampling rate and volumes in OutputTrack constructor. Bug: 8687522 Change-Id: I813e700315bb97083a63dd32279f1998ac775483
| * | | Use correct pid when running under test harnessGlenn Kasten2013-04-183-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a partial fix which addresses one of the root causes of this bug, but only when running under test harness. It has no effect otherwise. Bug: 8598539 Change-Id: I87444daef1d76b17544f331e651ba1c87893c381
| * | | Merge "Workaround: requestPriority() is one-way" into jb-mr2-devGlenn Kasten2013-04-151-1/+1
| |\ \ \
| | * | | Workaround: requestPriority() is one-wayGlenn Kasten2013-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Bug: 8565696 Change-Id: If5fcdf8593e1ca15bea45217bd683b43a2a106c7
| * | | | Add liblogYing Wang2013-04-091-3/+5
| |/ / / | | | | | | | | | | | | | | | | Bug: 8580410 Change-Id: If493d87d60d71be664ad75b140c62acadb75b0d0
| * | | audioflinger: multiple tracks on direct outputEric Laurent2013-04-041-45/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix problems when multiple tracks exist on a direct output thread: when multiple tracks are active, continue to update all track states but only take into account the last track started for audio HAL volume and mixer state control. Bug 8388941 Change-Id: I57e6757286f41651dda99b11a5449e431812431b
| * | | audioflinger: add effect config status checkEric Laurent2013-04-021-12/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check the result of the effect engine configuration command and do not attempt to send parameters to, enable, or process the effect if configuration fails. Bug 8512027 Change-Id: I8c78a05d79fba36b1a387aa5cf2700612301ac91
| * | | Increase size of statistics bufferGlenn Kasten2013-03-111-1/+1
| | | | | | | | | | | | | | | | | | | | Bug: 8354576 Change-Id: I327e9dc203e09df8abc21e589ce9056540618abd
| * | | Add template class SingleStateQueueGlenn Kasten2013-03-051-1/+0
| | | | | | | | | | | | | | | | Change-Id: If7e2bc9b2a216524ee9cbb68682e2634933b4973
| * | | Miscellaneous cleanupGlenn Kasten2013-03-046-20/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Abbreviation framesReady to fRdy for new systrace. Put inline const on one line. Use local copy of mState in state. Improve logging. Line length 100. Change-Id: I8201c3ce0e53fd464fd33d02544e52c342d40b68
| * | | Merge "media.log cleanup" into jb-mr2-devGlenn Kasten2013-03-026-38/+22
| |\ \ \
| | * | | media.log cleanupGlenn Kasten2013-03-016-38/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove almost all of the specific logs, but leave the media.log logging infrastructure in place for the next time we need it. Re-apply a few good changes that were reverted earlier: - check logf format vs. argument list compatibility - distinguish potentially modified and actually modified tracks in FastMixer - fix benign bug where sq->end() was called more than once - fix a build warning Bug: 6490974 Change-Id: I02d3e83646c738acaebb415bd0d6b548638b4ef5
| * | | | Merge "Remove tee sink debugging at compile time" into jb-mr2-devGlenn Kasten2013-03-016-23/+70
| |\ \ \ \ | | |/ / / | |/| | |
| | * | | Remove tee sink debugging at compile timeGlenn Kasten2013-02-266-23/+70
| | | | | | | | | | | | | | | | | | | | | | | | | Bug: 8223560 Change-Id: Iddbfb06c45d43d9f20bb428215dd4094931e19a7