History log of /frameworks/av/services/audioflinger/Threads.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
1bb9082596c9cac2995dc9b4465a7c6d5666d099 03-May-2017 rago <rago@google.com> Fix wait time for audio threads in suspend mode

Better estimation of wait time in suspended audio threads.

Bug: 34772697

Test: phone calls with BT headset.
Change-Id: Icf99c0671def810b57332a321e4de4680697715b
/frameworks/av/services/audioflinger/Threads.cpp
dff774afa22569774eb2c8c25b1b3f934badea4b 22-Apr-2017 Eric Laurent <elaurent@google.com> audioflinger: improve mmap stream volume

First try to use HW volume control and then fall back
to volume control in AAudio service.

Bug: 37518243
Test: play a sound and check AAudio volume callback is called
when pressing volume keys.

Change-Id: Ie18be9f553ae23c247974d8923e7dcddeb1047c8
/frameworks/av/services/audioflinger/Threads.cpp
d9534fb35245b8bcd2489e717bdd1ad9269b3000 12-Apr-2017 Phil Burk <philburk@google.com> Merge "AAudioService: integrated with audioserver" into oc-dev
c0c70e3c7dd10bc2c0caffcab1f3f5fb406b35fb 09-Feb-2017 Phil Burk <philburk@google.com> AAudioService: integrated with audioserver

Call the MmapStreamInterface from AudioFlinger instead of the FakeHAL.
Fix sending timestamps from the thread.
Add shared mode in service.

Bug: 35260844
Bug: 33398120
Test: CTS test_aaudio.cpp
Change-Id: I44c7e4ecae4ce205611b6b73a72e0ae8a5b243e5
Signed-off-by: Phil Burk <philburk@google.com>
(cherry picked from commit 7f6b40d78b1976c78d1300e8a51fda36eeb50c5d)
/frameworks/av/services/audioflinger/Threads.cpp
ddb332138cc8f3b4efad9b14b038f0a462b1b661 12-Apr-2017 Glenn Kasten <gkasten@google.com> Merge "Improve audio logs and dumpsys media.audio_flinger" into oc-dev
38f86713cbd22caae9fdd4ac2f0bb76ff91df34d 11-Apr-2017 Jean-Michel Trivi <jmtrivi@google.com> Audio policy / flinger: updates to recording callback and record stop

Do not trigger the callback for recording events when the patch
handle is NONE, the patch handle will be updated for the
recording session later.
When stopping recording, only stop the record thread if the
track is not active, not if it's not the first one.

Test: cts-tradefed run cts-dev -m CtsMediaTestCases -t android.media.cts.AudioRecordingConfigurationTest
Bug: 36569938

Change-Id: I1b7445ef4115d6337ba7b926f7e6b068361926a7
/frameworks/av/services/audioflinger/Threads.cpp
6d8018f0b7be9deec6b0acab10a0dca6e91d0fb8 21-Feb-2017 Glenn Kasten <gkasten@google.com> Improve audio logs and dumpsys media.audio_flinger

Include mFrameCount in shared memory corrupt error log.

Fix typo in log for primary audio interface.

Include the new server frame count in logs for fast tracks.

Always log when fast is successful for output tracks, as it helpful
(was already there for input).

Cleanup dumpsys for threads.

Bug: 37153050
Test: builds OK, and logs contain more information
Change-Id: I2b5b4d700e8eb7c261a3125fb03ddc00bf08537e
(cherry picked from commit 1bfe09a0b1755a79abd32b41c0dd433b88fc260c)
/frameworks/av/services/audioflinger/Threads.cpp
293558ad1977e24e65f7ba78f47382d33fc77d64 21-Mar-2017 Andy Hung <hunga@google.com> AudioFlinger: Improve Thread logging.

Test: dumpsys media.audio_flinger
Bug: 30572472
Change-Id: I43f72354a6ece045f5f9f664946a406166974258
/frameworks/av/services/audioflinger/Threads.cpp
886deb506ea2938cfec40fc0dd2bff072850386b 13-Mar-2017 Glenn Kasten <gkasten@google.com> Merge "Re-format to decrease the maximum line length of files to 100 characters"
d3bb645f0b7f567b033b8664499d685f8ec10628 06-Dec-2016 Glenn Kasten <gkasten@google.com> Re-format to decrease the maximum line length of files to 100 characters

Test: compiles OK
Change-Id: Ibe663032cd390ed2bcca6dc921d47732e6e15e21
/frameworks/av/services/audioflinger/Threads.cpp
1e039394f351ef77592689f32294a1c73840ad0e 13-Mar-2017 Glenn Kasten <gkasten@google.com> Merge "Rename audio_utils/conversion.h to mono_blend.h"
6bf707f4c0752643757a7389384817da41d34fab 24-Feb-2017 Glenn Kasten <gkasten@google.com> Rename audio_utils/conversion.h to mono_blend.h

There is only one function declared in that header file, and it is
mono_blend, so a more specific filename may be easier to understand.

Test: compiles OK
Change-Id: Ie2aec6c706b1822581b34d3702818b8200a1db8a
/frameworks/av/services/audioflinger/Threads.cpp
89e5a2b102b484fe19dbda2a0b118edfefc70241 09-Mar-2017 Nicolas Roulet <nicoroulet@google.com> Merge "NBLog periodic merging thread"
dcdfaecc1fa630a799e1fdb508a9b92da55abc36 14-Feb-2017 Nicolas Roulet <nicoroulet@google.com> NBLog periodic merging thread

Bug: 35468674
Test: no change in functionality, everything works as before
Change-Id: Id2cea243bc15767ca6803c9505bf23a18411500e
/frameworks/av/services/audioflinger/Threads.cpp
18b570146c971fe729c391bfbb869391084e623d 14-Feb-2017 Eric Laurent <elaurent@google.com> audioflinger: add standby() method to MmapStreamInterface

Bug: 33398120
Test: open/start/stop/close MMAP no IRQ stream for capture and playback

Change-Id: I48ec202a71565f759c441c2a835d8c8190e76334
/frameworks/av/services/audioflinger/Threads.cpp
10cbff139360f3f642e0e3b3ccf2d463dbed22cf 22-Feb-2017 Andy Hung <hunga@google.com> VolumeShaper: Enable for offload and direct tracks

Test: Play Music in offload mode
Bug: 31015569
Change-Id: I00bb59e3e6809d4682f42057b1cc083f4fa9b9d1
/frameworks/av/services/audioflinger/Threads.cpp
d5973043bed640cf634a26d65dedcde5d5ab3037 17-Feb-2017 Nicolas Roulet <nicoroulet@google.com> Merge "Minor code style changes and namespace fix"
8dc323ef737babc1b1c0b0347b4b895969aee77b 17-Feb-2017 Nicolas Roulet <nicoroulet@google.com> Merge "Added process name to PID log"
4da7820be451847bad698ac0f687b964d9b5d34f 03-Feb-2017 Nicolas Roulet <nicoroulet@google.com> Minor code style changes and namespace fix

Bug: 35329090
Test: recompile, no change of functionality
Change-Id: Ied3ec7d95ce29896e8bf1851b08345da74bf8299
/frameworks/av/services/audioflinger/Threads.cpp
c20cb50c1c14cd765874511872f087c875f43ed9 01-Feb-2017 Nicolas Roulet <nicoroulet@google.com> Added process name to PID log

Bug: 35357686
Test: included in CL
Change-Id: Ie4d3cb66a2c766ce87ebabcc9c0d3aa988702e09
/frameworks/av/services/audioflinger/Threads.cpp
9ee35d72c4b89db99c2df0b0125373f360b337f8 16-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "AudioFlinger: Prevent FastMixer for A2DP sink"
fda69406966f8578a7827e889bff615f0144b441 15-Feb-2017 Andy Hung <hunga@google.com> AudioFlinger: Prevent FastMixer for A2DP sink

Also avoids issues with FastMixer and BT suspend.

Test: BT with Play Movies
Bug: 34335167
Bug: 35166960
Bug: 35384619
Change-Id: Ie1bfaf2d09b7cfe6b86a1d26fc1d5fdabf82c020
/frameworks/av/services/audioflinger/Threads.cpp
f228531c5d01f497f5802c44545e0000ec44ab83 15-Feb-2017 Andy Hung <hunga@google.com> AudioFlinger: Do not wait for FastMixer if in cold idle.

Test: BT outgoing call
Bug: 34335167
Bug: 35166960
Change-Id: I1da0de844560bf77b4149dc30979eebc131d009e
/frameworks/av/services/audioflinger/Threads.cpp
30d48d9542fb3f85889108c1ee2daff98a4860e7 14-Feb-2017 Andy Hung <hunga@google.com> Merge "VolumeShaper: Initial implementation"
9fc8b5cd4a64ef07e84c69112461324d5c13a0b0 24-Jan-2017 Andy Hung <hunga@google.com> VolumeShaper: Initial implementation

The VolumeShaper is used to apply a volume
envelope to an AudioTrack or a MediaPlayer.

Test: CTS
Bug: 30920125
Bug: 31015569
Change-Id: I42e2f13bd6879299dc780e60d143c2d465483a44
/frameworks/av/services/audioflinger/Threads.cpp
f5f4056014118f6ddd16affe853fd0605001ab40 13-Feb-2017 Eric Laurent <elaurent@google.com> Merge "audio: several concurrent capture fixes"
7863c791dba8c4e5e9591b6837d410e580be0a25 10-Feb-2017 Eric Laurent <elaurent@google.com> Merge changes from topic 'mmap_no_irq'

* changes:
Add support for mmap stream
audioflinger: define MMAP HAL Stream control interface
555530ab903504ad3586bc24cd8a4f200f5c39ae 08-Feb-2017 Eric Laurent <elaurent@google.com> audio: several concurrent capture fixes

Make sure AudioRecord clients are invalidated synchronously
when closing an input stream instead of when the capture thread
exits.

Fix AudioPolicyManager::getInputForDevice() logic to make sure that
not only the first opened input encountered is considered when looking
for a compatible input to reuse for concurrent capture.

Bug: 22702906
Test: run CTS test
Change-Id: I7f69609d4ee70a37ab06753ff970b12df17d885b
/frameworks/av/services/audioflinger/Threads.cpp
83f042776b131b149f803fff6ab184ae2c4d98cd 07-Feb-2017 Mikhail Naganov <mnaganov@google.com> audioflinger: Adjust priority of hal threads

HALs are prohibited from using framework binder, and there is
no equivalent scheduling policy service in hwbinder. Thus, in order
to match priorities of FastCapture / Mixer threads with their
counterparts in the HAL, it is needed to request the priority boost
from audioflinger on behalf of the HAL.

Test done to verify the priority was correctly set.

Bug: 34131400
Change-Id: If8b6b031c0fcba771fae901a5b8e7da89b3a1570
Test: check priority match between audioflinger's and hal's threads
/frameworks/av/services/audioflinger/Threads.cpp
8eacd8090e16c022dcbb11850cff83f984fe2357 03-Feb-2017 Nicolas Roulet <nicoroulet@google.com> Merge "Implemented typed, thread-specific logging system. Currently supported types are: * Strings * Integers * Floats * Timestamps * Process IDs"
fe1e1449cadff4f946c33403aecc73b4b4a11e56 30-Jan-2017 Nicolas Roulet <nicoroulet@google.com> Implemented typed, thread-specific logging system. Currently supported types are:
* Strings
* Integers
* Floats
* Timestamps
* Process IDs

Added printf-like formatted logging using mentioned types.

Test: included in this CL
Bug: 29421410
Change-Id: Ie07b78d8d39c32fcc8a122ffa9b1b7082800b990
/frameworks/av/services/audioflinger/Threads.cpp
9bb03b4e10bfd26247eeb1865e40bb0645489816 14-Jan-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "audioflinger: Fix effect creation handling"
2247f7b84bf0ce3cc9c909ef987eedb086e3b4e8 13-Jan-2017 Mikhail Naganov <mnaganov@google.com> audioflinger: Fix effect creation handling

The code flow was incorrect for sure. The 'if' branch is chosen
if 'effect == 0', and 'effectRegistered' is set to 'true' before
the effect is even created.

Test: audioflinger doesn't crash if effect failed to get created
Change-Id: I00d5f28e8b96acd765867e212c5b8193e21f9b4a
/frameworks/av/services/audioflinger/Threads.cpp
8981605d43e24c46d395acb5f145b99589d45917 12-Jan-2017 Andy Hung <hunga@google.com> AudioFlinger: Move RecordBufferConverter to libaudioprocessing

Test: Recording loopback
Bug: 31015569
Change-Id: I7897d959f36ac7424544e35f47576c99a442dd54
/frameworks/av/services/audioflinger/Threads.cpp
6acd1d432f526ae9a055ddaece28bf93b474a776 04-Jan-2017 Eric Laurent <elaurent@google.com> Add support for mmap stream

Add support for MMAP streams created by Oboe service.
- A new audio thread class MmapThread deriving from ThreadBase
is added to manage permissions, volume, routing and wakelocks for activity
on MMAP streams.
- Requests received over MmapStreamInterface to open, start and stop
a MMAP stream are forwarded to audio policy manager so that activity
on MMAP capture and playback streams is visible to audio policy and
taken into account in volume and routing management.
`

Bug: Bug: 33398120
Test: manual test
Change-Id: I957906495fe9277d2972d810b633f50cd1e14ec3
/frameworks/av/services/audioflinger/Threads.cpp
068561c8e84569d51df2adbbb53b56fdfd09c06b 04-Jan-2017 Andy Hung <hunga@google.com> AudioFlinger: Split off audio processing library

Test: native AudioResampler test, general playback test
Bug: 31015569
Change-Id: Ifb248f4402a583438d756c014dcd7a4577aef713
/frameworks/av/services/audioflinger/Threads.cpp
022b9953153bdb1984f0abb17d21ef8c1826ad49 05-Jan-2017 Mikhail Naganov <mnaganov@google.com> Re-implement HIDL effect processing using FMQ and IMemory

Result: no hwbinder calls due music processing.

Test: make, use Play Music with effects, check traces
Bug: 30222631
Change-Id: I06d0e94e603688874b31824427f3b0878b5f7c8e
/frameworks/av/services/audioflinger/Threads.cpp
e1c4b5d7a94c21b8ce0c5707b4af84de596fbb79 22-Dec-2016 Mikhail Naganov <mnaganov@google.com> Re-implement HIDL stream read and write using FMQ

Result: no hwbinder calls due read / write session.

Test: make, perform Loopback RTT, check traces
Bug: 30222631

Change-Id: I4a8792525ec374111302cfd5c0a2e41f9f4cc418
/frameworks/av/services/audioflinger/Threads.cpp
d01b0f18491c355d808a57cb272404480e69618f 08-Nov-2016 Andy Hung <hunga@google.com> AudioFlinger: update to use uid_t

Test: Power manager shows correct uids for audio
Bug: 32713790
Change-Id: I60134f60631ea00886efc912ba298443aadd3c00
/frameworks/av/services/audioflinger/Threads.cpp
5b4051afc26367d7accd06580c5135c8295759f9 20-Dec-2016 Andy Hung <hunga@google.com> Merge "AudioFlinger: Associate audio time with client uid"
dae27707fc7d8370eb200d25d1a7c6dd7ad5e201 31-Oct-2016 Andy Hung <hunga@google.com> AudioFlinger: Associate audio time with client uid

Group active track operations for add and remove together.
PlaybackThread now uses strong pointer for active tracks.

Test: Play Music, Youtube, Batterystats, CTS AudioTrack
Bug: 32361950
Change-Id: I101df081dd8d090560a83c44c2fa9ffcbf39c84d
/frameworks/av/services/audioflinger/Threads.cpp
20b9ef0b55c9150ae11057ab997ae61be2d496ef 05-Dec-2016 Eric Laurent <elaurent@google.com> Add unique audio port IDs to AudioTrack and AudioRecord

This will allow to track activity at the track level instead of
at audio session level as only possible with current implementation.

AudioTracks and AudioRecords will receive a unique audio port ID the
first time they register to audio policy with
getOutputForAttr()/getInputForAttr() and keep this ID for their
lifetime.

This CL is the first partial change and just updates the
audio policy and audio flinger APIs used at track creation time.

Test: basic regression test of audio playback and capture use cases

Change-Id: I8d612e67738e120494f61e3f7c60bfd0b2c6a329
/frameworks/av/services/audioflinger/Threads.cpp
abf6ff26df459d991cdbc2dca3b78046c97469db 03-Dec-2016 Andy Hung <hunga@google.com> Merge "Log audio information to ensure complete delivery"
0d5a2ed0a05a2bf337c68edb54f24c60e18032c1 02-Dec-2016 Eric Laurent <elaurent@google.com> improve audio effect framwework thread safety

- Reorganize handle effect creation code to make sure the effect engine
is created with both thread and effect chain mutex held.
- Reorganize handle disconnect code to make sure the effect engine
is released with both thread and effect chain mutex held.
- Protect IEffect interface methods in EffectHande with a Mutex.
- Only pin effect if the session was acquired first.
- Do not use strong pointer to EffectModule in EffectHandles:
only the EffectChain has a single strong reference to the EffectModule.

Test: Tested with EffectTest app. Regression tests in main audio use cases.

Bug: 32707507
Change-Id: Ia1098cba2cd32cc2d1c9dfdff4adc2388dfed80e
/frameworks/av/services/audioflinger/Threads.cpp
2148bf0e79c436b8764b9edc4c8f2730cce98a32 29-Nov-2016 Andy Hung <hunga@google.com> Log audio information to ensure complete delivery

Test: Audio playback
Bug: 30572472
Change-Id: Ibad6fc202692cd3480ae726627252afdead083f3
/frameworks/av/services/audioflinger/Threads.cpp
9cab746b116b8aed38ca6b97bfea35103535e522 10-Nov-2016 Eric Laurent <elaurent@google.com> Revert "AudioFlinger: Associate audio time with client uid"

This reverts commit 2f366df67c31119bb6dd726becd32d14b18e6573.

Bug: 32728805
Change-Id: If0a158154814492eda427de0af8a49c0b0a91180
/frameworks/av/services/audioflinger/Threads.cpp
5850c4c8eecbe0db3cee8511a4f82cb443e27d08 10-Nov-2016 Eric Laurent <elaurent@google.com> Revert "AudioFlinger: Remove naked track pointers"

This reverts commit 062bfceaefab29f0f71db7d5a248b3f5f0572b6a.
Bug: 32728805
/frameworks/av/services/audioflinger/Threads.cpp
77109420fe285b4e9618bd5f0cd12e0fcef6eced 10-Nov-2016 Andy Hung <hunga@google.com> Merge "Audio: Use uid_t for uids"
1f12a8ad958344c50733b948628ffa06db9c5bc6 08-Nov-2016 Andy Hung <hunga@google.com> Audio: Use uid_t for uids

Test: Power manager shows correct uids for audio
Bug: 32713790
Change-Id: If5337e17283268f74dc0f00cc66ece9153d680ef
/frameworks/av/services/audioflinger/Threads.cpp
0871d93cbadad8d736a09454b47846e09a793504 08-Nov-2016 Andy Hung <hunga@google.com> Merge "AudioFlinger: Remove naked track pointers"
19b396db94fa9dc3dfe713e8687dad4804e06327 08-Nov-2016 Andy Hung <hunga@google.com> Merge "AudioFlinger: Associate audio time with client uid"
062bfceaefab29f0f71db7d5a248b3f5f0572b6a 01-Nov-2016 Andy Hung <hunga@google.com> AudioFlinger: Remove naked track pointers

Test: Play Music offloaded and kill audioserver
Change-Id: I3114a67f248e067e0b5334d76e4b5e6c39858040
/frameworks/av/services/audioflinger/Threads.cpp
2f366df67c31119bb6dd726becd32d14b18e6573 31-Oct-2016 Andy Hung <hunga@google.com> AudioFlinger: Associate audio time with client uid

Group active track operations for add and remove together.
PlaybackThread now uses strong pointer for active tracks.

Test: Play Music, Youtube, Batterystats, CTS AudioTrack
Bug: 32361950
Change-Id: Ica96e2b84b9dfa5766571e24de49401a81a30e9d
/frameworks/av/services/audioflinger/Threads.cpp
913d06c099bd689375483a839e11057ccf284d1c 01-Nov-2016 Mikhail Naganov <mnaganov@google.com> Move TypeConverter into a shared library

This will be needed for the default implementation of the audio HAL
in TREBLE for parsing supported formats etc. provided by HAL in
a form of string literals.

As a bonus, remove some hand-written type conversions in AudioFlinger
used in dumps.

Example changes in the dump output:

HAL format: 0x1 (pcm16) ==> HAL format: 0x1 (AUDIO_FORMAT_PCM_16_BIT)
Processing format: 0x5 (pcmfloat) ==> Processing format: 0x5 (AUDIO_FORMAT_PCM_FLOAT)
Output device: 0x2 (SPEAKER) ==> Output device: 0x2 (AUDIO_DEVICE_OUT_SPEAKER)
Input device: 0 (NONE) ==> Input device: 0 (AUDIO_DEVICE_NONE)
AudioStreamOut: 0x... flags 0x6 (PRIMARY|FAST) ==>
AudioStreamOut: 0x... flags 0x6 (AUDIO_OUTPUT_FLAG_PRIMARY|AUDIO_OUTPUT_FLAG_FAST)

Test: make & run
Change-Id: I9cde640e6827b7aa6d62e9caade9e738227e299f
/frameworks/av/services/audioflinger/Threads.cpp
f2ae3e19080938db8cbf29a963fd744a3964fcc2 28-Oct-2016 Wei Jia <wjia@google.com> BatteryNotifier: attribute battery usage of video to correct uid.

Test: manual check batterystats
Bug: 32361950
Change-Id: Id052220e87f6667ca908d5bf6be6164dc8c14c53
/frameworks/av/services/audioflinger/Threads.cpp
9ee0540d3a61bff03d561ca431a371c3d9335d2b 14-Oct-2016 Mikhail Naganov <mnaganov@google.com> Remove last references to hardware/audio.h

DeviceHalInterface transitioned to "capabilities" model
(similar to the one already used by streams, e.g. 'supportsDrain').
No direct checking of the HAL version is needed.

AudioPolicy uses its own version read from the configuration,
and these values never checked against the actual HAL version,
thus it does not need versions and macroses from hardware/*.

Test: make & run on N6P
Change-Id: Ic4a56bfa19a9a61edac2b9f9a163fd8f63a0ff87
/frameworks/av/services/audioflinger/Threads.cpp
9fe94012187a29eeeca2c74e75f121192560fba0 14-Oct-2016 Mikhail Naganov <mnaganov@google.com> Split audio effects headers

There can be different use cases with the code that imports
headers from audio_effects (each subsequent case is a more
specialized version of the previous one):

1. The code only needs access to general structures
like effect_descriptor_t:
==> include system/audio_effect.h
Example: AudioSystem in libmedia

2. The code that needs access to effect UUID and parameter
enums:
==> include system/audio_effects/effect_foo.h
Examples: media framework effects interfaces, libwilhelm

3. The code that needs to call into HAL:
==> include hardware/audio_effect.h
Examples: libaudiohal (implementation part) and libeffects

4. The code that implements a particular effect:
==> include audio_effects/effect_foo.h
Examples: cts/.../CTSTestEffect.cpp
stuff in hardware/, vendor/

Note that AudioPolicy still deals with the effects HAL directly,
this needs to be fixed.

Change-Id: I963335ede6a196f9225caf21e1a01d03635e363c
Test: make
/frameworks/av/services/audioflinger/Threads.cpp
00260b5e6996b0a4b12f71c5b84e44adea040534 13-Oct-2016 Mikhail Naganov <mnaganov@google.com> Remove dependencies on hardware/audio_effects.h and EffectsFactoryApi.h

Also remove some outstanding dependencies on hardware/audio.h.

Most of the time, only constants and structs from audio_effects.h
are used, and no actual calls into HAL are made. Move these
definitions into system/audio_effect.h, and generate constants
from TREBLE HAL definition.

For parameters, always use values from AudioParameter class.

There are still some outstanding includes of hardware/audio.h
in code that directly deals with audio modules. Need to extend
libaudiohal interfaces to support required functionality.

Test: make

Change-Id: I0bcdf8ae199485d4d65f3eeb7e7a3b9b5cdb6ab6
/frameworks/av/services/audioflinger/Threads.cpp
473de569eed6438ee3eea955efe309900122f051 12-Oct-2016 Andy Hung <hunga@google.com> AudioFlinger: Improve effect compatibility with RAW and FAST am: d3bb0adfe4 am: 4a7ef5c1d7
am: 5bc5b90bbe

Change-Id: I681d68a632a527983972df160ba5dab1c50967cc
5bc5b90bbe3eae27c6de5a556eda531d4430dfab 12-Oct-2016 Andy Hung <hunga@google.com> AudioFlinger: Improve effect compatibility with RAW and FAST am: d3bb0adfe4
am: 4a7ef5c1d7

Change-Id: Ia7d516d957b0582ec6776d4306019e6f2dfc10c0
d3bb0adfe40e60bb94e9a87e8d5bffb4ea6863b0 12-Oct-2016 Andy Hung <hunga@google.com> AudioFlinger: Improve effect compatibility with RAW and FAST

Effects without process function now are allowed with RAW
and FAST playback and record tracks.

Bug: 32053844
Change-Id: I58064eb2c357043c2da1a781a20988f42570d97e
/frameworks/av/services/audioflinger/Threads.cpp
cbc8f617c1aebef5d041fa40dcd38a5466690b99 12-Oct-2016 Mikhail Naganov <mnaganov@google.com> Eliminate dependencies on hardware/audio.h (trivial cases)

frameworks/av must not depend on hardware/ (except for the code
from libaudiohal that actually calls into HAL).

This CL deals with simple cases where depending on system/audio.h
is enough.

Change-Id: Ia2cb66cc8c92316ce5ab884a008d5e531263c2e4
Test: make
/frameworks/av/services/audioflinger/Threads.cpp
a0c91339814f37ea78365afb436c9f3d1f0a0090 19-Sep-2016 Mikhail Naganov <mnaganov@google.com> Update NBAIO to use the new audio HAL abstraction layer

Moved the HAL access abstraction layer to a separate library so it
can be used both by audioflinger and libnbaio.

Bug: 30222631
Test: manual with Loopback app, Hangouts, YouTube

Change-Id: Id622c2f1aa8f55a775d34f369a596c2c4d29d5be
/frameworks/av/services/audioflinger/Threads.cpp
711ee66377eb053cd7a3467ca519239ebb7bf300 25-Sep-2016 Eric Laurent <elaurent@google.com> audioflinger: limit max number of tracks per client am: ad7dd9610b am: 6cfa8fdc9f
am: 5c24d28bfc

Change-Id: I3653bed5e0a0ef1476aa4409b256a8a81c6bc3fa
5c24d28bfc72423ff5bb6de3d46fe4747d9b64b1 23-Sep-2016 Eric Laurent <elaurent@google.com> audioflinger: limit max number of tracks per client am: ad7dd9610b
am: 6cfa8fdc9f

Change-Id: I1952387cd010a11ce9512a8b56a363cc4bb7a078
6cfa8fdc9f28dabe98c44e7317330f06f7a88813 23-Sep-2016 Eric Laurent <elaurent@google.com> audioflinger: limit max number of tracks per client
am: ad7dd9610b

Change-Id: I0dd67dfc1324cd4969561370faf105bcf7286949
7bafda7a153cda393ce018241fa7304845225ae5 23-Sep-2016 Eric Laurent <elaurent@google.com> Merge "audioflinger: limit max number of tracks per client" into nyc-mr1-dev
39ed2aa31b0c6c8e485660c2aedff74f10d14411 23-Sep-2016 Andy Hung <hunga@google.com> Add logging of written frame counts am: 2c45393d84
am: 6353f121d7

Change-Id: I3f569f4587c09f9f3f85d2466a3c742e2720b529
ad7dd9610b6fafa81baf69607f4ac669da88182a 22-Sep-2016 Eric Laurent <elaurent@google.com> audioflinger: limit max number of tracks per client

Limit max number of audio tracks for a given application to
limit the chance of denial of service by misbehaving apps
not releasing tracks.

Bug: 7007023
Change-Id: Id7ac37450aabdbeaa5f83cb6e4b2a2b0c749f99c
/frameworks/av/services/audioflinger/Threads.cpp
b54c854d1ef1bb66e093c94099f915178eac570e 21-Sep-2016 Andy Hung <hunga@google.com> Add logging of written frame counts

Bug: 31591209
Change-Id: Ife5917aa65b02c3b0791dfe1975c70ccf58f9a75
(cherry picked from commit 2c45393d842a5d2968ef78fa7a08667efdf15f2a)
/frameworks/av/services/audioflinger/Threads.cpp
2c45393d842a5d2968ef78fa7a08667efdf15f2a 21-Sep-2016 Andy Hung <hunga@google.com> Add logging of written frame counts

Bug: 31591209
Change-Id: Ife5917aa65b02c3b0791dfe1975c70ccf58f9a75
/frameworks/av/services/audioflinger/Threads.cpp
1dc98674f701dada94143b4d31b7221c58346c6c 19-Aug-2016 Mikhail Naganov <mnaganov@google.com> Abstract away access to audio streams HAL in AudioFlinger

In this CL all direct access to audio_stream_t, audio_stream_out_t, and
audio_stream_in_t their functions is encapsulated within the new
hierarchy of Stream[In|Out]HalLocal classes. AudioFlinger uses
interface classes Stream[In|Out]HalInterface to access these functions.

Note that NBAIO still receives raw HAL stream handles and needs to be
converted separately.

Bug: 30222631
Test: manual with Loopback app

Change-Id: I6388cfa2006791c9c0aa7bb186719209726a2d48
/frameworks/av/services/audioflinger/Threads.cpp
db0fd69d5dd2cb70009884458d5c78c9e7256c15 16-Sep-2016 Eric Laurent <elaurent@google.com> Merge commit '77b44035440f4dfc1c8d29da7d800f111ebe6376' into fix_merge

Change-Id: I0f1d2b605a8d90f86f8fa27cbf971018981c6c38
77b44035440f4dfc1c8d29da7d800f111ebe6376 16-Sep-2016 Eric Laurent <elaurent@google.com> audio flinger: add support for effects without process function am: 6dd0fd92d6
am: 79c3335e35

Change-Id: I719e0379c19d6e0e4e50597726f83b3a1d0b3cd8
6dd0fd92d6cdeb2cf5b7127c0e880e5eacfd4574 15-Sep-2016 Eric Laurent <elaurent@google.com> audio flinger: add support for effects without process function

Add support for effects indicating they do not implement a process
function and do not consume CPU or add latency.

Enable those effects on RAW and FAST outputs and inputs.
Do not call the process function.

Bug: 31491112.
Change-Id: If020c8bb3b180568dec5138b087edec8c2524182
/frameworks/av/services/audioflinger/Threads.cpp
1f12a380bef8aa162dec458cc7849e886815aeaa 14-Sep-2016 Mikhail Naganov <mnaganov@google.com> Merge "Fix RecordThread running too often if fast capture is active"
e4f1f63a2c54ee8687ad8cca18df0f6639ad7c81 31-Aug-2016 Mikhail Naganov <mnaganov@google.com> Abstract away access to audio devices HAL

In this CL all direct access to audio_hw_device_t and its functions is
encapsulated within the new class DeviceHalLocal. Loading of hardware
modules is encapsulated withing DevicesFactoryHalLocal. AudioFlinger
uses interface classes DevicesFactoryHalInterface and DeviceHalInterface
to access these functions.

Bug: 30222631
Change-Id: Ic88b20c55813a24b898f4a832e082c17d81935b7
/frameworks/av/services/audioflinger/Threads.cpp
1b291841a58ce6b2b291232dfdd56134b2185c48 18-Jul-2016 Glenn Kasten <gkasten@google.com> Fix RecordThread running too often if fast capture is active

Bug: 30159297
Change-Id: Ieca804450168391c162fc4862398586fcc5d7e4e
/frameworks/av/services/audioflinger/Threads.cpp
18e6e46cfa616c34095e269505121f5033312924 30-Aug-2016 Andy Hung <hunga@google.com> Do not park the FastMixer on AudioPatch changes am: f60abceac7 am: 927fefa85b
am: 85cda4dc02

Change-Id: Iabc962fec667ad2f77dfb2721cccb05e00adb2b2
85cda4dc026ca3ce8725202738b2deb24ce94829 27-Aug-2016 Andy Hung <hunga@google.com> Do not park the FastMixer on AudioPatch changes am: f60abceac7
am: 927fefa85b

Change-Id: I175e8ebb94c97638707480b1725cea9491ea9a98
f60abceac70c7a30dc2f888c4b80256b4a01a6dd 26-Aug-2016 Andy Hung <hunga@google.com> Do not park the FastMixer on AudioPatch changes

Can be turned on again by property af.patch_park.

Bug: 30952714
Change-Id: Id7f7750e28ecf950d110379309d18819e169e999
/frameworks/av/services/audioflinger/Threads.cpp
4e6ff4151f03c6b7211136b83e71fca34bbc402c 23-Aug-2016 Mikhail Naganov <mnaganov@google.com> audioflinger: Fix battery accounting for offload tracks am: e94c27a17f am: 7cba7beec4
am: e50af19356

Change-Id: I80e26985a69800d31b0aa9331bccdc0a91caa08b
e50af19356b852781a28233d50f06b7adde7d470 23-Aug-2016 Mikhail Naganov <mnaganov@google.com> audioflinger: Fix battery accounting for offload tracks am: e94c27a17f
am: 7cba7beec4

Change-Id: Id5d5b2e5ac25a167583243d84fd060698c18930f
e94c27a17fd56fd5ac63fc2de9df08cfcc80b1e3 19-Aug-2016 Mikhail Naganov <mnaganov@google.com> audioflinger: Fix battery accounting for offload tracks

Ensure that the list of wakelock UIDs is only cleared if
the offload playback wakelock is released during async completion
wait.

Bug: 30830106
Change-Id: Icf18b9e88e55c27bc03d8a904cc91f593cc95815
/frameworks/av/services/audioflinger/Threads.cpp
5ca8f32280377dd923e72c3c6bd3994217461b8b 11-Aug-2016 Chih-Hung Hsieh <chh@google.com> resolve merge conflicts of fd923e7 to stage-aosp-master am: df5d9246f9
am: 63ef5a38f8

Change-Id: I516a43c5e56323e99ad7a8ca2e4811b77c9704f4
df5d9246f9607b1c2f8b134c46a05af06e206da3 11-Aug-2016 Chih-Hung Hsieh <chh@google.com> resolve merge conflicts of fd923e7 to stage-aosp-master

Change-Id: I75b44b89bae41197a1fd68362d20b8ba2b4dd192
e964d4e421e2d1ca937227a580c0c837091a11e3 09-Aug-2016 Chih-Hung Hsieh <chh@google.com> Fix clang-tidy warnings in audio and playerservice.

* Add explicit keyword to conversion constructors.
Bug: 28341362
* Use const reference type for read-only parameters.
Bug: 30407689
Test: build with WITH_TIDY=1

Change-Id: I265f3b094e08d5705b506b3fbba51439c134af84
/frameworks/av/services/audioflinger/Threads.cpp
36d0ca16024820df9a12903d2ac443fabcc180bc 09-Aug-2016 Chih-Hung Hsieh <chh@google.com> Fix clang-tidy warnings in audio and playerservice.

* Add explicit keyword to conversion constructors.
Bug: 28341362
* Use const reference type for read-only parameters.
Bug: 30407689
Test: build with WITH_TIDY=1

Change-Id: I265f3b094e08d5705b506b3fbba51439c134af84
Merged-In: I265f3b094e08d5705b506b3fbba51439c134af84
/frameworks/av/services/audioflinger/Threads.cpp
b7809a709886c5dc58e737cd3c356579a088dc65 02-Aug-2016 Eric Laurent <elaurent@google.com> audioflinger: fix OutputTrack initial check am: af3ec7c9a0 am: 5271857554
am: 54efaa90a1

Change-Id: I7c4f4db022099abbcd20cdfb0971efa2d46998f6
54efaa90a110e50b1b9a5e4badaf30d494be56a0 02-Aug-2016 Eric Laurent <elaurent@google.com> audioflinger: fix OutputTrack initial check am: af3ec7c9a0
am: 5271857554

Change-Id: Icf61ce31fb83cc5796be5122c65b483437b17365
af3ec7c9a0cfc483017d4457e0e3d77de4b1a33a 01-Aug-2016 Eric Laurent <elaurent@google.com> audioflinger: fix OutputTrack initial check

Call initCheck() on newly created OutputTrack in
DuplicatingThread::addOutputTrack() to make sure that
the track is successfully attached to the AudioMixer.

Also make invalid track name always fatal in AudioMixer::deleteTrackName().

Bug: 29953737
Change-Id: I47f2517bd53de940e125391de99c40611ad0fc9d
/frameworks/av/services/audioflinger/Threads.cpp
57ef37350cd88ded7b83a2f4362fcbaab36f9372 29-Jul-2016 Andy Hung <hunga@google.com> Merge "Flush FastCapture PipeReader when starting after stop"
f2c7f0043f13a0317e343082d3dc2913d3699f70 29-Jul-2016 Andy Hung <hunga@google.com> Merge \\\"AudioFlinger: Account for frames dropped in suspend mode\\\" into nyc-mr1-dev am: f769ab76d1 am: 4166015417
am: 648bc951b8

Change-Id: I23516b04456b3d8f49c44ca42f4e62bd8dc134e4
6d988186ffa998a1e28251b3e655cfcbccca9db5 29-Jul-2016 Andy Hung <hunga@google.com> AudioFlinger: Account for frames dropped in suspend mode am: 238fa3deff am: ef0eed3d26
am: 5c42082da7

Change-Id: I9c51ed42c901c054fd25e7629725655d763ff390
648bc951b86860dd11463340029eaef4b4d90003 29-Jul-2016 Andy Hung <hunga@google.com> Merge \\"AudioFlinger: Account for frames dropped in suspend mode\\" into nyc-mr1-dev am: f769ab76d1
am: 4166015417

Change-Id: Ied8c294777ddf380876197fe620c8931e681deb5
5c42082da799fa6469321e621216922444678900 29-Jul-2016 Andy Hung <hunga@google.com> AudioFlinger: Account for frames dropped in suspend mode am: 238fa3deff
am: ef0eed3d26

Change-Id: I0790c3ac10654142856c9e252277fc3c7880b7c4
416601541797b132ee8abe1e1d15d773ad975ce5 29-Jul-2016 Andy Hung <hunga@google.com> AudioFlinger: Prevent offload underrun during active playback
am: f804475807

Change-Id: Iefc9c73590b5aede7ef3ee1a2eaf728bdd01113e
f929f9b203ef4787d45f8b24aab053aaab993be9 29-Jul-2016 Andy Hung <hunga@google.com> Merge "AudioFlinger: Prevent offload underrun during active playback" into nyc-mr1-dev
238fa3deff26d7e4d9e81bd0a88c936f16226c4e 28-Jul-2016 Andy Hung <hunga@google.com> AudioFlinger: Account for frames dropped in suspend mode

These frames must be added to the kernel position in timestamps.

Bug: 30025777
Change-Id: I30c14503c9467059c3782e5c96c01ae1cf3709f6
/frameworks/av/services/audioflinger/Threads.cpp
f804475807407442d5596ab7378ed07d50664063 27-Jul-2016 Andy Hung <hunga@google.com> AudioFlinger: Prevent offload underrun during active playback

Bug: 29897830
Change-Id: Id99d416cdaa8bf62daca8f92e3564f2895f15490
/frameworks/av/services/audioflinger/Threads.cpp
ad6d52d38917069e3d8e68cec1625855b9d96200 18-Jul-2016 Andy Hung <hunga@google.com> Flush FastCapture PipeReader when starting after stop

Discards stale frames.

Bug: 30199985
Change-Id: Ie93a3784bf052aba6989d2ff1be92b1980b0c207
/frameworks/av/services/audioflinger/Threads.cpp
b566e2ed097985da01d4218a3216b45049b25767 20-Jul-2016 Andy Hung <hunga@google.com> Merge \\"Only read timestamps from HAL if not FastCapture\\" into nyc-mr1-dev am: b5aac433cd
am: cbbb9a50d3

Change-Id: Ic983502e4b1802208deb3bd85cd537caa45314c9
cbbb9a50d30360794724a0eecc10fff726706cec 20-Jul-2016 Andy Hung <hunga@google.com> Merge \"Only read timestamps from HAL if not FastCapture\" into nyc-mr1-dev
am: b5aac433cd

Change-Id: I35220717ab32936421a8dc906c4af2cac979a5f5
b5aac433cda041c1fde2fcfadf1835f3f8d19eeb 20-Jul-2016 Andy Hung <hunga@google.com> Merge "Only read timestamps from HAL if not FastCapture" into nyc-mr1-dev
69ce44d164c7b9963c06cb96ea9d25cf99e069c9 18-Jul-2016 Andy Hung <hunga@google.com> Only read timestamps from HAL if not FastCapture

Prevents blocking FastCapture from the RecordThread

Bug: 29392543
Change-Id: Icd00534677be121bc4f4e9a7a6bd5b44f6f14f50
/frameworks/av/services/audioflinger/Threads.cpp
d7e04b3fe9f61fdba21116dd7c50b86979fe2497 18-Jul-2016 Eric Laurent <elaurent@google.com> Merge \\"AudioFlinger: fix offload volume on resume\\" into nyc-mr1-dev am: cecb30a22f
am: 97a480927d

Change-Id: I00f8643d420ab63ce63658aebb98794c7517958c
97a480927d83e4d79ec915a86262ac3489377bff 18-Jul-2016 Eric Laurent <elaurent@google.com> Merge \"AudioFlinger: fix offload volume on resume\" into nyc-mr1-dev
am: cecb30a22f

Change-Id: I7c4165affd590a4f43d631006e02f92bc4fd0a9e
cecb30a22f3657483f07f259231b81b02b2a7305 18-Jul-2016 Eric Laurent <elaurent@google.com> Merge "AudioFlinger: fix offload volume on resume" into nyc-mr1-dev
3df841a10b4d553949c518ad52f1af8dcb365058 16-Jul-2016 Eric Laurent <elaurent@google.com> AudioFlinger: fix offload volume on resume

Make sure that new volume is sent to audio effects and HAL
immediately upon resuming playback on direct and offload threads.

Also make sure that only the latest active track on thread controls
volume.

Bug: 30057465
Change-Id: I846958b4aae5abd3740b8a2545b57bd8f3614031
/frameworks/av/services/audioflinger/Threads.cpp
8221d9e855909c8e097f5f0e986755baca4dd1b7 15-Jul-2016 Glenn Kasten <gkasten@google.com> Distinguish systrace timelines for playback and capture am: f9715e43ea
am: 78f9c3ad66

Change-Id: If66bafab6f0cd2aa1f5478b963faec0632f297ca
78f9c3ad666d832d423550ded32f3626abbe6e28 15-Jul-2016 Glenn Kasten <gkasten@google.com> Distinguish systrace timelines for playback and capture
am: f9715e43ea

Change-Id: I67d7f23998c10a554d53cea37ad443ca1fad3f6f
f9715e43ea73361321663514c44129c939c5db2f 13-Jul-2016 Glenn Kasten <gkasten@google.com> Distinguish systrace timelines for playback and capture

Bug: 30120068
Change-Id: If416540f0785e83e7b1e8ba986ee55b5b9298a2a
/frameworks/av/services/audioflinger/Threads.cpp
8da2d981fb78fd75f9d0d2cab9c23fb651be334d 14-Jul-2016 Eric Laurent <elaurent@google.com> Merge \\"AudioFlinger: fix capture stop sequence\\" into nyc-mr1-dev am: a5bcf56619
am: d7fdb3b5c3

Change-Id: Icd9355083c77ae2e0b7fb2ed12d675105483d3dd
d7fdb3b5c3f8eca33b7462cc46093752d47203c1 14-Jul-2016 Eric Laurent <elaurent@google.com> Merge \"AudioFlinger: fix capture stop sequence\" into nyc-mr1-dev
am: a5bcf56619

Change-Id: I17cde8f3113d5371e24ce1d4adafa2413752b0e3
a5bcf56619a70b0b46c737a29d873bbff8fb77a4 14-Jul-2016 Eric Laurent <elaurent@google.com> Merge "AudioFlinger: fix capture stop sequence" into nyc-mr1-dev
5c25d5637ef3406883e0fc97a713f9d5cdca426f 14-Jul-2016 Eric Laurent <elaurent@google.com> AudioFlinger: fix capture stop sequence

Make sure that the HAL input stream is actually in standby when audio policy
is notified by stopInput().
There was a race condition where it was possible for a new capture stream to be started
in the interval between stopInput() notification and input stream going into
standby because of the state update and sleep sequence in the record thread loop.

Also make sure we interrupt the sleep period if a command is pending.

Bug: 29865791
Change-Id: Ife720fbd2e5d0df8792669dc724b1fd70f63ab8a
/frameworks/av/services/audioflinger/Threads.cpp
4099f1a290c4b7980681afa7ba562e6c2450380e 12-Jul-2016 Eric Laurent <elaurent@google.com> Merge \\"audioflinger: async callback error handling\\" into nyc-mr1-dev am: 93540a6b59
am: 6a7f864490

Change-Id: I289e192efe71c599229a10771a08d8685a75dd57
6a7f864490766020ef791d6c803364fdb7e79cbb 12-Jul-2016 Haynes Mathew George <hgeorge@codeaurora.org> Merge \"audioflinger: async callback error handling\" into nyc-mr1-dev
am: 93540a6b59

Change-Id: Ifa8e386c0da9e30b90884e0a787e581ace151c64
93540a6b596b1660a453d344573571462a7e6587 12-Jul-2016 Eric Laurent <elaurent@google.com> Merge "audioflinger: async callback error handling" into nyc-mr1-dev
bbe0cfb249f872fe68215fd1baa7d6426aef2d16 12-Jul-2016 Jean-Michel Trivi <jmtrivi@google.com> Merge \\"Fix non-offloadable effect creation on offload threads\\" into nyc-mr1-dev am: b28d6117a5
am: 8611d5135b

Change-Id: I038d377d8489b95f6eb119f27fd968e97bd83b14
8611d5135b6a62cc4bbf89404090c9f6ac3245f5 12-Jul-2016 Jean-Michel Trivi <jmtrivi@google.com> Merge \"Fix non-offloadable effect creation on offload threads\" into nyc-mr1-dev
am: b28d6117a5

Change-Id: I273585d967945cadddcd70d10514dabb64b1f2e3
4527b9ebc6a37b861f5a3bba68bcc63dc8d69ada 08-Jul-2016 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: async callback error handling

Invalidate all tracks on receiving an async error
callback from the output stream.

Change-Id: I92f441ed7fd904b85f464a041847880faac5b383
/frameworks/av/services/audioflinger/Threads.cpp
773ee957aadbe86ee53ac96a108ce47f8e02b961 12-Jul-2016 Jean-Michel Trivi <jmtrivi@google.com> Fix non-offloadable effect creation on offload threads

Do not prevent the creation of non-offloadable effects on
offload threads.

Bug 29229872

Change-Id: I1deebb5c0973f67a9e925ef1278d22ef7f62c779
/frameworks/av/services/audioflinger/Threads.cpp
d82bd98d0dd8bfa792d7e5223eb3a266d132f2b0 07-Jul-2016 Andy Hung <hunga@google.com> Merge \\"Attribute throttle time to previous loops write time\\" into nyc-mr1-dev am: bf6dc1af5b
am: 4b06aec0d4

Change-Id: I2c1362d5544c73934bc5b1b7c402d4371a09ba6f
4b06aec0d4ce89859c0376096fdffeec50c65c2f 07-Jul-2016 Andy Hung <hunga@google.com> Merge \"Attribute throttle time to previous loops write time\" into nyc-mr1-dev
am: bf6dc1af5b

Change-Id: I4bc857144d49760097f7344c1d58ad7444b66548
bf6dc1af5bd88135f47c2489c03cdb9f95d57927 07-Jul-2016 Andy Hung <hunga@google.com> Merge "Attribute throttle time to previous loops write time" into nyc-mr1-dev
0a31dddf67e739684f60aecc85311ff446fb68f9 07-Jul-2016 Andy Hung <hunga@google.com> Attribute throttle time to previous loops write time

Bug: 29991292
Change-Id: Ie3ecc9631e1dfa83fafc7b003495f59e981a0b6b
/frameworks/av/services/audioflinger/Threads.cpp
6217c5233ad77f8e8f22f2b54edf8b6271275f09 30-Jun-2016 Eric Laurent <elaurent@google.com> Merge \\"audioflinger: fix logcat\\" into nyc-mr1-dev am: bb3bee86d5
am: bde5acd3a3

Change-Id: Ie443e96b8231b3fff5773253e7886fe7f5c42150
bde5acd3a31b19a73e6877309ce3de27b211855a 30-Jun-2016 Eric Laurent <elaurent@google.com> Merge \"audioflinger: fix logcat\" into nyc-mr1-dev
am: bb3bee86d5

Change-Id: I1b5e4c626d686379c570316181c020c5e16aa378
122f7e793fe6fb8904634cc6d2e35ac4b014ea72 29-Jun-2016 Eric Laurent <elaurent@google.com> audioflinger: fix logcat

Fix build when verbose logging is enabled in Threads.cpp.
Remove log spam for timestamp errors.

Change-Id: I704527c60e48012c5dcc00cb0be08d14ec2ab2a6
/frameworks/av/services/audioflinger/Threads.cpp
9ab9f6219a0274bed6a8d64169ab695ef77d29de 06-May-2016 Andy Hung <hunga@google.com> Remove throttle logcat for bluetooth

Due to reduced buffer sizes for bluetooth it is possible to throttle
regularly, do not logcat throttle for bluetooth to avoid spamming.

Bug: 28286313
Change-Id: I9a572077a58c8e5cce3d5ac4de3cc6d97d94d7a0
/frameworks/av/services/audioflinger/Threads.cpp
516b743f3c19f38816ecdead90ae74bc1b3c84e4 21-Jun-2016 Eric Laurent <elaurent@google.com> audioflinger: add check for effect vs thread compatibility am: 4c415062ad
am: ad67b138fc

Change-Id: I38015a85b7df2d620daa2c9e5d7435de510a8fbe
ad67b138fcec25ba99254e826c559778adf0e7f3 21-Jun-2016 Eric Laurent <elaurent@google.com> audioflinger: add check for effect vs thread compatibility
am: 4c415062ad

Change-Id: Idbdb7591b291c09ced94d4eabae0edc3581e1bcd
4c415062ad1bb53e9af8f644d8215837262b79bb 18-Jun-2016 Eric Laurent <elaurent@google.com> audioflinger: add check for effect vs thread compatibility

Make sure that only HW accelerated effects are added on FAST
playback or record threads and no effect is added on threads with
RAW flag.

Make sure that tracks with RAW and FAST flags are compatible with exiting
effects on a playback or record threads and clear flags accordingly.

Bug: 4999001

Change-Id: I0c060f1ee4dfb9f1e206633536e67f7c3b7b3788
/frameworks/av/services/audioflinger/Threads.cpp
4cfa355eedae56e047b63b1b02fc6d789e21980d 04-Jun-2016 Eric Laurent <elaurent@google.com> Merge "Add AudioTrack and AudioRecord flag checks" into nyc-mr1-dev am: 2f8e63b5be
am: b70868bb33

* commit 'b70868bb337f0b12f993494f4d110979a33ddd24':
Add AudioTrack and AudioRecord flag checks

Change-Id: Ia6ab9998dcaa065d18fc048ae5ea6bb3e087ba62
b70868bb337f0b12f993494f4d110979a33ddd24 04-Jun-2016 Eric Laurent <elaurent@google.com> Merge "Add AudioTrack and AudioRecord flag checks" into nyc-mr1-dev
am: 2f8e63b5be

* commit '2f8e63b5be5b0160302cffe1f1f18e560d31d3e7':
Add AudioTrack and AudioRecord flag checks

Change-Id: If9043721f4763ce0f4db96c63595f92c5ba22556
050677873c10d4da308ac222f8533c96cca3207e 02-Jun-2016 Eric Laurent <elaurent@google.com> Add AudioTrack and AudioRecord flag checks

Verify that the requested flags are compatible with the input
or output flags when creating and AudioRecord or AudioTrack

Get rid of IAudioFlinger::track_flags_t which was redundant
with audio_input_flags_t and audio_output_flags_t.

Change-Id: I0dd9232f857b2737e99a8c668806e45bce09cdbd
/frameworks/av/services/audioflinger/Threads.cpp
8a4348bb7a598eab9b692d782595689112df367a 25-May-2016 Andy Hung <hunga@google.com> resolve merge conflicts of 5d8e380 to nyc-mr1-dev am: b09a6d0832
am: 6b0a8693e1

* commit '6b0a8693e169a97f5fd92260bcbd437b514d7691':
AudioTrack: Fix timestamp startup condition

Change-Id: Ie11abf463d4ca8b065fffc66bfb1c4db37a3ca4c
6b0a8693e169a97f5fd92260bcbd437b514d7691 25-May-2016 Andy Hung <hunga@google.com> resolve merge conflicts of 5d8e380 to nyc-mr1-dev
am: b09a6d0832

* commit 'b09a6d08321b9484d80a2a9dc11ed52623942c8d':
AudioTrack: Fix timestamp startup condition

Change-Id: Id2c883949a47daac936266310ebe4d69a5965eb3
b09a6d08321b9484d80a2a9dc11ed52623942c8d 25-May-2016 Andy Hung <hunga@google.com> resolve merge conflicts of 5d8e380 to nyc-mr1-dev

Change-Id: Ic3aacd191cae0749bb33fe9ccfdac743ff82a21f
8572ee135c9af5aacf74f02dd3ce8e9eb3956ec4 25-May-2016 Andy Hung <hunga@google.com> Merge "AudioTrack: Fix timestamp startup condition" into nyc-dev
am: 5d8e3808b4

* commit '5d8e3808b4012fa72bedf5898803682831f88e84':
AudioTrack: Fix timestamp startup condition

Change-Id: Ibc54738fb4beee0db7559e5b9f76910d639e966f
69488c4ef115c9de52c85f4fcae27c7774720298 17-May-2016 Andy Hung <hunga@google.com> AudioTrack: Fix timestamp startup condition

Suppress timestamps without valid kernel information or
a server update.

Update timing of server timestamp location to better indicate
when the server pull occurs.

Update write timing logic to suppress unneeded time calls
and to ensure proper throttling.

Bug: 28771691
Change-Id: I2cd25dad638ca1d0b1355d87d175d908f3bddb26
/frameworks/av/services/audioflinger/Threads.cpp
791fce20ee88597ea7cd64cc728010088a2e7a8f 24-May-2016 Chih-Hung Hsieh <chh@google.com> resolve merge conflicts of 53529cf to nyc-dev-plus-aosp am: 4d1522bdc7
am: a15b56e484

* commit 'a15b56e48406d8242e91629e748a1b90d5977381':
Fix misc-macro-parentheses warnings.

Change-Id: I5fcae0f83f1f6820ec8da61c46e778e30353195f
a15b56e48406d8242e91629e748a1b90d5977381 24-May-2016 Chih-Hung Hsieh <chh@google.com> resolve merge conflicts of 53529cf to nyc-dev-plus-aosp
am: 4d1522bdc7

* commit '4d1522bdc7efaa9677ac92b620cea9e9110ec2a4':
Fix misc-macro-parentheses warnings.

Change-Id: Id828c632b701e19de541fab868484ae3d4bfab45
4d1522bdc7efaa9677ac92b620cea9e9110ec2a4 24-May-2016 Chih-Hung Hsieh <chh@google.com> resolve merge conflicts of 53529cf to nyc-dev-plus-aosp

Change-Id: Iae19c31b9ce2d9c604040e54d6fbf125a3d3d362
bf29173d6d63536ae9f8cfd1d02153237ee23612 18-May-2016 Chih-Hung Hsieh <chh@google.com> Fix misc-macro-parentheses warnings.

Bug: 28705665
Change-Id: I97d1dec9a4397fd7a3cab5180a833066b8abe0ab
/frameworks/av/services/audioflinger/Threads.cpp
2ffd63e2b6762e9cbd0eff2c0fdd8297ba9e5393 17-May-2016 Eric Laurent <elaurent@google.com> audioflinger: fix invalidateTracks() on offload thread am: 1308462107 am: 514d8c512d
am: a043ba313b

* commit 'a043ba313b68a7e6694b17faaca7f10dd4e5f1d2':
audioflinger: fix invalidateTracks() on offload thread

Change-Id: Ica11f6f42cdfbadc63ffd665410f483da0b1b2da
a043ba313b68a7e6694b17faaca7f10dd4e5f1d2 17-May-2016 Eric Laurent <elaurent@google.com> audioflinger: fix invalidateTracks() on offload thread am: 1308462107
am: 514d8c512d

* commit '514d8c512d08824b288fa1784b33a294b0f7e81d':
audioflinger: fix invalidateTracks() on offload thread

Change-Id: I659f616463f5df569b958e8c6178a1f1da006839
57fc788e8c924823c9026f1239282d39433da821 17-May-2016 Eric Laurent <elaurent@google.com> audioflinger: fix invalidateTracks() on offload thread
am: 1308462107

* commit '13084621072ea2e4c34e2a9d79793c621d9bf005':
audioflinger: fix invalidateTracks() on offload thread

Change-Id: Ib4f9306ababd292b71d4a5026bc157ef40e61120
13084621072ea2e4c34e2a9d79793c621d9bf005 17-May-2016 Eric Laurent <elaurent@google.com> audioflinger: fix invalidateTracks() on offload thread

Commit 05317d29 introduced a regression causing a systematic flush
on offload output thread when invalidateTracks() is called even if
no track is using the stream type specified.

Bug: 28786996
Change-Id: Iee393ee8b1093c40647235bd35f4a6fa9b62937a
/frameworks/av/services/audioflinger/Threads.cpp
ea2bf087bc6d1f9e9e0e5242f0d29d1498845879 12-May-2016 Haynes Mathew George <hgeorge@codeaurora.org> Merge "audioflinger: update multiplier logic to calculate frameCount" into nyc-mr1-dev am: 64a253562a
am: b7bcb3c46f

* commit 'b7bcb3c46f0501a214329509d912908a85646d49':
audioflinger: update multiplier logic to calculate frameCount

Change-Id: I60f4d2b2493cf6f93e70624c35a29f07c82b660b
c77ce274f1f8355ccddb6d8b1c5f589922573f7b 12-May-2016 Haynes Mathew George <hgeorge@codeaurora.org> Merge "audioflinger: Update throttling logic in MixerThread" into nyc-mr1-dev am: 86c54273d0
am: 1e6323fa09

* commit '1e6323fa092f51fad8ee5f563780dba1d62a1f5a':
audioflinger: Update throttling logic in MixerThread

Change-Id: I85cab0203af31bd8de1f645293fc3b182d88023d
ca8e6805991c0c058c3d6315556c7612d663edab 12-May-2016 Eric Laurent <elaurent@google.com> Merge "audioflinger: various offload playback fixes" into nyc-dev am: 8b43838c48 am: d9e1a02f39
am: 9d0956cf44

* commit '9d0956cf445b6839ebba3b81d33c8e8289dd086f':
audioflinger: various offload playback fixes

Change-Id: I3455daba5e1d154bab7cbf4a44e64388212ae07b
64a253562a0521f5f0b3205dae98367102ebe532 12-May-2016 Glenn Kasten <gkasten@google.com> Merge "audioflinger: update multiplier logic to calculate frameCount" into nyc-mr1-dev
86c54273d035ff1ee6efab1a56766f883e1c98f7 12-May-2016 Glenn Kasten <gkasten@google.com> Merge "audioflinger: Update throttling logic in MixerThread" into nyc-mr1-dev
e93cc03da360a1a0d2ad937c745ce8c8e8be81c2 05-May-2016 Eric Laurent <elaurent@google.com> audioflinger: various offload playback fixes

Revert underrun sleep time optimization added for
offload by commit 51716185 which can cause music to pause for a few
seconds in some corner cases.

Allow underruns in STOPPING_1 state to avoid dropping last buffer
received by the AudioTrack callback after stop() is called by the
client.

Allow interruption of thread loop sleep if a command is pending to
speed up track start sequence.

Do not wait for a full AudioTrack buffer before writing to audio HAL
when resuming playback or transitioning to next track.

Also moved log level for underruns in AudioSink from I to D to reduce
spam on user builds.

Bug: 28545177
Bug: 27682362
Bug: 28347796

Change-Id: I05b651b7878a2d2eedcac43cd669e32add171d40
/frameworks/av/services/audioflinger/Threads.cpp
227a14be87e8c63eb7a464b857a1d29c86c90e7c 09-May-2016 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: update multiplier logic to calculate frameCount

If the value of the multiplier used in calculating
mNormalFrameCount is odd, it is rounded off to a higher even value.

This results in an increase of mNormalFrameCount and thereby
the latency which is not expected.

Do not prefer an even multiplier and let the value remain as is
even if it is odd.

Bug: 25740205

authored-by: Satya Krishna Pindiproli<satyak@codeaurora.org>

Change-Id: Ia60d87d01caef6f45998bffeafc3d6a24f7c7fb4
/frameworks/av/services/audioflinger/Threads.cpp
f92b2175cd4a8d0fa9aca6e660ed4e85f6b7078b 09-May-2016 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: Update throttling logic in MixerThread

The throttling logic in MixerThread only keeps track of
time spent during sink write. However, on low tier
APs and with high sample rate tracks, it is possible
that time spent in mixing the tracks is significant.
This inturn leads to sink writes returning earlier than
expected kicking in (incorrectly) the throttling logic.

To fix this, update throttling logic to include
the time spent in mixing buffers along with the time
spent in sink write.

authored-by: Dhananjay Kumar <dhakumar@codeaurora.org>

Bug: 28672515
Change-Id: Iac4994c3084850bb93640c978b4a519db8d7951d
/frameworks/av/services/audioflinger/Threads.cpp
c3afc78811e976a2aa8204a9b8147e9fee5868c7 10-May-2016 Andy Hung <hunga@google.com> Merge "Improve timestamp jitter fix" into nyc-dev am: 5adc73643f am: 2815769b9f
am: bd46093e09

* commit 'bd46093e09879ef207105d53d8221c24bfce5da0':
Improve timestamp jitter fix

Change-Id: I8672b654c0649429871aae697c168308a7fce0bc
6d7b119a416c9f10288051e562f294365e5d954c 08-May-2016 Andy Hung <hunga@google.com> Improve timestamp jitter fix

Use last valid kernel timestamp on server side, not client side.

Bug: 28465713
Change-Id: I33590d6922980f288355f947bc56279245058429
/frameworks/av/services/audioflinger/Threads.cpp
d36e5779ca922925e96a544bbb5ae790e8a5d2fe 06-May-2016 Andy Hung <hunga@google.com> Merge "Remove throttle logcat for bluetooth" into nyc-dev am: 823b18ef45 am: f6ef1a972d
am: 43c8a40899

* commit '43c8a4089937865b6cdebf25eeb8551a10f23026':
Remove throttle logcat for bluetooth

Change-Id: I5be66bc7c9dc8ac609745487ad7ba9a74e556d04
823b18ef45f0593386d9d5d20fbf9a0379ad0ebb 06-May-2016 Andy Hung <hunga@google.com> Merge "Remove throttle logcat for bluetooth" into nyc-dev
3ea004dd80c06c5b366e1a2547ea9b28fffc1865 06-May-2016 Andy Hung <hunga@google.com> Remove throttle logcat for bluetooth

Due to reduced buffer sizes for bluetooth it is possible to throttle
regularly, do not logcat throttle for bluetooth to avoid spamming.

Bug: 28286313
Change-Id: I9a572077a58c8e5cce3d5ac4de3cc6d97d94d7a0
/frameworks/av/services/audioflinger/Threads.cpp
be3d5d5671fd2c38baa5d66bfc0775c54af06740 05-May-2016 Haynes Mathew George <hgeorge@codeaurora.org> Merge "audioflinger: set flush pending on invalidating offload track" into nyc-dev am: 0c43cb3a98 am: 08686471b0
am: 9ec791f42a

* commit '9ec791f42a68887114a67a880ba1c73e6497ae1a':
audioflinger: set flush pending on invalidating offload track

Change-Id: I671e9facbdf952a6b854a7f8c311802f8246f04b
05317d29b27e5fda654bea21b80d4423a03f49b3 04-May-2016 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: set flush pending on invalidating offload track

On invalidating an offload track, the IAudioTrack instance is
destroyed and the offload output is released. If it so happens
that APM::getOutputForAttr for the new IAudioTrack is called before
OffloadThread::prepareTracks_l checks and removes an invalid track,
the same output can get reused.

The side effect of this is data present in HAL and below from before the
invalidate will be rendered before data from the new seek position
is rendered. This is unexpected.

To fix this, set hint to issue flush when an offload track is invalidated.

Bug: 28566885
Change-Id: Ib6c38a3abb600598b87591bac90d03b7150d5216
/frameworks/av/services/audioflinger/Threads.cpp
9d9138534bb1736b662b31025b0e412273269684 29-Apr-2016 Glenn Kasten <gkasten@google.com> Merge "Can now indicate the desired number of notifications (sub-buffers)" into nyc-dev am: d0389b874d am: c03ab34de0
am: aba26a54a8

* commit 'aba26a54a8b007fafca3772082c0db5e43e16aec':
Can now indicate the desired number of notifications (sub-buffers)

Change-Id: I5650eb7f47e4daccdd068950146601c98e44ea39
d0389b874d592b960bdc456c2514a36b082c2c94 29-Apr-2016 Glenn Kasten <gkasten@google.com> Merge "Can now indicate the desired number of notifications (sub-buffers)" into nyc-dev
c7285abd573c046250c3bf03b5720d3a2bf55eb0 29-Apr-2016 Glenn Kasten <gkasten@google.com> Make max fast tracks configurable using a property am: dc2c50bad4 am: 3b2d92e2ec
am: 3b5f5f51b5

* commit '3b5f5f51b51439b60ac46ec07bb6bb03525a908e':
Make max fast tracks configurable using a property

Change-Id: Ie3a015ffd5638cf4ea353ad14863ff1a09858daf
ea38ee7742e799b23bd8675f5801ef72f94de0f4 18-Apr-2016 Glenn Kasten <gkasten@google.com> Can now indicate the desired number of notifications (sub-buffers)

per fast track buffer when using the default buffer size.

There is no change for normal tracks, or fast tracks with a non-default buffer size.

Also fix related bugs:
Notification period was not set correctly when fast multiplier is not 1.
Incorrect warning when client adjusted notification frames.

Bug: 27819623
Bug: 28117362
Change-Id: Ifc2121e874f51718cd56ec04e4bd5f89f4963132
/frameworks/av/services/audioflinger/Threads.cpp
dc2c50bad491d2c0c8a2efc0e24491076701c63c 21-Apr-2016 Glenn Kasten <gkasten@google.com> Make max fast tracks configurable using a property

ro.audio.max_fast_tracks

Rename the currently configured maximum number of fast tracks
from FastMixerState::kMaxFastTracks to FastMixerState::sMaxFastTracks.

There is no guarantee that the CPU will be able to handle
the configured number of fast tracks.

Bug: 27564141
Change-Id: If9af226d839b226503488c3cb20a4bb8950b429d
/frameworks/av/services/audioflinger/Threads.cpp
6a3b25f04f04ec9bb4133042af431a810dc70868 20-Apr-2016 Glenn Kasten <gkasten@google.com> Merge "Add AudioSystem::getFrameCountHAL()" into nyc-dev am: eb7f394004 am: 5fb71f6247
am: b137e82406

* commit 'b137e8240624e363951bcd3a42cb5d68b7622513':
Add AudioSystem::getFrameCountHAL()

Change-Id: Iab15db51b03e80e39d6711d46967995fb796a2f3
4a8308b11b92e608cdaf29f73f7919e75706f9a2 18-Apr-2016 Glenn Kasten <gkasten@google.com> Add AudioSystem::getFrameCountHAL()

And add comments about declaring methods in binder opcode order.

Bug: 28117362
Change-Id: I3c4426fa4bb3ce9c4a207a44d3bb1103d7fef160
/frameworks/av/services/audioflinger/Threads.cpp
8c797481a10ada8b678fd831feebcf68c787dacc 12-Apr-2016 Glenn Kasten <gkasten@google.com> Fix audio tee sink debugging tool am: fc302fd
am: aaf2475

* commit 'aaf2475680709d665a194832f2713ced15ac7cd3':
Fix audio tee sink debugging tool

Change-Id: I844ff35140bf17567192fddb03a11250fd69d545
fc302fd9e2d2cbafef771de77c47799488e1c044 11-Apr-2016 Glenn Kasten <gkasten@google.com> Fix audio tee sink debugging tool

Bug: 28119692
Change-Id: Ieb7b41754fab0111602dd29b63b0fd8c9c4b4d2d
/frameworks/av/services/audioflinger/Threads.cpp
0df20cfb9fdbf756c9339c2fad610a179754e021 02-Apr-2016 Eric Laurent <elaurent@google.com> Merge "audioflinger: fix offload underrun sleep logic" into nyc-dev am: eebc3ad
am: 707e11c

* commit '707e11cfd5aed5b035ba6ba0954de1c2b4a820c2':
audioflinger: fix offload underrun sleep logic

Change-Id: I713eb483d25a0ce0c46ca9bdf78217294473f589
eebc3ad457d5b9a1acc0fe0393b770004016a014 02-Apr-2016 Eric Laurent <elaurent@google.com> Merge "audioflinger: fix offload underrun sleep logic" into nyc-dev
3eaf66b860f9a0d8af0dd4d5ac6adb5b67d7b73a 01-Apr-2016 Eric Laurent <elaurent@google.com> audioflinger: fix offload underrun sleep logic

Do not sleep in case of underrun if not enough data has been
sent to the audio HAL since last flush or standby.

Bug: 27898813
Change-Id: Ic44bed97c7397ec1156d4fe9026c4fa9f00d651c
/frameworks/av/services/audioflinger/Threads.cpp
356e0b99303c04b43e609755b683e1a03225078c 01-Apr-2016 Eric Laurent <elaurent@google.com> Merge "audioflinger: keep wakelock during offload playback" into nyc-dev am: c526e1e
am: 1719e8f

* commit '1719e8ffa0b44e72b3d44a98f0340613949bc04a':
audioflinger: keep wakelock during offload playback

Change-Id: I4bfe4dff0cf363d48ead2335bff1cfd3a677447b
c526e1ef36f8f0520a059c6cf304e12e86170c26 01-Apr-2016 Eric Laurent <elaurent@google.com> Merge "audioflinger: keep wakelock during offload playback" into nyc-dev
3a5ea10722790d961237a68f1704b33845664c10 01-Apr-2016 Jean-Michel Trivi <jmtrivi@google.com> Merge "Ignore ro.audio.silent property when playing on REMOTE_SUBMIX" into nyc-dev am: 601b5a5
am: 1a15a10

* commit '1a15a1048c8a99ae812bc2d0bd617ead8d924387':
Ignore ro.audio.silent property when playing on REMOTE_SUBMIX

Change-Id: Ic5ab1ea7923ebef344a72098db7329f9be24a0f0
32f37c22f60b7a1a6ccfa351700f80c03918d4fe 01-Apr-2016 Jean-Michel Trivi <jmtrivi@google.com> Ignore ro.audio.silent property when playing on REMOTE_SUBMIX

Ignore the effect of the ro.audio.silent property for playback
threads playing on AUDIO_DEVICE_OUT_REMOTE_SUBMIX as playing
in those mixes doesn't make a sound.

Bug 27336527

Change-Id: I933cfed29cd72636fd33282e5f2ad05693688b83
/frameworks/av/services/audioflinger/Threads.cpp
646679779a8f952980a5d4219ad9c6f93efc4b92 31-Mar-2016 Eric Laurent <elaurent@google.com> audioflinger: keep wakelock during offload playback

Add a system property ro.audio.offload_wakelock to select
if a wakelock should be kept during offload playback while waiting for
write completion callback.
The default is yes, keep the wakelock.

On some platforms, the cost of entering or exiting suspend is so high
that is it better to not release a wakelock at all rather than releasing
it periodically.

Bug: 26208297
Change-Id: Ib41c7e4ed9c8c0c063363eb9fe99a2ecc81b521b
/frameworks/av/services/audioflinger/Threads.cpp
0e8d86c5a0eb6ded973649795d3b0e0c75870db5 29-Mar-2016 Andy Hung <hunga@google.com> Merge "Fix FastTrack creation buffer count irregularity" into nyc-dev am: 0be3be0
am: 994ea26

* commit '994ea268043e476c1f4e5dbd57d55d6114f59eb8':
Fix FastTrack creation buffer count irregularity
0be3be0cf5530d6faf655c325ec9d94a2bd53564 29-Mar-2016 Andy Hung <hunga@google.com> Merge "Fix FastTrack creation buffer count irregularity" into nyc-dev
fda6504ae3ee3ebbe1b85c7e249dd771d5962a7c 25-Mar-2016 Haynes Mathew George <hgeorge@codeaurora.org> Park FastCapture in HOT_IDLE while processing new parameters am: 9ce67b5
am: 9f9d824

* commit '9f9d8241f72ff01072561ead51b2b0e3d5ce6475':
Park FastCapture in HOT_IDLE while processing new parameters
9ce67b524236db52eadf558e7765775acad89f1f 30-Sep-2015 Haynes Mathew George <hgeorge@codeaurora.org> Park FastCapture in HOT_IDLE while processing new parameters

Without this, FastCapture can starve RecordThread delaying
handling of new parameters.

Bug: 24667895
Change-Id: Idb7113b7b0f96f2c35c655b6fdb3279f119ad1a3
/frameworks/av/services/audioflinger/Threads.cpp
ac4dacc0ba7384f86ccfa2feb8f0d78d96d42dc8 25-Mar-2016 Glenn Kasten <gkasten@google.com> Merge "Add AutoPark template class and use to control FastMixer" into nyc-dev am: c1c545a
am: d210059

* commit 'd2100593a01b4a36745b394b649e027a125513cc':
Add AutoPark template class and use to control FastMixer
c05b8d7df46619d3474356241d47655478b8bc82 24-Mar-2016 Glenn Kasten <gkasten@google.com> Add AutoPark template class and use to control FastMixer

Bug: 24667895
Change-Id: Id739a109aca13664b9390d2f9d9616fa2f88d188
/frameworks/av/services/audioflinger/Threads.cpp
e0a269a5f75956efdf78a9cacaefc428b352730c 23-Mar-2016 Andy Hung <hunga@google.com> Fix FastTrack creation buffer count irregularity

For small values of buffer framecount, AudioFlinger may create a
normal track.

Bug: 27817933
Change-Id: I7c69491fc1f2b204e14286fb4c2210c5983afb8b
/frameworks/av/services/audioflinger/Threads.cpp
59aa43931103cebb833cb9316c5b7e9011191d33 21-Mar-2016 Glenn Kasten <gkasten@google.com> Merge "Fix build warnings" into nyc-dev am: 311fab5
am: 7b81b7e

* commit '7b81b7e026053615f93af1efc130205eef547e57':
Fix build warnings
c42e9b462661673dff480ee71757a58b0f806370 21-Mar-2016 Glenn Kasten <gkasten@google.com> Fix build warnings

Change-Id: Idfdaff3a7a8f60cd8817bd306bfba28020a391c8
/frameworks/av/services/audioflinger/Threads.cpp
638d4c21fa86e6e525eee1e7cc14eca018658f8b 19-Mar-2016 Glenn Kasten <gkasten@google.com> Merge "Fix build warnings" into nyc-dev am: 7be6866
am: da631f5

* commit 'da631f5894b2cfb77e47179a0f401c266b5eedb1':
Fix build warnings
7be6866af78a86a89113e9b680f1a6416ae1f711 19-Mar-2016 Glenn Kasten <gkasten@google.com> Merge "Fix build warnings" into nyc-dev
57c4e6f7464d458eb52d209c2a63524913d6406d 18-Mar-2016 Glenn Kasten <gkasten@google.com> Fix build warnings

Change-Id: I33178dbe0bfc087d6599579ca0529ad853c669ed
/frameworks/av/services/audioflinger/Threads.cpp
b3341577d32aafba7f66fa715e614c12762a63e1 19-Mar-2016 Glenn Kasten <gkasten@google.com> Merge "Fix copy and paste error" into nyc-dev am: 76f2713
am: 066ba12

* commit '066ba128e3641ddfb74adc3095e357d8b6f8452a':
Fix copy and paste error
584be6ac37276544809eb9369b0ee9b1614e76d4 19-Mar-2016 Glenn Kasten <gkasten@google.com> Merge "Add systrace for normal read()" into nyc-dev am: 1c65a1d
am: 07fc599

* commit '07fc5995732aa62bfb1a4e76a5e2fe45abb4ab53':
Add systrace for normal read()
76f27134fb546340154216212d84243d56a8928a 19-Mar-2016 Glenn Kasten <gkasten@google.com> Merge "Fix copy and paste error" into nyc-dev
1c65a1d6e4a4a7c7a534aa6b178f4bb6e0967fb9 19-Mar-2016 Glenn Kasten <gkasten@google.com> Merge "Add systrace for normal read()" into nyc-dev
04dec0ea88c86761d765d6b9054ab20be18657ff 19-Mar-2016 vivek mehta <mvivek@codeaurora.org> Merge "audio: allow standby for direct track" into nyc-dev am: 1606b3f
am: 929290f

* commit '929290fa589824833a7eef4e80f9a934c2246f4d':
audio: allow standby for direct track
9cd7ad101315e0bff4c5f171706c6f80c7e22644 17-Mar-2016 vivek mehta <mvivek@codeaurora.org> audio: allow standby for direct track

Delay standby for offload track use case is not suitable for direct
track in PCM format, because player torn down doesn't necessarily happen.

To avoid AP looping infinitely, allow standby right after direct track
in PCM format is paused.

Bug: 27746493

Change-Id: Id0026ac9891a12acc4affa446b2bc841559fcc28
/frameworks/av/services/audioflinger/Threads.cpp
8379b72b3c7febc5268bc8f9c152fd433a1e6c70 18-Mar-2016 Glenn Kasten <gkasten@google.com> Fix copy and paste error

Change-Id: I0976f5651e0004948108ef43eed3f89e21ecb38b
/frameworks/av/services/audioflinger/Threads.cpp
ec6a70345fc99cd9f8461749a7656b8240874a62 14-Mar-2016 Glenn Kasten <gkasten@google.com> Add systrace for normal read()

Change-Id: Icba9c9fa648909604556305da7e2d9548f5b4b0c
/frameworks/av/services/audioflinger/Threads.cpp
5bba2f6916dbe00aea7c0521faa0c6ed42114a75 18-Mar-2016 Eric Laurent <elaurent@google.com> audioflinger: use sp<> for track proxy

AudioTrack and AudioRecord shared memory proxy (Proxy class) is
RefBase so should not be refenced by raw pointer.

Change-Id: Ic63e31cef97503b8e262d5dafd8ce8f1d72d5eb8
/frameworks/av/services/audioflinger/Threads.cpp
d848eb48c121c119e8ba7583efc75415fe102570 08-Mar-2016 Glenn Kasten <gkasten@google.com> Use audio_session_t consistently

Bug: 27562099
Change-Id: I328d8226191386b163f2ace41233607294c50dcd
/frameworks/av/services/audioflinger/Threads.cpp
4d231dc0ee34380956c71cbe18a750e487a69601 12-Mar-2016 Eric Laurent <elaurent@google.com> audio: Fix race condition in AudioTrack underrun.

When audio flinger mixer removes an AudioTrack from the
active list in case of underrun, it is possible that the
client has written a full buffer just after the underrun detection and
is blocked waiting for more space to write. In this case, the client
will never detect the DISABLED flag and the track never be restarted.

Also implement missing DISABLE flag detection in server side audio tracks
(OutputTrack and PatchTrack).

bug: 27567768
Change-Id: I8d0753429d4113498258b1f61bd8ac5939a612f0
/frameworks/av/services/audioflinger/Threads.cpp
517161856d74f5fe39cce131f29b977bc1745991 01-Mar-2016 Eric Laurent <elaurent@google.com> audio flinger: fix offload track underrun

Fix offload track underrun detection causing early disabling
of offloaded audio tracks.

Optimize sleep time in case of underrun to avoid spinning while
waiting for new data.

Re-enable offload when streaming

Bug: 26668110

Change-Id: I874728c69647ac05e1effb84c48700a6d0ac7435
/frameworks/av/services/audioflinger/Threads.cpp
7fd0422fbd17af3b24eb04421d37fce50f3826e2 02-Feb-2016 Glenn Kasten <gkasten@google.com> Sample rate 0 means a route-dependent rate

Remove check for primary _output_ [sic] sampling rate for fast capture.
Clean up AudioRecord handling of frame count and sample rate.
Clean up AudioTrack handling of notification period updates.
Make AudioRecord and AudioTrack more similar in order of operation, comments, and whitespace.

Bug: 25641253
Bug: 21019153
Change-Id: I24a6677945987fc39a9bf93f70357e4bc7410f98
/frameworks/av/services/audioflinger/Threads.cpp
eeecb980ff4c202d0a3c4b0bfe040dce2f73336d 26-Feb-2016 Glenn Kasten <gkasten@google.com> Add use for audio_unique_id_t

Bug: 25641253
Bug: 21019153
Change-Id: I65dc128e760c245f3d90559635a8981b186c87d7
/frameworks/av/services/audioflinger/Threads.cpp
e736431c69e2a00468d140d2af97b63e0e5aa83a 25-Feb-2016 Eric Laurent <elaurent@google.com> Merge "audio policy: add device for audio bus" into nyc-dev
c54b1ffc92b8ad27608a8af21033d7cab33cb3a0 23-Feb-2016 Andy Hung <hunga@google.com> Fix AudioTrack presentationComplete regression

Bug: 27310929
Change-Id: Id52299660d90b07220a4fd9996da53fe755a41f1
/frameworks/av/services/audioflinger/Threads.cpp
58545be2ce4e701c8c37401edcc126a8b683890d 23-Feb-2016 Eric Laurent <elaurent@google.com> audio policy: add device for audio bus

Add audio device category representing a bus in the
audio subsystem. E.g a set of channels in MOST automotive bus.

Bug: 25448664
Change-Id: Id00da57dc45037d4d8062e9a747c423940611539
/frameworks/av/services/audioflinger/Threads.cpp
818e7a32ce3633980138aff2c2bfcc5158b3cfcc 17-Feb-2016 Andy Hung <hunga@google.com> Implement server side playback timestamps with 64 bit accuracy

Provide server timestamps if the HAL doesn't provide it.
Provide monotonic - boottime translation.
Integrate record timestamps and playback timestamps together.

Bug: 17472992
Bug: 22871200
Bug: 26400089
Bug: 26682703
Change-Id: If1974f94232fcce7ba0bbcdf63d9e54ed51918ff
/frameworks/av/services/audioflinger/Threads.cpp
6ae5843c281301a9ffd1059d185620a9337e15a2 17-Feb-2016 Andy Hung <hunga@google.com> Enable FastTrack timestamps

Bug: 26413951
Change-Id: Id54c32cb0f0be83d443f6cf1007181ebc461c586
/frameworks/av/services/audioflinger/Threads.cpp
b0a144d705a021994628d136a170a6d2bd4282e7 12-Feb-2016 Phil Burk <philburk@google.com> Merge "AudioTrack: support ENCODING_IEC61937" into nyc-dev
fdb3c07db5d44535eb8c3ec46dc78ad8446c01eb 09-Feb-2016 Phil Burk <philburk@google.com> AudioTrack: support ENCODING_IEC61937

Set DIRECT flag.
Use audio_has_proportional_frames() instead of audio_is_linear_pcm()
where appropriate.

Bug: 24541671
Bug: 20891646
Bug: 26373761
Change-Id: Ia32036b18683b084d6c9887593df87397ea0afd9
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
e10393e72454bfd8298017dc193faf424f4e9a8f 12-Jun-2015 Andy Hung <hunga@google.com> Fix audio timestamp computation for pause, stop, and dynamic speed changes

Timestamp on pause and underrun (stop) do not reflect actual position.
Timestamps do not account for dynamic changes to track speed / sample rate.

Bug: 11085154
Bug: 17552775
Change-Id: I0e5e40ab3eaee82f0c91b9f399089698a0b1947e
/frameworks/av/services/audioflinger/Threads.cpp
3f0c902beb53a245c9db35e871607dba05b8d391 16-Jan-2016 Andy Hung <hunga@google.com> Add AudioRecord timestamps

Bug: 13569372
Bug: 22886739
Change-Id: Ibc81afefb733d23676a632a0f2da31163fdbe05f
/frameworks/av/services/audioflinger/Threads.cpp
03c48d5afcb3dfc1e43df93e1f3b3b3e9292e148 28-Jan-2016 Glenn Kasten <gkasten@google.com> Add limiter for mono blend

Bug: 26904791
Change-Id: I76b16e70871cd9fc0a9b8badc66f27069fabe1cb
/frameworks/av/services/audioflinger/Threads.cpp
d79072e9dff59f767cce2cda1caab80ce5a0815b 06-Jan-2016 Glenn Kasten <gkasten@google.com> Remove TimedAudioTrack and associated code

Bug: 8278435
Change-Id: I095c1a4888e645e14d93b0b15fbef4524a831ca1
/frameworks/av/services/audioflinger/Threads.cpp
2812d9ea3a3a33142dd8e23c9d949c498d6f7a12 04-Jan-2016 Phil Burk <philburk@google.com> AudioTrack: Add getUnderrunCount()

This allows an app to detect application-level output glitches.
Underrun counts survive track recreation.

Change-Id: I8eb14e92f6fc1007718a29b0666ab51ace30cdb8
Bug: 25641253
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
113efbb3ac8e7306ea8645cb53a96d1e81c2d041 09-Jan-2016 Eric Laurent <elaurent@google.com> audioflinger: fix standby delay on A2DP output

Make sure that standby delay is never less than the audio flinger
default on A2DP output.
Due to variable latency and amount of buffering in A2DP sinks,
an agressive standby delay could lead to truncated audio.

Bug: 25830539.
Change-Id: I38be37ad346f5f4bf8303d3db4e3e911bf637968
(cherry picked from commit 42537be61479e59c4718e1304364551c1454f63c)
/frameworks/av/services/audioflinger/Threads.cpp
197f766a0e3c37efe4fe941553511c6022cf10b1 12-Jan-2016 Eric Laurent <elaurent@google.com> Merge "audioflinger: fix standby delay on A2DP output"
42537be61479e59c4718e1304364551c1454f63c 09-Jan-2016 Eric Laurent <elaurent@google.com> audioflinger: fix standby delay on A2DP output

Make sure that standby delay is never less than the audio flinger
default on A2DP output.
Due to variable latency and amount of buffering in A2DP sinks,
an agressive standby delay could lead to truncated audio.

Bug: 25830539.
Change-Id: I38be37ad346f5f4bf8303d3db4e3e911bf637968
/frameworks/av/services/audioflinger/Threads.cpp
64f1901bdddf464c8f29bed34e3449762873b3e9 09-Jan-2016 Andy Hung <hunga@google.com> Merge "Add setMasterMono and getMasterMono"
2ddee19245641e86bca436dda23a0f5089bf2ab5 19-Dec-2015 Andy Hung <hunga@google.com> Add setMasterMono and getMasterMono

Bug: 15283594
Bug: 22700363
Change-Id: I32dc1fcecf285967a61bd508af3bb299595db57d
/frameworks/av/services/audioflinger/Threads.cpp
8a397d583a4f4cf24ad88facaf2fd33990cfb811 02-Dec-2015 rago <rago@google.com> Adding UNPROCESSED to the available audio_sources

bug: 25564291
Change-Id: I86d8feda4d687352f98b640819211207a06d6b50
/frameworks/av/services/audioflinger/Threads.cpp
438e7572c83674f4b9e6184f32f3dc94cd50524e 15-Dec-2015 Andy Hung <hunga@google.com> AudioFlinger: change logcat error to warning

Change wakelock token error to warning if AudioServer.java
hasn't issued systemReady() yet (from boot or audioserver died).

Bug: 26069693
Change-Id: I8ab1ec06a30a476e058bf0dde50bfbbc60243570
/frameworks/av/services/audioflinger/Threads.cpp
dcb346b7dc5b88c3e85db8a70bbd6a2fee8192b9 09-Sep-2015 Marco Nelissen <marcone@google.com> Run audio services in audioserver instead of mediaserver

audioflinger, audiopolicy, (fm) radio, soundtrigger moved to audioserver.
medialog is removed from mediaserver.
audioserver has same permissions and rights as mediaserver.

mediaserver is allowed to specify client uid to audioserver.

Subsequent CL will add medialog to audioserver.

TBD: Pare down permissions.

Bug: 24511453
Change-Id: Iccaa08b874a502710d142e72f8abbb3d97c44cfa
/frameworks/av/services/audioflinger/Threads.cpp
2a4e18da8ee0521a48285643586159946298caef 03-Dec-2015 Glenn Kasten <gkasten@google.com> Merge "Add logging to help diagnose a rare bug"
818da521b6a487518f54614b9eba68957a8d8aeb 02-Dec-2015 Glenn Kasten <gkasten@google.com> Fix build warnings

Change-Id: Ic329a9852589247ed797b6a6cfed735ff3af184a
/frameworks/av/services/audioflinger/Threads.cpp
f7d65ee34f64e8fad9c5af3f11da783193caf5f9 02-Dec-2015 Glenn Kasten <gkasten@google.com> Add logging to help diagnose a rare bug

Bug: 25911696
Change-Id: Idca44ed873f0a9fa911e9cb1c3a09b4e7e4f23eb
/frameworks/av/services/audioflinger/Threads.cpp
2f90c51d42efa881a9e54e4f4efadf99398304f9 02-Dec-2015 Glenn Kasten <gkasten@google.com> Don't place large objects on the stack

Bug: 25020816
Change-Id: Ife4da9fc3000e645f654f2eb28b37ad3a89d61f9
(cherry picked from commit fc39dd9f653754315df3ff7f76b8a193829a76e8)
/frameworks/av/services/audioflinger/Threads.cpp
3f273d10817ddb2f792ae043de692efcdf1988ae 24-Nov-2015 Wei Jia <wjia@google.com> Uses AudioFlinger to signal battery stats for audio.

Bug: 18177221
Change-Id: I704010c037cb99bb74b98798ee8e494fa8bdc875
/frameworks/av/services/audioflinger/Threads.cpp
d60560af7cb559762593161c8202459cc01fb0f5 10-Apr-2015 Eric Laurent <elaurent@google.com> audio policy: add support for external audio sources

Add support for activity on external audio sources.
An external source reflects activity on an input audio device
that must be controlled (both routing and volume) by the
audio policy manager.
First, the input device must be connected with setDeviceConnectionState().
Then, the source activity is indicated with startAudioSource() and
stopAudioSource() APIs.
startAudioSource() indicates the source device with an audio port configuration
and the use case by the audio attributes.

Once a source is active, its routing and volume are controlled by the policy manager
as it would for a software source (AudioTrack).

Change-Id: If5805d58a4356b2f681f1aabf54375f62b55b98a
/frameworks/av/services/audioflinger/Threads.cpp
403bff76dbde57fdcfce84292a5e42fa33c37842 13-Oct-2015 Andy Hung <hunga@google.com> am 4c6e77ff: AudioFlinger: Clear record buffers when starting RecordThread

* commit '4c6e77ff8e18a1551320a6b42f6a45e19dcce748':
AudioFlinger: Clear record buffers when starting RecordThread
4c6e77ff8e18a1551320a6b42f6a45e19dcce748 21-Sep-2015 Andy Hung <hunga@google.com> AudioFlinger: Clear record buffers when starting RecordThread

Bug: 24211743
Bug: 24267152
Change-Id: I58c55e56b85067b71e4e300f947b4dfc159637ba
/frameworks/av/services/audioflinger/Threads.cpp
10cfc14fadae08cd5806c4834e28aa9f743f550e 28-Sep-2015 Glenn Kasten <gkasten@google.com> Merge "Add missing entries for input and output flags"
937c34741e476f26ddd0ff28a2af5e1bcd96895c 28-Sep-2015 Glenn Kasten <gkasten@google.com> Add missing entries for input and output flags

Bug: 24141510
Change-Id: Ia151bc7d25d72864992888c33547a34adf460a9b
/frameworks/av/services/audioflinger/Threads.cpp
060b582b37f55b758a41b0cc26dc1ff6d112814f 27-Sep-2015 Eino-Ville Talvala <etalvala@google.com> am b171ba8c: am ffce26c0: am f99498ee: CameraService: Use SCHED_FIFO for request queue thread in HFR

* commit 'b171ba8ce83ebb5abc2de9a171a15dc974756d3d':
CameraService: Use SCHED_FIFO for request queue thread in HFR
f99498ee4de7123e2fd71778c6877be44fbd1506 26-Sep-2015 Eino-Ville Talvala <etalvala@google.com> CameraService: Use SCHED_FIFO for request queue thread in HFR

- Move SchedulingPolicyService from audioservice to mediautils

- When starting up a high speed stream config, set request queue thread
to SCHED_FIFO using SchedulingPolicyService

Bug: 24227252
Change-Id: I224b59142bd111caf563779f55cddd62385b9bac
/frameworks/av/services/audioflinger/Threads.cpp
0a01c2fb68e6f35905de8dfaf938d099cd48587d 21-Sep-2015 Andy Hung <hunga@google.com> AudioFlinger: Clear record buffers when starting RecordThread

Bug: 24267152
Change-Id: I58c55e56b85067b71e4e300f947b4dfc159637ba
/frameworks/av/services/audioflinger/Threads.cpp
c06f0ef67f02f88e01e2b2679e83c87628dbfc1a 11-Sep-2015 Eric Laurent <elaurent@google.com> am b7b97b9d: am 48e879db: am a2ab4505: audio flinger: force audio path start from normal mixer

* commit 'b7b97b9d897581b30f4bba78ec360474646c230a':
audio flinger: force audio path start from normal mixer
a2ab4505c807f42afe34809409c4e85d91618a8c 09-Sep-2015 Eric Laurent <elaurent@google.com> audio flinger: force audio path start from normal mixer

The audio HAL wakes up and configures the audio path when receiving
the first write() in standby state. This causes a certain amount of
process to take place in the mixer threads which is problematic for
fast mixer running at FIFO priority.

We now force a fake write() of 0 bytes from normal mixer to trigger
the audio path configuration before starting the fast mixer.

Bug: 23791972.

Change-Id: I54311b337fda956444846f5d2f53a3263d54e04b
/frameworks/av/services/audioflinger/Threads.cpp
f87c2f5eb4e37f0950962e31b9ca49e32f5b0864 21-Aug-2015 Glenn Kasten <gkasten@google.com> dumpsys was missing "processing" for format and frame size

Change-Id: I6931b18a6a85bf0638d659e31bca5aa6c8cf62bf
/frameworks/av/services/audioflinger/Threads.cpp
5ce059661dcbab8924edab400681fc408ee76123 24-Jul-2015 Glenn Kasten <gkasten@google.com> Merge "Fix capture overruns at non-primary sample rate" into mnc-dev
a97630bda8815958587ca31adb2d37090022af25 23-Jul-2015 Andy Hung <hunga@google.com> Fix record memory buffer allocation for legacy upmix/downmix

Bug: 22173057
Change-Id: I8f5056ff5a1252c71a3d3b354440551bcd9fd466
/frameworks/av/services/audioflinger/Threads.cpp
eb9487e10294a4e73977f460f30eeaff503acd21 22-Jul-2015 Glenn Kasten <gkasten@google.com> Fix capture overruns at non-primary sample rate

and small buffer size. Also:
Pull out the magic number "12 ms" to a named constant.
Remove obsolete AudioFlinger::mPrimaryOutputSampleRate.

Bug: 22662814
Change-Id: I261f75a222c4505a84aad2493d251bd2dea59f68
/frameworks/av/services/audioflinger/Threads.cpp
ca5e6143740299c877d69e97f7968cd04476d32c 14-Jul-2015 Phil Burk <philburk@google.com> AudioFlinger: fix repeated underruns for compressed audio

The AudioFlinger kept pausing the audio when playing compressed AC3 or DTS.
This caused pause/resume loops that were hard to break out of.

The AudioFlinger was thinking that the compressed audio was PCM
because the HAL was in PCM mode playing SPDIF data bursts.
It also thought that EAC3 was at 192000 Hz instead of 48000
Hz because the data bursts are played at a higher rate.

This CL adds more calls to the shim that separates the AudioFlinger.
Now the AudioFlinger gets information about the HAL sample rate,
channel masks and format from the shim instead of calling the HAL directly.

The AudioFlinger now uses a different threshold for detecting
underruns when the audio is compressed.

Bug: 19938315
Bug: 20891646
Change-Id: Ib16f539346d1c7a273ea4feb3d3afcc3dc60237d
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
4b33e0838fdb1b5e545449add02005916b512c99 13-Jul-2015 Eric Laurent <elaurent@google.com> Merge "audioflinger: flush HAL when transitioning to next direct track" into mnc-dev
7c1ec5f038e63a5eb8b04434577c25bc23f5f410 09-Jul-2015 Eric Laurent <elaurent@google.com> audio: several fixes in audio routing callbacks

- audio policy:
Force device change to ensure new audio patch creation
upon first track activity on a given output.
Fix function device_distinguishes_on_address() which could mistake
some output device with remote submix input device.

- audio flinger:
Reduce number of binder calls upon new client registration by only
sending ioConfigChanged() callbacks to newly registered client.
Fix first patch after output thread creation not triggering an
ioConfigChanged() callback.

-audio system:
Force client registration upon routing callback installation to force
new ioConfigChanged() callback from audio flinger.

Bug: 22381136.

Change-Id: Ieb0d9f92f563a40552eb31bc0499c8ac65f78ce4
/frameworks/av/services/audioflinger/Threads.cpp
0f0631eb55b1f0a7f4b62212b78a3faa0b49919b 07-Jul-2015 Eric Laurent <elaurent@google.com> audioflinger: flush HAL when transitioning to next direct track

Send flush command to the audio HAL when transtioning to
next track on direct output thread, even if both tracks are in the
same audio session.

Commit 43b4dcc to fix issue 21145353 did only flush the HAL if the
audio session was different for the new track because the logic was
copied from the offload thread.

Bug: 22019044.
Change-Id: I89b217580023ed7449a58e9bf3dc068ce7a84487
/frameworks/av/services/audioflinger/Threads.cpp
b9d73333cce3f9da3a7a0b33589f6bbe0f992a92 01-Jul-2015 Eric Laurent <elaurent@google.com> audio: add definitions for devices connected over IP

Bug: 22068684.
Change-Id: Idde0eaf7121d2e43f32eee3e6b10e99d8cff4912
/frameworks/av/services/audioflinger/Threads.cpp
e8726fea8a53bf3474aa3c6deaf2f6c1f565e694 26-Jun-2015 Eric Laurent <elaurent@google.com> reduce number of binder calls from mediaserver

Reduce the number of audio port, audio patch and
IO config changed binder calls from mediaserver to
client processes:
- Do not call IO config changed callback if selected
device is the same as previously selected one on a given
audio flinger playback or capture thread.
- Do not call the audio port or audo patch list update
callback on a client if this client as no listener registered.

Bug: 22045560.

Change-Id: If780e105404de79b7cb5c80c27b793ceb6b1c423
/frameworks/av/services/audioflinger/Threads.cpp
40eb1a1f8871909c272e72afaf7d5af84fea2412 18-Jun-2015 Andy Hung <hunga@google.com> Reduce log messages on AudioFlinger throttle

Bug: 21858740
Change-Id: I8f291b64c1033867bb57ffceaa3b7d94aa998715
/frameworks/av/services/audioflinger/Threads.cpp
ad9ef61e770c0751a9983aa5c9844dfeb9ed665b 11-Jun-2015 Phil Burk <philburk@google.com> Merge "AudioFlinger: flush stream when switching tracks" into mnc-dev
43b4dcc660e6da96285e4672ae371070ab845401 10-Jun-2015 Phil Burk <philburk@google.com> AudioFlinger: flush stream when switching tracks

For direct threads, when recycling a stream, perform a flush so
that the frame position is reset.

Bug: 21145353
Change-Id: I08611cd64bb249a9659c44f9e4c47e7455f4838f
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
e1635ec096d1110c33a5aa46847af59c261fb7fa 09-Jun-2015 Glenn Kasten <gkasten@google.com> Take advantage of audio_channel_in_mask_from_count

Bug: 21375533
Bug: 21721483
Change-Id: I1ccd5d1d68a25f415dc4a62bf7a44d9db12a256b
/frameworks/av/services/audioflinger/Threads.cpp
08fb1743f80437c38b4094070d851ea7f6d485e5 01-Jun-2015 Andy Hung <hunga@google.com> Throttle MixerThread data pull to no more than twice expected rate

This helps prevent underruns with NuPlayer and other applications
which set up buffers that are close to minimum size or use deep
buffers, and rely on a double-buffering sleep strategy to fill.

Enabled by default. Disabled by setting af.thread.throttle 0

Bug: 19062223
Bug: 21198655
Change-Id: Ia52b48e0c99588af5db53c43fede2afd775b8899
/frameworks/av/services/audioflinger/Threads.cpp
e1f939bf0e1bac806b7da1b316e70c96426dc1b6 30-May-2015 Glenn Kasten <gkasten@google.com> Merge "Add more device codes for symbolic display" into mnc-dev
ad9cb8b88e4f8face23f01d8dc89fa769dacb50f 27-May-2015 Eric Laurent <elaurent@google.com> audio flinger: add suffix to time variables names

Add suffix to clarify units for the following variables:
standbyTime -> mStandbyTimeNs
standbyDelay -> mStandbyDelayNs
activeSleepTime -> mActiveSleepTimeUs
idleSleepTime -> mIdleSleepTimeUs
sleepTime -> mSleepTimeUs

Change-Id: I7f5d602c39e0ef3f6fe9ef99eaf1b351c7bd4fc3
/frameworks/av/services/audioflinger/Threads.cpp
3ab77c1e93f3da5da0d18ff998f1bd6db19534f3 27-May-2015 Eric Laurent <elaurent@google.com> Merge "audio flinger: pause direct output when underrunning" into mnc-dev
84d61caa6040e346df68dbe6f8e4fe339906de08 07-May-2015 Glenn Kasten <gkasten@google.com> Add more device codes for symbolic display

Change-Id: I08553f0e94d0a0931ccf98ee04f53686b96c8b03
/frameworks/av/services/audioflinger/Threads.cpp
5cff403679fc44c8293de81aed31c459c6129243 26-May-2015 Eric Laurent <elaurent@google.com> audio flinger: pause direct output when underrunning

If a direct output supports pause, pause the stream
instead of placing it into standby when the audio track
underruns. This will avoid resetting the presented frame count
and preserve A/V sync.

Bug: 21437855.

Change-Id: I598346edb62a1864126acdb1d9a937c82eac2191
/frameworks/av/services/audioflinger/Threads.cpp
748a792be85838c429ebf46acf7d6eb02e79f00b 21-May-2015 Eric Laurent <elaurent@google.com> Merge "audio flinger: do not call JAVA services until system is ready" into mnc-dev
72e3f39146fce4686bd96f11057c051bea376dfb 20-May-2015 Eric Laurent <elaurent@google.com> audio flinger: do not call JAVA services until system is ready

Wait for system ready indication form AudioService before enabling
calls to scheduling service or power manager.

Bug: 11520969.
Change-Id: I221927394f4a08fd86c9d457e55dd0e07949f0cf
/frameworks/av/services/audioflinger/Threads.cpp
8ef66c6662002279a606df70f41651491a349126 20-May-2015 Andy Hung <hunga@google.com> Merge "Update FastTrack channel conversion check" into mnc-dev
1f439e1cf16a29347288ba9ddd06c0b6d086a145 19-May-2015 Andy Hung <hunga@google.com> Update FastTrack channel conversion check

Change-Id: Ia1a3124e6408859bf4d95ff9fd95dda6970a4a7f
/frameworks/av/services/audioflinger/Threads.cpp
f98ec8d0d42e6952c0a7cc5027935851073f7426 19-May-2015 Andy Hung <hunga@google.com> Fix channel mask dump in AudioFlinger

Change-Id: Iba5ccd1885775b14c44342c7b169a0672b93549b
/frameworks/av/services/audioflinger/Threads.cpp
d9f493ebcd1830c76d7b1782e64c7ba9ad8ab4bd 12-May-2015 Andy Hung <hunga@google.com> Merge "Update sampling rate to 192kHz for devices" into mnc-dev
69dce3343ffe33d2ba60ab4c6755953a7ec96899 12-May-2015 Marco Nelissen <marcone@google.com> Merge "Work around bug in offload driver" into mnc-dev
078538cfc6c4682889ed52de460d29c0d15bb9eb 12-May-2015 Marco Nelissen <marcone@google.com> Work around bug in offload driver

There is a bug in the offload driver that causes the last offload buffer(s)
to be dropped unless the device is on power or holding a wake lock.
To avoid truncated playback, we now hold a wake lock during the drain phase
of offloaded playback.

Bug: 19928717
Change-Id: I8df22e965ec791448aa5d9b74e743f48ef886fc4
/frameworks/av/services/audioflinger/Threads.cpp
db4c031f518ae5806af73756273ff32cd8d0e4f8 06-May-2015 Andy Hung <hunga@google.com> Update sampling rate to 192kHz for devices

Change-Id: I0a83206be51d7ae18ccf85b94b2127356307be69
/frameworks/av/services/audioflinger/Threads.cpp
af49160aa75d4e1750f3ed56b812ec9cc448fa46 12-May-2015 Andy Hung <hunga@google.com> Merge "Allow 8 channels in RecordThread" into mnc-dev
f6870aefc5e31d4220f3778c4e79ff34a61f48ad 08-May-2015 Eric Laurent <elaurent@google.com> audio flinger: fix fuzz test crash

Clear output stream pointer in duplicating thread
when the main output to which it is attached is closed.

Also do not forward master mute and volume commands to
duplicating threads as this is not applicable.

Also fix logic in AudioFlinger::primaryPlaybackThread_l()
that could accidentally return a duplicating thread.
This never happens because the primary thread is always
first in the list.

Bug: 20731946.
Change-Id: Ic8869699836920351b23d09544c50a258d3fb585
/frameworks/av/services/audioflinger/Threads.cpp
296fb13dd9b5e90d6a05cce897c3b1e7914a478a 01-May-2015 Eric Laurent <elaurent@google.com> Implement audio device callback

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
/frameworks/av/services/audioflinger/Threads.cpp
d1abb8f94d7ed749ee959655db1e07d26dad074d 06-May-2015 Andy Hung <hunga@google.com> Allow 8 channels in RecordThread

Change-Id: I738d4975188695e568015e1bc64d160550e958f5
/frameworks/av/services/audioflinger/Threads.cpp
8ce74c3c11458faa34395591a3424e90db856bfc 02-May-2015 Phil Burk <philburk@google.com> Merge "AudioTrack: fix direct tracks not pausing" into mnc-dev
6fc2a7c81f62b1e21487ae37e11aae6241bc3ead 01-May-2015 Phil Burk <philburk@google.com> AudioTrack: fix direct tracks not pausing

When a Direct Track is paused and the HAL does not support
pause() and resume() then the HW never gets paused.
The app can just keep writing data, which gets played.

Bug: 18899620
Change-Id: Ice0f360956ff7ca425f6f24a0a2a8640d8b43fa8
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
73e26b661af50be2c0a4ff6c9ac85f7347a8b235 28-Apr-2015 Eric Laurent <elaurent@google.com> AudioSystem: refactor audio config cache and callbacks

Clean up implementation of audio configuration cache and
callback events from AudioFlinger:

- Define class AudioIoDescriptor for audio input and output
configurations outside of AudioSystem class.
- Do not use void * but an AudioIoDescriptor as argument to
audio config callbacks from AudioFlinger.
- Remove unused configuration events.
- Move AudioSystem audio input and output cache from static singletons to
members of AudioFlingerClient subclass.

Change-Id: I67c196c32c09ce2756af0755ee1fe631040c3270
/frameworks/av/services/audioflinger/Threads.cpp
054d9d3dea1390294650ac704acb4aa0a0731217 24-Apr-2015 Eric Laurent <elaurent@google.com> PatchPanel: do not use setParameters() internally.

Do not use setParameters() with AUDIO_PARAMETER_STREAM_ROUTING
when communicating the input or output device selected to playback or
record threads, even for HAL version less than 3.0.
Use createAudioPatch()/releaseAudioPatch() instead.
This allows to send more information on the output or input device being
selected.

Also fix a regression introduced in L where the output device selection
was not communicated to effects on record threads.

Change-Id: I4780ada53241d56694b005c992171e173c3bf8f5
/frameworks/av/services/audioflinger/Threads.cpp
d330ee46022f34da76d14d0c4d2910526ecc2321 20-Apr-2015 Andy Hung <hunga@google.com> Add floating and multichannel record to AudioFlinger

Change-Id: Ia388fb012a0b6d81613ef87142a97d76836338f9
/frameworks/av/services/audioflinger/Threads.cpp
04f07fd61022dac46ddda9c815d65bc3d3278b84 22-Apr-2015 Andy Hung <hunga@google.com> Merge "Make record buffer in RecordThread variable format"
5a8a95de6dad1a3bcf3da5a37b35766e89086e13 18-Apr-2015 Ricardo Garcia <rago@google.com> Use AudioPlaybackRate to hold TimestretchBufferProvider parameters

Use this struct to handle the parameters for TimestretchBufferProvider all
across the system.
Add stretch mode and fallback mode to TimestretchBuffer Provider.

Change-Id: I19099924a7003c62e48bb6ead56c785cb129fba2
/frameworks/av/services/audioflinger/Threads.cpp
5744661e85981f8a9456bf470e2761235fc026da 20-Apr-2015 Andy Hung <hunga@google.com> Make record buffer in RecordThread variable format

Change-Id: Id4bb9b973eeea16946fba3bc084c7ac270d9fa33
/frameworks/av/services/audioflinger/Threads.cpp
8edb8dc44b8a2f81bdb5db645b6b708548771a31 27-Mar-2015 Andy Hung <hunga@google.com> Add playback rate to AudioTrack

Bug: 19196501
Change-Id: I6411e1d3ce652b711a71a6d9df020cb5f60d4714
/frameworks/av/services/audioflinger/Threads.cpp
6770c6faa3467c92eabc5ec9b23d60eb556a0d03 07-Apr-2015 Andy Hung <hunga@google.com> Enable 8 bit and float pcm record formats for AudioFlinger

Update sampling rate handling as well.

Bug: 19570772
Change-Id: I872248e64c0578b2e48869a68fee0d51bd0640c3
/frameworks/av/services/audioflinger/Threads.cpp
73c02e4277b399c2ec1555d32b6ad5df23bb83dc 29-Mar-2015 Andy Hung <hunga@google.com> Improve ResamplerBufferProvider

Change-Id: I3cc3af221ad5797ff219d75227350733afa180db
/frameworks/av/services/audioflinger/Threads.cpp
97a893eb34f8687485c88eaf15917974a203f20b 29-Mar-2015 Andy Hung <hunga@google.com> Add RecordBufferConverter for RecordThread data processing

Change-Id: Ia3aab8590cd41e8a7cba0a7345d70d2866d92045
/frameworks/av/services/audioflinger/Threads.cpp
b369cafd67beb63dd0278dba543f519956208a7f 31-Mar-2015 Eric Laurent <elaurent@google.com> audio flinger: fix standby on output with HW A/V sync

Fix a bug in audio HAL pause logic on output threads with
HW A/V sync preventing the HAL to enter standby when
the audio track is stopped and detroyed.

Bug: 19980184.

Change-Id: Ia497dad23159038b447fcbc18a67bb61b70b79cc
/frameworks/av/services/audioflinger/Threads.cpp
ae9710473b88592c557488bfcae71616d9e9b75f 24-Mar-2015 Phil Burk <philburk@google.com> Merge "AudioFlinger: call SPDIF wrapper from AudioFlinger"
062e67a26e0553dd142be622821f493df541f0c6 11-Feb-2015 Phil Burk <philburk@google.com> AudioFlinger: call SPDIF wrapper from AudioFlinger

Create an interface layer between the AudioFlinger and the HAL
that manages the wrapping and format conversion.

Removed unnecessary includes.
Handle rate conversion in getRenderPosition().
Try to open HAL with encoded format before wrapping with SPDIF.

Bug: 17566660
Change-Id: I00ad888ca15ff0f85b85efb8167c7f5ea761a244
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
b7fbf7ecc6b034243ec64f79f3113675b5e3c941 18-Mar-2015 Glenn Kasten <gkasten@google.com> AudioRecord TRANSFER_OBTAIN can be used with FAST flag

Change-Id: I001ba1a88150dddf79d99baf5927f31799745eef
/frameworks/av/services/audioflinger/Threads.cpp
d198b85a163330b03e7507c9e8bfeb5f4d958a6c 16-Mar-2015 Glenn Kasten <gkasten@google.com> Fix typos

Fix typos in comments
Add formal parameter name to declaration where it was missing
Fix out of order comments

Change-Id: I1de81ae82af5ca507864e4c7b959111bac898b98
/frameworks/av/services/audioflinger/Threads.cpp
5a23aa949188fafe1d8d35966ff5a73974294dfd 19-Mar-2015 Glenn Kasten <gkasten@google.com> Merge "Initial implementation of fast capture dump"
b4f18f964cba9f124e5a264428290ada6eb4aa00 09-Mar-2015 Glenn Kasten <gkasten@google.com> Merge "Allow TRANSFER_OBTAIN to be used for fast tracks"
1dfe2f9c2d03fc8d0ed0cdfe0b9fb894bc0bcc11 09-Mar-2015 Glenn Kasten <gkasten@google.com> Allow TRANSFER_OBTAIN to be used for fast tracks

Change-Id: I8fa20c26f076567b38210af4a680fe1cb2eacee4
/frameworks/av/services/audioflinger/Threads.cpp
17c9c998afed5ed9df7495eeed5822f3ed53ebec 03-Mar-2015 Glenn Kasten <gkasten@google.com> Initial implementation of fast capture dump

Change-Id: I898d903e539f760ef7caa80f41ca21c223f67264
/frameworks/av/services/audioflinger/Threads.cpp
44182c206f7c5584ef2cf504da6be98fab665dbf 06-Mar-2015 Glenn Kasten <gkasten@google.com> Dump generic information first for each thread

also mBufferSize was already being displayed as part of dumpBase

Change-Id: I17f3062fcc076c594b5fd6b8fca286b27067e07c
/frameworks/av/services/audioflinger/Threads.cpp
0b89bc0d285b8fd4798df1ff0ba9f93851a3bd48 06-Mar-2015 Glenn Kasten <gkasten@google.com> Display more fields in thread dumpBase

Change-Id: Ice15e999dda2f6cf9d23685ade4a87f74180322d
/frameworks/av/services/audioflinger/Threads.cpp
d7dca050c630bddbd73a6623271b34b4290460ee 06-Mar-2015 Glenn Kasten <gkasten@google.com> Rename mName to mThreadName and kNameLength to kThreadNameLength

Change-Id: I0adfcdcab7923a07a840ec0e04528cb8bfc41f10
/frameworks/av/services/audioflinger/Threads.cpp
bcb1486d052e329ae4790d93055d1c51017286c3 06-Mar-2015 Glenn Kasten <gkasten@google.com> Whitespace

switch indent

Change-Id: I652c798dd37a80634d247c4d881fb1cce92c4bd6
/frameworks/av/services/audioflinger/Threads.cpp
0f5b562737d6b5457aa83a4fdce9c6fb32584d9d 18-Feb-2015 Glenn Kasten <gkasten@google.com> Add devicesToString, inputFlagsToString, and sourceToString

Change-Id: I0c09d76c204ffc5579f62d2ed1faef07922a5962
/frameworks/av/services/audioflinger/Threads.cpp
dfb0e115d827887e2f56a8877fe41b256d24360e 18-Feb-2015 Glenn Kasten <gkasten@google.com> Fix typo in string table

Change-Id: Iaf3d3c77129c62cf3dcad21fc754f390eb43b28e
/frameworks/av/services/audioflinger/Threads.cpp
fbdb2aceab7317aa44bc8f301a93eb49e17b2bce 02-Mar-2015 Glenn Kasten <gkasten@google.com> Pull up increaseSamplingN and kSamplingNforLowRamDevice

from FastMixerDumpState to FastThreadDumpState, and remove unused parameter
from FastMixerDumpState constructor.

Change-Id: Ib8937b106622a8da28a6ef6043de4528ae82cb05
/frameworks/av/services/audioflinger/Threads.cpp
63238efb0d674758902918e3cdaac322126484b7 03-Mar-2015 Glenn Kasten <gkasten@google.com> Remove redundant semicolon from namespace closing

Change-Id: I163f9d3d216c283ae1160ce4802e5247cf44fba7
/frameworks/av/services/audioflinger/Threads.cpp
d797a9d5daad3051f9ac1d348abc2f434ea3ddcf 02-Mar-2015 Glenn Kasten <gkasten@google.com> Fix compile error if FAST_THREAD_STATISTICS not defined

Change-Id: I3a4ac558e61ad956a7a6e325534e722066e49b2f
/frameworks/av/services/audioflinger/Threads.cpp
d4bd93b22ab9f7dfa32dfc6d48e008db3ea9c634 28-Feb-2015 Andy Hung <hunga@google.com> Merge "Change AudioTrack resampling buffers from 3 to 2"
ad8510a339ffab330c2c46e5c247dd1cf9e15c22 18-Feb-2015 Glenn Kasten <gkasten@google.com> Include what you use

Change-Id: I1967861f383bb5ed6743fb69e3bd439907ed7033
/frameworks/av/services/audioflinger/Threads.cpp
0e48d25606c82def035ad10a5b3923767a765cdd 26-Jan-2015 Andy Hung <hunga@google.com> Change AudioTrack resampling buffers from 3 to 2

Move computation of minimum AudioTrack buffer size to server
for normal streaming PCM tracks.

Use server-side computation to exactly determine requirements
for the resampler to avoid triple buffering.

This reduces latency for normal audio tracks that require resampling,
and makes things consistent with the minimum buffer size.

Change-Id: I2f2ca0e599ee20e16559bc5c5dab61ed100da16c
/frameworks/av/services/audioflinger/Threads.cpp
dce27d0ebab31e82543bb777ed3eb04955cd18ff 17-Jan-2015 Andy Hung <hunga@google.com> Merge "Update duplicating thread to use float audio"
2d2bd6af573383bced45e2f610e11193e28fdcdb 16-Jan-2015 Andy Hung <hunga@google.com> Merge "Allow duplicating thread to use native mixing audio format"
fbfc3959f4aac839445edc7075532067fef497c2 15-Jan-2015 Andy Hung <hunga@google.com> Update duplicating thread to use float audio

Previously device format was used, typically pcm 16 bit.

Change-Id: I70a8b594820e948a2caa299194807ec17348b0e9
/frameworks/av/services/audioflinger/Threads.cpp
c25b84abdd7ff229d0af663fbf3a37bd9512939d 15-Jan-2015 Andy Hung <hunga@google.com> Allow duplicating thread to use native mixing audio format

Update OutputTrack to take variable formats.
Previously conversion to AUDIO_FORMAT_PCM_16_BIT was required.

Change-Id: I4a96a60ddd8d8dfe651405a0bcd4f98c89bc1ade
/frameworks/av/services/audioflinger/Threads.cpp
81879df8dc51df4d8a3880349e9e1e6b5e3cebfb 07-Jan-2015 Eric Laurent <elaurent@google.com> am 69158e3e: am 6ab33981: am 610255e8: Merge "audioflinger: pause HW A/V sync output when AudioTrack underruns" into lmp-mr1-dev

* commit '69158e3e7b565a5ca131a2efaa9b76615ca80cbb':
audioflinger: pause HW A/V sync output when AudioTrack underruns
69158e3e7b565a5ca131a2efaa9b76615ca80cbb 07-Jan-2015 Eric Laurent <elaurent@google.com> am 6ab33981: am 610255e8: Merge "audioflinger: pause HW A/V sync output when AudioTrack underruns" into lmp-mr1-dev

* commit '6ab33981d45cd69e683a143fec6530e66bd3e371':
audioflinger: pause HW A/V sync output when AudioTrack underruns
b187de1ada34a9023c05d020a4592686ba761278 30-Dec-2014 Glenn Kasten <gkasten@google.com> Line length 100

Change-Id: I6c8fe626a3825fa9e139319656d682a57b887c97
/frameworks/av/services/audioflinger/Threads.cpp
0f7b5f2b231caf87da9b20b74d086e5a9d6f4a9d 19-Dec-2014 Eric Laurent <elaurent@google.com> audioflinger: pause HW A/V sync output when AudioTrack underruns

Do not standby, starve or feed 0s to the audio HAL on direct
output using HW A/V sync mode.

Bug: 17883772.

Change-Id: I11e6c97ec24360d75f9b602814d40a54b60cb7a7
/frameworks/av/services/audioflinger/Threads.cpp
23c8dc13787186dc98731055858b2fba3aedc105 17-Dec-2014 Eric Laurent <elaurent@google.com> am 85aca658: am d33712d7: am 145cf5d8: Merge "audioflinger: implement pause/resume for direct outputs" into lmp-mr1-dev

* commit '85aca658ac7d20584b0647427256df50a5f243ef':
audioflinger: implement pause/resume for direct outputs
85aca658ac7d20584b0647427256df50a5f243ef 17-Dec-2014 Eric Laurent <elaurent@google.com> am d33712d7: am 145cf5d8: Merge "audioflinger: implement pause/resume for direct outputs" into lmp-mr1-dev

* commit 'd33712d7ec5dcf427cc0be9b7d2ca1c99823c8e6':
audioflinger: implement pause/resume for direct outputs
d1f69b0b17acbd96987ecb2f3378abd394d05903 15-Dec-2014 Eric Laurent <elaurent@google.com> audioflinger: implement pause/resume for direct outputs

Extend pause/resume support to direct output threads
(was only for offload threads).

If the HAL implements pause/resume, track pause/resume is forwarded to
the HAL.

Pause, flush, resume sequence is respected by executing the HAL
calls in the playback thread (same as offload).

Make sure the track flags on client side are consistent with the
flags on server side.

Bug: 17883772.
Change-Id: I89b360d69818f7a9204bd36e3ec63a79e106ecf1
/frameworks/av/services/audioflinger/Threads.cpp
65575de268f4c0d75e6c1172469001ace765fc14 11-Dec-2014 Phil Burk <philburk@google.com> am 2592184c: am 6baa8fe7: am 94a92c69: Merge "[audio][audioflinger] Consume all frames when a DirectThread is done." into lmp-mr1-dev

* commit '2592184c976ef83aa9fdad7d63bfdb408c95aa7d':
[audio][audioflinger] Consume all frames when a DirectThread is done.
2592184c976ef83aa9fdad7d63bfdb408c95aa7d 11-Dec-2014 Phil Burk <philburk@google.com> am 6baa8fe7: am 94a92c69: Merge "[audio][audioflinger] Consume all frames when a DirectThread is done." into lmp-mr1-dev

* commit '6baa8fe747621b7121ff18dcdfab15d99c349c15':
[audio][audioflinger] Consume all frames when a DirectThread is done.
94a92c69af528edf6ec17d7978a0c3bb6ab51e63 11-Dec-2014 Phil Burk <philburk@google.com> Merge "[audio][audioflinger] Consume all frames when a DirectThread is done." into lmp-mr1-dev
99adee3c3d9cde6819741a38163954808fea270a 11-Dec-2014 Phil Burk <philburk@google.com> [audio][audioflinger] Consume all frames when a DirectThread is done.

This bug was causing movies to think there was still data left to play so they never finished.

Bug: 18360054
Change-Id: If7aee81d62b7af8532abd14579677848a06fe2b1
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
b67eb5856203e9869aa1e5b5a13c1eff62790335 10-Dec-2014 Eric Laurent <elaurent@google.com> am b279f5ad: am c49d9cda: am 2dda40d6: Merge "audio policy: add support for custom mixes" into lmp-mr1-dev

* commit 'b279f5adfa2fd6f22c87b3a7106fbb62a0b9a5d2':
audio policy: add support for custom mixes
b279f5adfa2fd6f22c87b3a7106fbb62a0b9a5d2 10-Dec-2014 Eric Laurent <elaurent@google.com> am c49d9cda: am 2dda40d6: Merge "audio policy: add support for custom mixes" into lmp-mr1-dev

* commit 'c49d9cda49dab8b7dd0376cf56476b3e1895d5c6':
audio policy: add support for custom mixes
275e8e9de2e11b4b344f5a201f1f0e51fda02d9c 01-Dec-2014 Eric Laurent <elaurent@google.com> audio policy: add support for custom mixes

Add support for custom mixes in AudioPolicyManager.

Two methods are added to register or unregister a list of custom mixes
with their attributes and format.

getOutputForAttr() and getInputForAttr() first look for a match in
registered mixes before defaulting to normal output/input selection

Remote submix device connection disconnection now takes address into
account to identify the correspnoding custom mix.

Bug: 16009464.

Change-Id: I3f1c2a485a0fb71b1f984ed0adc9b68aa971e408
/frameworks/av/services/audioflinger/Threads.cpp
f849e1984ae639112e125a91e27098cf0ebc68c1 09-Dec-2014 Andy Hung <hunga@google.com> am 900f6535: am 561f50de: am db995fe3: Merge "Fix getTimestamp if offload thread is not initialized." into lmp-mr1-dev

* commit '900f6535af232298e4a77477907a40f68e8dc61b':
Fix getTimestamp if offload thread is not initialized.
900f6535af232298e4a77477907a40f68e8dc61b 08-Dec-2014 Andy Hung <hunga@google.com> am 561f50de: am db995fe3: Merge "Fix getTimestamp if offload thread is not initialized." into lmp-mr1-dev

* commit '561f50de82ce47f11ba8d4f25db1ca1d8467b2a7':
Fix getTimestamp if offload thread is not initialized.
9a1c8892f6835325db6931529dc74bf98cf0aee8 03-Dec-2014 Andy Hung <hunga@google.com> Fix getTimestamp if offload thread is not initialized.

Returns INVALID_OPERATION.

Bug: 18605649
Change-Id: I440fb687fbf9249098e049982fa83bcd1515fd80
/frameworks/av/services/audioflinger/Threads.cpp
3458bb2356e711419487056fe1dd474e100466a3 26-Nov-2014 Eric Laurent <elaurent@google.com> am 121143d5: am bf14c62e: am 72bf901c: Merge "audio policy: new getOutputForAttr() prototype." into lmp-mr1-dev

* commit '121143d5242a790d0bd01fe1b9cec5d28a1ba1d7':
audio policy: new getOutputForAttr() prototype.
121143d5242a790d0bd01fe1b9cec5d28a1ba1d7 26-Nov-2014 Eric Laurent <elaurent@google.com> am bf14c62e: am 72bf901c: Merge "audio policy: new getOutputForAttr() prototype." into lmp-mr1-dev

* commit 'bf14c62e7973ed793a3b00c2c67beca4484c1c7a':
audio policy: new getOutputForAttr() prototype.
3a3e87005fdfbfe4564605220a044b8023d0f539 26-Nov-2014 Eric Laurent <elaurent@google.com> am 72215491: am 1a475921: am 223fd5c9: audio: new routing strategies and stream types

* commit '72215491c60fbcdb9a2f0be782e24e39cca249c5':
audio: new routing strategies and stream types
72215491c60fbcdb9a2f0be782e24e39cca249c5 26-Nov-2014 Eric Laurent <elaurent@google.com> am 1a475921: am 223fd5c9: audio: new routing strategies and stream types

* commit '1a475921c0577a4650d1bbe40a85b732d1766939':
audio: new routing strategies and stream types
e83b55dc29ca16092ba02f36f55fa6e0e37fd78c 14-Nov-2014 Eric Laurent <elaurent@google.com> audio policy: new getOutputForAttr() prototype.

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
/frameworks/av/services/audioflinger/Threads.cpp
223fd5c9738e9665e495904d37d4632414b68c1e 11-Nov-2014 Eric Laurent <elaurent@google.com> audio: new routing strategies and stream types

Added new routing strategies and stream type for internal use
by audio policy manager and audio flinger:
- One for accessibility to allow different routing than media
- One for re-routing (remote submix) in preparation of dynamic
policies
- Added stream type for "internal" audio flinger tracks used
for audio patches and duplication.

Bug: 18067208.
Change-Id: I88f884b552e51e4a49c29125e5a1204cf58ff434
/frameworks/av/services/audioflinger/Threads.cpp
994242df089e1abbd7d1d21d8183b4ad32710948 21-Nov-2014 Glenn Kasten <gkasten@google.com> am c63c0973: am f50db74f: Merge "Fix format conversion in DuplicatingThread" into lmp-mr1-dev automerge: d48f1b6

* commit 'c63c09738772133e9b20a7c8576ad116ff855ee2':
Fix format conversion in DuplicatingThread
c63c09738772133e9b20a7c8576ad116ff855ee2 21-Nov-2014 Glenn Kasten <gkasten@google.com> am f50db74f: Merge "Fix format conversion in DuplicatingThread" into lmp-mr1-dev
automerge: d48f1b6

* commit 'd48f1b68b2b824ffcfdbf6aa67ad4696020a8a11':
Fix format conversion in DuplicatingThread
3dd2eb810af471df146cb16a680b1b0ca7364be5 21-Nov-2014 Glenn Kasten <gkasten@google.com> am d48f1b68: am f50db74f: Merge "Fix format conversion in DuplicatingThread" into lmp-mr1-dev

* commit 'd48f1b68b2b824ffcfdbf6aa67ad4696020a8a11':
Fix format conversion in DuplicatingThread
ec0eeafa8a7fd882e8206e9cf8c4c7e1db81857b 20-Nov-2014 Haynes Mathew George <hgeorge@codeaurora.org> Fix format conversion in DuplicatingThread

DuplicatingThread converts PCM data from the format of the source thread
to PCM_16BIT before writing to all connected output tracks.
This needs to be done just once before writing to all tracks.

Bug: 18461844
Change-Id: If05254f87f9198e09a0fa3c4e857afbb53ae7073
/frameworks/av/services/audioflinger/Threads.cpp
77e79a509d19ab50b1867fe3903b5a8fae450591 17-Nov-2014 Marco Nelissen <marcone@google.com> resolved conflicts for merge of e78a27ca to lmp-mr1-dev-plus-aosp

Change-Id: If10a9cc17245f95d5e10b1507445abbb4020670e
f888020c6e2735624f2b2a30e72aca24e17b8b4d 14-Nov-2014 Marco Nelissen <marcone@google.com> Update calls to IInterface::asBinder()

to use the new static version.

Change-Id: Ia7b10eb38ca55b72278bfd33d3bf647f338b4e6a

Conflicts:
media/libmedia/IAudioFlinger.cpp
media/libmedia/IMediaPlayer.cpp
media/libstagefright/CameraSource.cpp
/frameworks/av/services/audioflinger/Threads.cpp
06b46062d2f8bc82ca3061a23d197734ae51918b 14-Nov-2014 Marco Nelissen <marcone@google.com> Update calls to IInterface::asBinder()

to use the new static version.

Change-Id: I89a5988a0ac694ffc04d88cf939e8455bf925d4c
/frameworks/av/services/audioflinger/Threads.cpp
e77540228e1f60b1129a1615d2e43e0bf8015d3c 31-Oct-2014 Glenn Kasten <gkasten@google.com> Include normal output track buffer depth in systrace

Also log "second chance" sleeps

Change-Id: I6e352948926c246002642a50c92af213e6b79040
/frameworks/av/services/audioflinger/Threads.cpp
4b4ceaabd739b39e0690911afd1ae8f6d5ae9fae 08-Nov-2014 Eric Laurent <elaurent@google.com> am ccfeadcd: audioflinger: fix duplicating thread output buffers clear automerge: 02b5708
automerge: 8510932

* commit '8510932d6e5a1d4628c700fbff8f836abe470713':
audioflinger: fix duplicating thread output buffers clear
02b5708776ba2a9b4ff8c09008483aef7dbe38c7 08-Nov-2014 Eric Laurent <elaurent@google.com> audioflinger: fix duplicating thread output buffers clear

Also clear mix buffer in DuplicatingThread::threadLoop_mix()
instead of just sink buffer when output threads are not
ready.

Bug: 18262127.
Change-Id: I4c22bbeaccdcc8d7c10c5882dde3439eb73d6ede
/frameworks/av/services/audioflinger/Threads.cpp
97b7b75b6a31330e213bdb96ccc60916218ad903 28-Sep-2014 Glenn Kasten <gkasten@google.com> Improve dumpsys for output threads

Display output thread type and flags.
Also add units and use consistent spelling.

Change-Id: I19eb627f41c4887b6ad0543024a8477a99890798
/frameworks/av/services/audioflinger/Threads.cpp
97502a19165de566eaf7525b6967f84adc8aabce 20-Oct-2014 Marco Nelissen <marcone@google.com> am 9f38361f: am 5cc72274: am d61ba0aa: am 36d9256f: am ac302143: Fix the fix

* commit '9f38361fa0ba8fe04b9ba7e21bf25abe20620800':
Fix the fix
ac302143551a8b964f026385a524dda9ff8ea5ba 20-Oct-2014 Marco Nelissen <marcone@google.com> Fix the fix

We need to clear the buffer a little more often.

Bug: 18023017
Change-Id: If8a522b9133a4269e2435af8958f6ced322e71e9
/frameworks/av/services/audioflinger/Threads.cpp
791854d962d8fd53dc267f73bfbd474a8887a1d1 20-Oct-2014 Marco Nelissen <marcone@google.com> am 412b8e71: am 0c2c1619: am 0cfc8f25: am 145a4c67: am 22bc10a3: Merge "Clear effect buffer before sending to chain" into lmp-dev

* commit '412b8e719e77e6e3284b87fd8ae1499d6ae76e06':
Clear effect buffer before sending to chain
57088b5c8e76855b99b3e6b3e410de5b6382670e 18-Oct-2014 Marco Nelissen <marcone@google.com> Clear effect buffer before sending to chain

otherwise the effect might get a buffer with previous data instead
of silence.

Bug: 18023017
Change-Id: Ic6be5ce0e74552aac2a0cce9c660893f9ad27f5c
/frameworks/av/services/audioflinger/Threads.cpp
e49574c22849dd1f53cf78e97d22e61b80a04a6a 03-Oct-2014 Eric Laurent <elaurent@google.com> am b17182d8: am 10b464cf: am 2b217bb3: Merge "audioflinger: fix pre processing transfer between record threads." into lmp-dev

* commit 'b17182d85f147a8d68bba2b4d7ed5e757691b4f4':
audioflinger: fix pre processing transfer between record threads.
2b217bb3aee87ce8486014f261c0f498f6209e80 03-Oct-2014 Eric Laurent <elaurent@google.com> Merge "audioflinger: fix pre processing transfer between record threads." into lmp-dev
e979d5bb0060ad4fb4fb9aa5aefc6f9b722a1bab 03-Oct-2014 Glenn Kasten <gkasten@google.com> am 12d0cd1b: am 3a8bad2e: am be9ebd46: Merge "Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp" into lmp-dev

* commit '12d0cd1bf756ec96755fae2e573659898bfba6d6':
Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp
1b92868010b5c1409692a86f6b27e4a265b64c1a 03-Oct-2014 Eric Laurent <elaurent@google.com> audioflinger: fix pre processing transfer between record threads.

Fix two problems remaining with pre processing effects transfer from
one record thread to the next in case of tear down due to device connection:
1 - the enabled state of the effects was not communicated to the new HAL
input stream.
2 - the effects saved in orphan chains list were not transfered to the
new thread when a AudioRecord was created.

Bug: 17757378.
Change-Id: I0923c98470db3b51154dc89846157780a4c21e86
/frameworks/av/services/audioflinger/Threads.cpp
4c053ea158b29fa2cdd4c6f39d3c8da4ee5a7a02 28-Sep-2014 Glenn Kasten <gkasten@google.com> Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp

The per-thread timestamp latch was not synchronized with the per-track
released frames. Now the value of each track's released frames is
latched along with the timestamp.

Bug: 17531839
Bug: 17669342
Change-Id: I9d50c8c6a5de55a3f4561ac40e20d497376c1257
/frameworks/av/services/audioflinger/Threads.cpp
4113fe9dcbcda53d09f9b9c91f59d9a54e6c2408 02-Oct-2014 Glenn Kasten <gkasten@google.com> am 0e42a880: am e5095be1: am a49c94ea: Merge "Revert "Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp"" into lmp-dev

* commit '0e42a8807edec5541ecac4a050459fbb72c477dc':
Revert "Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp"
a49c94ea49c8329a1bdefe980e1f7d335c0d1ec5 02-Oct-2014 Glenn Kasten <gkasten@google.com> Merge "Revert "Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp"" into lmp-dev
6954127b7ace022677ac407ff943c2793f8a11be 02-Oct-2014 Glenn Kasten <gkasten@google.com> Revert "Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp"

This reverts commit 54464ba861aaafd11ee5645f5d1ecd1171c6e9fe.

Bug: 17733142.

Change-Id: I9886d40032b2f7d96bee03e600e14f78943d8052
/frameworks/av/services/audioflinger/Threads.cpp
ac2a2239dfc86c70f7382bebdb85c8cc1a9f6119 01-Oct-2014 Glenn Kasten <gkasten@google.com> am 785da8f5: am 955e24d3: Merge "Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp" into lmp-dev

* commit '785da8f542120e49d29289947e69aba180c1724b':
Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp
a2dda4fcb3ab34a58c5218bb3a8a156cf04651b2 01-Oct-2014 Eric Laurent <elaurent@google.com> am e0270e79: am f71224ce: Merge "audioflinger: forward flush to direct output streams" into lmp-dev

* commit 'e0270e79066825bb232ef5f271ac9ef84ce91b0f':
audioflinger: forward flush to direct output streams
4cb7073c020fb7d37061be43347fa0a3a7da29ea 30-Sep-2014 Glenn Kasten <gkasten@google.com> am 00cd942e: am 4379c034: Merge "Fix tee sink" into lmp-dev

* commit '00cd942ebe4bf675cad1fbba0d09ba36e419b017':
Fix tee sink
955e24d3a8e218d4711cabc6558781e095011132 30-Sep-2014 Glenn Kasten <gkasten@google.com> Merge "Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp" into lmp-dev
f71224ce266abb39f83ecba87783c2347631654a 30-Sep-2014 Eric Laurent <elaurent@google.com> Merge "audioflinger: forward flush to direct output streams" into lmp-dev
54464ba861aaafd11ee5645f5d1ecd1171c6e9fe 28-Sep-2014 Glenn Kasten <gkasten@google.com> Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp

The per-thread timestamp latch was not synchronized with the per-track
released frames. Now the value of each track's released frames is
latched along with the timestamp.

Bug: 17531839
Bug: 17669342
Change-Id: I96252782911bd42a2534cc4030521b7eeb99a7b9
/frameworks/av/services/audioflinger/Threads.cpp
e659ef420dae0caae84ab78f9df8952acb9ad3a0 29-Sep-2014 Eric Laurent <elaurent@google.com> audioflinger: forward flush to direct output streams

Track flush should be forwarded to the audio HAL when playing
on a direct output stream.

Bug: 17704953.
Change-Id: Iafc94327fe9aebf1d4eaa97b76c6767b7ac5babe
/frameworks/av/services/audioflinger/Threads.cpp
ba0b34c18da93681c0813ecdab19b0e215b6d261 28-Sep-2014 Glenn Kasten <gkasten@google.com> Fix tee sink

Note: this does not fix the bug below, but it helps to investigate the bug.

Bug: 17578238
Change-Id: I0fd27a477b73ba0e1c5a658bdfad17c500f5dc67
/frameworks/av/services/audioflinger/Threads.cpp
137910189b005192ad4019894a970144f7377977 18-Sep-2014 Eric Laurent <elaurent@google.com> am 589e1241: am 2720c8c4: Merge "audioflinger: remove debug log." into lmp-dev

* commit '589e12415e10e291d48c19f63cb47193eb613fb0':
audioflinger: remove debug log.
80b617cf82e0030deef4f968a6341e2867166135 17-Sep-2014 Eric Laurent <elaurent@google.com> audioflinger: remove debug log.

Remove debug log left by commit ab5cdbaf.

bug: 17537746.
Change-Id: I10f672f607f8e87caaa8228fc05eff8aee7dfa15
/frameworks/av/services/audioflinger/Threads.cpp
e716ae7a76941932535cd47ae454423dee598c1e 16-Sep-2014 Eric Laurent <elaurent@google.com> am f5e98702: am cf7863ea: Merge "audioflinger: fix pre processing effect leak" into lmp-dev

* commit 'f5e9870228db68d9cb927ff49f2e46dabfb7bbec':
audioflinger: fix pre processing effect leak
aaa44478a373232d8416657035a9020f9c7aa7c3 13-Sep-2014 Eric Laurent <elaurent@google.com> audioflinger: fix pre processing effect leak

When a capture thread was closed, the effects attached to this thread
were left dangling and the associated effect chain destroyed.
When their last client was disconnected, the effects were not released
properly from the effect library because the destruction process could
not be completed without the effect being attached to a thread.

A similar problem prevented a RecordTrack to be properly released if
its client was destroyed after the capture thread.

The fix consists in allowing the effect or record track to be properly
released even if its parent thread cannot be promoted.

Also save any effect chain still present on a closed capture thread
in case a new client wants to reuse the effects on the same session later.

Bug: 17110064.
Change-Id: I5cd644daa357afd1f3548f9bcb28e6152d95fdb8
/frameworks/av/services/audioflinger/Threads.cpp
f4207cd4024e421bf51e5cd1457dd454f52be68a 08-Sep-2014 Glenn Kasten <gkasten@google.com> am b12d6a17: am 62ce2072: Merge "Make IPowerManager native conform to .aidl for oneway" into lmp-dev

* commit 'b12d6a17d33141789c974e3bd3eacfcb0be1c1e3':
Make IPowerManager native conform to .aidl for oneway
3abc2ded40066f3b1df23aceb553f22d569c5cd3 06-Sep-2014 Glenn Kasten <gkasten@google.com> Make IPowerManager native conform to .aidl for oneway

But provide a temporary escape hatch for AudioFlinger.
This oneway option will be removed as soon as possible.

Bug: 16408906
Change-Id: I058a50906af810787e444a96819cb781b7f639ad
/frameworks/av/services/audioflinger/Threads.cpp
9d1cad2ba6a35168fa27a322518150193f19e53b 03-Sep-2014 Eric Laurent <elaurent@google.com> am 3d640e0a: am 97d547da: audio flinger: fix use of global effect buffer

* commit '3d640e0a93e31bb53e671ed467774b63bb69750e':
audio flinger: fix use of global effect buffer
97d547da43c9c41711d1ed1e3f4fa87c2ee3cb9a 02-Sep-2014 Eric Laurent <elaurent@google.com> audio flinger: fix use of global effect buffer

When float mixing format is enabled, audio effects use a specific
buffer in 16 bit format. This buffer was not enabled when only
global effects were present resulting in the mixer accumulating directly
to the output sink buffer.

Bug: 16202259.
Change-Id: I3537d36c63196d97772f0ab22dd31d04dfa7fdd6
/frameworks/av/services/audioflinger/Threads.cpp
efaa7ab620b2ee936efa4fb74dc4c670ed757a46 20-Aug-2014 Glenn Kasten <gkasten@google.com> Clear the timestamp latch valid flag if no new timestamp available

Bug: 11815245
Change-Id: I94885a1b4c2c7c055b8eacc7f7d0fcd064094b6d
/frameworks/av/services/audioflinger/Threads.cpp
735f45fbc37d7905ffb722f40727edbed82319b7 19-Aug-2014 Glenn Kasten <gkasten@google.com> Fix memory access error due to race during fast track removal

Bug: 16205169
Change-Id: Ie15ec2a737b6ddd16b2d26030d01564ff70177f5
/frameworks/av/services/audioflinger/Threads.cpp
49d00ad9164ea5ce48c85765a2b6460d9b457d38 21-Jul-2014 Glenn Kasten <gkasten@google.com> Fix overruns when capturing with resampling

Bug: 16658148
Change-Id: I2dd04b23a143e0948b299d408790e7a46b5a53b0
/frameworks/av/services/audioflinger/Threads.cpp
cd04484f4837b8ca0041d118286ab6a98e84fc75 07-Aug-2014 Andy Hung <hunga@google.com> Extend downsampling ratios greater than 2:1

Also improve robustness to choice of sampling rate or buffer size
such that increasing either by 10x does not cause overflow.

Bug: 12979141
Bug: 15933066
Change-Id: If7989bd745d1bee3bdf811b8b7c978543ccafb65
/frameworks/av/services/audioflinger/Threads.cpp
389cfdbb9a92a438a0d7710321c2964c7ad55eca 08-Aug-2014 Andy Hung <hunga@google.com> Fix effect and mono sink handling.

Do not permit mixing to mono sink in AudioFlinger.
Allow effects on mono sink if not Mixer thread (e.g. Record).

Bug: 16863095
Change-Id: I8b232fc1fb3f07bf017020c5d4f9ace644dec6d8
/frameworks/av/services/audioflinger/Threads.cpp
cf817a2330936947df94c11859f48771f5596a59 05-Aug-2014 Eric Laurent <elaurent@google.com> audio: fix crashes upon USB device connection

- Audio policy:
Replace unknown device assertion by debug log in setDeviceConnectionState().
It is possible that some kernels indicate connection of a legacy device type
when a USB audio device is connected.
We should just ignore this device.

- Audio flinger:
Make sure FastMixer thread is idle before exiting the normal mixer thread and
closing the output stream.

Change-Id: Ia10a20176a60a8aa56765538093a555fc998508a
/frameworks/av/services/audioflinger/Threads.cpp
4dc680607181e6a76f4e91a39366c4f5dfb7b03e 29-Jul-2014 Eric Laurent <elaurent@google.com> audio policy: pass session ID to capture activity methods

Indicate the audio session ID when calling getInput(),
startInput(), stopInput(), releaseInput().

Bug: 12378680.
Change-Id: I763793752f93e2f4e1445a5ab217c895af011038
/frameworks/av/services/audioflinger/Threads.cpp
8661aaff9e9a4d4c1b57f6a68cdbcab006354ab2 28-Jul-2014 Andy Hung <hunga@google.com> Fix rounding in RecordThread resampler buffer computation

Bug: 16525305
Change-Id: Ie010822b0fa9dec74adde1d1b091ee44c183fc94
/frameworks/av/services/audioflinger/Threads.cpp
9f81de3452dfb2385bd57dc05456a045174a1ab1 28-Jul-2014 Glenn Kasten <gkasten@google.com> Enable lower latency audio capture on more devices

Bug: 16601366
Change-Id: I573b98631f81b7768f7cc00aa09e560008dea587
/frameworks/av/services/audioflinger/Threads.cpp
9a59276fb465e492138e0576523b54079671e8f4 22-Jul-2014 Andy Hung <hunga@google.com> Add multichannel capability to AudioFlinger

But not enabled (kEnableExtendedChannels == false).

Change-Id: I62f7e31fbd29ad703a9a02f5d1a280b6972dd423
/frameworks/av/services/audioflinger/Threads.cpp
83b8808faad1e91690c64d7007348be8d9ebde73 21-Jun-2014 Eric Laurent <elaurent@google.com> audio flinger: add patch connection between hw modules

Add support for audio device connections between different audio
hw modules.
The patch is performed by creating a bridge between the playback
thread connected to the sink device and the record thread connected
to the source device using a pair of specialized PlaybackTrack and
RecordTrack.
- Added PatchTrack and PatchRecord classes.
- Added TrackBase type to indicate more clearly the track behavior.
- A TrackBase can allocate the buffer or reuse an existing one.
- Factored some code in openOutput() and openInput() for internal use
by PatchPanel.

Bug: 14815883.

Change-Id: Ib9515fcda864610458a4bc81fa8f59096ff4d7db
/frameworks/av/services/audioflinger/Threads.cpp
a7e04803ffa0d8d4cc51a122f68bf5038422aabb 21-Jul-2014 Glenn Kasten <gkasten@google.com> Remove execute bit

Change-Id: I1cf0c0d9375779b3074af12f4cbf9c1ec07bf4ff
/frameworks/av/services/audioflinger/Threads.cpp
91be1fbc424035e70688e60306b755893e0fb0ae 17-Jul-2014 Glenn Kasten <gkasten@google.com> Merge "Move AudioRecord frame count calculations to server" into lmp-dev
2e8186a258c934798129847f66171df36e95d23e 17-Jul-2014 Andy Hung <hunga@google.com> Merge "Fix initial audio glitch on startup" into lmp-dev
5567aaf4818007cd8e77329683a91c0f5d7a8837 17-Jul-2014 Andy Hung <hunga@google.com> Fix initial audio glitch on startup

Also happens when restarting AudioFlinger.

Bug: 16322824
Change-Id: I382b20174cb0639e04316130141f2094d7dd0cb3
/frameworks/av/services/audioflinger/Threads.cpp
7410591dad836434c72ddee66680802708b70c10 03-Jul-2014 Glenn Kasten <gkasten@google.com> Move AudioRecord frame count calculations to server

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
/frameworks/av/services/audioflinger/Threads.cpp
6e6704c06d61bc356e30c164081e5bcffb37920c 03-Jul-2014 Glenn Kasten <gkasten@google.com> Improve dumpsys for capture threads

Show per-track sample rate, and whether there is a fast capture thread

Change-Id: If6a08a40d1eeba0690aa8da3c541f845ec101b7f
/frameworks/av/services/audioflinger/Threads.cpp
cd704219d22ec51660103684a680caf2c3a12dad 15-Jul-2014 Glenn Kasten <gkasten@google.com> const correctness on downmix and upmix

Change-Id: I0f51470a6d58a22310ce7cda80afc55e9d6df1dc
/frameworks/av/services/audioflinger/Threads.cpp
463be250de73907965faa6a216c00312bf81e049 11-Jul-2014 Andy Hung <hunga@google.com> Return negotiated format with HAL in AudioFlinger

Fixes an issue caused by extended precision and the FastMixer
when the format to the FastMixer was returned instead of the
HAL format.

Change-Id: I2be9d55d5c87d82e46b5200b07fcdd986ebde08a
/frameworks/av/services/audioflinger/Threads.cpp
5c68f959eaa2e02fed5643c78e281fff42bcc0a2 07-Jul-2014 Glenn Kasten <gkasten@google.com> Merge "IAudioFlinger::openRecord now suggests notificationFrames"
7df8c0b799d8f52d6386e03313286dbd7d5cdc7c 03-Jul-2014 Glenn Kasten <gkasten@google.com> IAudioFlinger::openRecord now suggests notificationFrames

Change-Id: I08885cc381d03c522a23289e74f0e1ed46563863
/frameworks/av/services/audioflinger/Threads.cpp
665470b36f202bcc8ee2f7417f68fd2608dd07c1 04-Jul-2014 Eric Laurent <elaurent@google.com> audio: deprecate audio_stream_frame_size()

Bug: 15000850.
Change-Id: I955a6efa620b8f70fa5193c7853cbe88e879c9c3
/frameworks/av/services/audioflinger/Threads.cpp
f92f22becdf7fce1f55d5ebd80ac2caa2ad55602 30-Jun-2014 Andy Hung <hunga@google.com> Merge "Add enabling variable for extended precision audio"
6146c08f0c3dd8b9e5788063aa433f304a810602 18-Mar-2014 Andy Hung <hunga@google.com> Add enabling variable for extended precision audio

Set AudioFlinger::kEnableExtendedPrecision = true to enable
extended precision. Enabling will be required for devices (such as
USB) which report 24 bit or 32 bit sink formats.

Change-Id: I0dc1d7a4f7607086d7b536ea0e43aef0e696f2ee
/frameworks/av/services/audioflinger/Threads.cpp
4d23ca370dd0ce584f49a80ef9dfcdbb75ba2c8e 13-May-2014 Glenn Kasten <gkasten@google.com> Use sp<> instead of raw pointer for FastMixer

This avoids worry about the thread lifetime during tear-down.

Bug: 15858655
Change-Id: I896d24317bd6f53a574645cdf4cd514eaa205dd5
/frameworks/av/services/audioflinger/Threads.cpp
ab5cdbaf65ca509681d2726aacdf3ac8bfb6b3fa 10-Jun-2014 Eric Laurent <elaurent@google.com> AudioTrack: add support for compressed audio

Add support for compressed audio playback by use
of an AudioTrack attached to a direct output thread.

Bug: 9428304.

Change-Id: I4a61be9cf0e31003ca85935d6e0ee38ca8192e03
/frameworks/av/services/audioflinger/Threads.cpp
5094675aa55458414e8b00a86a104a32ea1d55c0 16-Jun-2014 Glenn Kasten <gkasten@google.com> am a3603693: Merge "Fix deadlock" into lmp-preview-dev

* commit 'a3603693fb784d7e1a820ee4629a69730a0bb424':
Fix deadlock
3d61bc1ffc8afc8d7be3b0d4205c9b5ba6daf2e8 16-Jun-2014 Glenn Kasten <gkasten@google.com> Fix deadlock

Bug: 15591052
Change-Id: I76154e1640646d2ae8fae65e163e1f3ed1be17dc
/frameworks/av/services/audioflinger/Threads.cpp
b6be7f22a82ee3bad8bcc709d21e72fc4727da09 12-Jun-2014 Bryant Liu <bryant_liu@htc.com> frameworks: av: fix bug in the volume management

which can cause volume levels to be applied twice. After applying volume
in the effect chain, the remaining volume needs to be converted back to
floating point before providing to mAudioMixer.

Bug: 15583440
Change-Id: I3c884f95b0fa9ad1b554285b069601c850c54776
Signed-off-by: Glenn Kasten <gkasten@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
c263ca0ad8b6bdf5b0693996bc5f2f5916e0cd49 05-Jun-2014 Glenn Kasten <gkasten@google.com> Squashed commit of the following:

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
/frameworks/av/services/audioflinger/Threads.cpp
8f415570afb174f0781d8bf6b1c0fa6bdecca7cd 03-Jun-2014 Andy Hung <hunga@google.com> Merge "Change parameter type for volume to float in AudioMixer"
6dbb5e3336cfff1ad51d429fcb847307c06efd61 13-May-2014 Glenn Kasten <gkasten@google.com> 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
/frameworks/av/services/audioflinger/Threads.cpp
6be494077f8d7970f3a88129c5d139c5a0c88f6d 30-May-2014 Andy Hung <hunga@google.com> Change parameter type for volume to float in AudioMixer

Change-Id: I4da1505ce852505f86f8e5b87f60e8edceeb30e0
/frameworks/av/services/audioflinger/Threads.cpp
1258c1ab592a899fabb1e31eb5db2ef413b6f38a 24-May-2014 Andy Hung <hunga@google.com> Add multiple format capability to FastMixer

Floating point data from MixerThread into FastMixer.
Multiple output format capability from FastMixer to Sink.

Change-Id: I0da17810ee71381a39a006c46faec71108d22c26
/frameworks/av/services/audioflinger/Threads.cpp
951f455566775e5f01e67c5ee26863d7d19209d7 20-May-2014 Eric Laurent <elaurent@google.com> DO NOT MERGE - audioflinger: first patch panel implementation.

Added a new PatchPanel subclass to AudioFlinger
to handle audio ports and audio patches configuration
and connection.
The first implementation does not add new functionnality.
AudioPolicyManager uses patch panel interface to control
device routing.
AudioFlinger:
- Added PatchPanel class. The first implementation does not
add new functionnality. PatchPanel handles routing commands
for audio HAL after 3.0 or converts to setParameters for audio
HALs before 3.0.
- Added config events to ThreadBase to control synchronized
audio patch connection.
AudioPolicyManager:
- Use PatchPanel API to control device selection isntead of setParameters.
- New base class AudioPort common to audio device descriptors
and input output stream profiles. This class is RefBase and groups
attributes common to audio ports.
- Use same device selection flow for input as for outputs:
getNewInputDevice -> getDeviceForInptusiource -> setInputDevice

Change-Id: Idaa5a883b19a45816651c58cac697640dc717cd9
/frameworks/av/services/audioflinger/Threads.cpp
ecc03733bfd3262ffadef3166e6be23b539c505c 28-May-2014 Eric Laurent <elaurent@google.com> Merge "audioflinger: first patch panel implementation."
0349009fd19f89f8414c428f6b71b369f7546085 27-May-2014 Glenn Kasten <gkasten@google.com> Allow kFastTrackMultiplier to be specified per device

Change-Id: I4eaaaf038df720cec4f5d9221d1b632970f9e3dd
/frameworks/av/services/audioflinger/Threads.cpp
1c333e252cbca3337c1bedbc57a005f3b7d23fdb 20-May-2014 Eric Laurent <elaurent@google.com> audioflinger: first patch panel implementation.

Added a new PatchPanel subclass to AudioFlinger
to handle audio ports and audio patches configuration
and connection.
The first implementation does not add new functionnality.
AudioPolicyManager uses patch panel interface to control
device routing.
AudioFlinger:
- Added PatchPanel class. The first implementation does not
add new functionnality. PatchPanel handles routing commands
for audio HAL after 3.0 or converts to setParameters for audio
HALs before 3.0.
- Added config events to ThreadBase to control synchronized
audio patch connection.
AudioPolicyManager:
- Use PatchPanel API to control device selection isntead of setParameters.
- New base class AudioPort common to audio device descriptors
and input output stream profiles. This class is RefBase and groups
attributes common to audio ports.
- Use same device selection flow for input as for outputs:
getNewInputDevice -> getDeviceForInptusiource -> setInputDevice

Change-Id: Idaa5a883b19a45816651c58cac697640dc717cd9
/frameworks/av/services/audioflinger/Threads.cpp
5912117110ae6efadd862fcb0e395fdcd18aa00c 27-May-2014 Glenn Kasten <gkasten@google.com> Merge "Move validation of frameCount from set to openRecord_l"
c62476f0c0c1cf9283a38852bde0a4c9434df712 24-May-2014 Andy Hung <hunga@google.com> Merge "Add format parameter to getTrackName() and track_t"
29b703eec27b305e7b5b2343bf257643e38f6b68 12-May-2014 Glenn Kasten <gkasten@google.com> 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
/frameworks/av/services/audioflinger/Threads.cpp
87cebadd48710e42474756fc3513df678de045ce 22-May-2014 Elliott Hughes <enh@google.com> resolved conflicts for merge of f285c91e to master

Change-Id: I4c995e297d09c0854a42142cc57dce8b771acf65
c10b874c4d0d6208fb93a7aa0dc8af4418faad45 22-May-2014 Calin Juravle <calin@google.com> am d5516339: Merge "Move frameworks/av from fdprintf to POSIX dprintf."

* commit 'd551633916d3677da4dda10aba6837bdc6803ee0':
Move frameworks/av from fdprintf to POSIX dprintf.
8b5f642eb2364ea7fe46a5b3af51b48b58f12183 22-May-2014 Elliott Hughes <enh@google.com> Move frameworks/av from fdprintf to POSIX dprintf.

Bug: 11156955
Change-Id: Ia98cd16b4c1f7be87cf060b7456de4f40896bacb
/frameworks/av/services/audioflinger/Threads.cpp
e348c5b72ad889389c7c1c900c121f0fbee221b5 22-May-2014 Elliott Hughes <enh@google.com> resolved conflicts for merge of c0bf836f to master

Change-Id: I5cf238fa56d6fff443b212870cf9dd7f1110e7da
ad71caf25e31ecfc4ecf2c925e38fd87905fbc8e 22-May-2014 Elliott Hughes <enh@google.com> am 3b6da6bf: Merge "Move frameworks/av off private API."

* commit '3b6da6bfb50a1c0324fb4c87326d3a477944d5fe':
Move frameworks/av off private API.
ee499291404a192b059f2e04c5afc65aa6cdd74c 22-May-2014 Elliott Hughes <enh@google.com> Move frameworks/av off private API.

Bug: 11156955
Change-Id: Ib3bb9d66a2bf92977c2445b62aa074a2d7a45aea
/frameworks/av/services/audioflinger/Threads.cpp
9382378b6b271949bdce527ea3da748c13c4c692 22-May-2014 Elliott Hughes <enh@google.com> resolved conflicts for merge of b1080917 to master

Change-Id: Iabbe3e95e29f28461ff722b550e8a9f35bd2528f
acbd9492996348bf4565fbaa5a14772f0f4ace38 22-May-2014 Elliott Hughes <enh@google.com> am d084206d: Merge "Move frameworks/av off __futex_syscall3."

* commit 'd084206d5a4a5364211af46e4201311933e83bfc':
Move frameworks/av off __futex_syscall3.
77e1512aee8092069514973379a59a318e721be3 22-May-2014 Elliott Hughes <enh@google.com> Move frameworks/av off __futex_syscall3.

Bug: 11156955
Change-Id: I943080bc51b6efa781059b48b5b5ecc4fa287512
/frameworks/av/services/audioflinger/Threads.cpp
b4db73d022f3de3530bc2b3c9c831ccfdd1a2ead 20-May-2014 Andy Hung <hunga@google.com> Merge "Use new channel count functions for audio masks"
1e54e6dfc1bb8d33089ed8857f0f194e696f85e2 19-May-2014 Glenn Kasten <gkasten@google.com> Merge "Pass stereo gains as packed minifloat"
e8a1ced4da17dc6c07803dc2af8060f62a8389c1 10-May-2014 Andy Hung <hunga@google.com> Add format parameter to getTrackName() and track_t

Change-Id: Ia152a839014e235fbfb656104c15d7c1b456d02e
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
c56f3426099a3cf2d07ccff8886050c7fbce140f 22-Mar-2014 Glenn Kasten <gkasten@google.com> Pass stereo gains as packed minifloat

This will allow (eventually) a greater dynamic range for gains.
However there are still a few remaining places in effects and mixer
that will also need to be changed in order to get the full benefit.

Also fixes a minor bug: was not checking for NaN in AudioTrack C++.

Change-Id: I63bce9e82e0a61546d8ff475fb94bcb700d99c96
/frameworks/av/services/audioflinger/Threads.cpp
5859b98476de3bbb4ae4dc00d4b2f010ca7897d3 19-May-2014 Eric Laurent <elaurent@google.com> am be2664da: am 4c9bde7a: am ce473c32: Merge "Codec Offload: Add NULL check as mCallbackThread is NULL when offloaded HAL is running BLOCKING mode"

* commit 'be2664dac34a6a9d9f754d4097b32158d4947cd2':
Codec Offload: Add NULL check as mCallbackThread is NULL when offloaded HAL is running BLOCKING mode
4c9bde7a3e636d3ecccd7905d142dbbb80e977a0 19-May-2014 Eric Laurent <elaurent@google.com> am ce473c32: Merge "Codec Offload: Add NULL check as mCallbackThread is NULL 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
e541269be94f3a1072932d51537905b120ef4733 16-May-2014 Andy Hung <hunga@google.com> Use new channel count functions for audio masks

Change-Id: Ia658ab4b6320d19fdb50f123c930918724ff0ef3
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
deb9081a61b446dbe50461082974a4228899f178 14-May-2014 Glenn Kasten <gkasten@google.com> Merge "Pull up mFlags and isFastTrack from Track to TrackBase"
56604aa3a56dc8e15532597a0a74b3c7b165e006 13-May-2014 Uday Gupta <guptau@broadcom.com> Codec Offload: Add NULL check as mCallbackThread is NULL
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>
/frameworks/av/services/audioflinger/Threads.cpp
755b0a611f539dfa49e88aac592a938427c7e1b8 13-May-2014 Glenn Kasten <gkasten@google.com> Pull up mFlags and isFastTrack from Track to TrackBase

Change-Id: I6bd48292310be4e05758a11f617f50585904422d
/frameworks/av/services/audioflinger/Threads.cpp
021cf9634ab09c0753a40b7c9ef4ba603be5c3da 13-May-2014 Eric Laurent <elaurent@google.com> AudioFlinger: add specific mutex for client lists

Add a specific mutex to protect access to mClients and
mNotificationClients lists. This avoids locking the main AudioFlinger
mutex from inside thread loops and allows not to worry about
cross deadlocks when sending a config event with status reply while
keeping the ThreadBase or AudioFlinger mutex locked.
As a way of consequence, remove notification client list passed to
processConfigEvents_l() and audioConfigChanged() as the list
can now be accessed by locking client mutex only.

Change-Id: I228022204b6709a8bb60cc96d9514a6ffe59b62e
/frameworks/av/services/audioflinger/Threads.cpp
110135b9610fee8bfa5bac2d9ef4fc4c24991c36 09-May-2014 Glenn Kasten <gkasten@google.com> Explicitly ignore return value of __futex_syscall3

Change-Id: Ic65f257bfc4a0eff7bdd3c44fab68a3f17e2bd08
/frameworks/av/services/audioflinger/Threads.cpp
26d5ff926fa3323b39ae4408bcd29826a9523c9b 10-May-2014 Eric Laurent <elaurent@google.com> Merge "audioflinger: refactor thread config events"
1035194cee4fbd57e35ea15c56e66cd09b63d56e 09-May-2014 Eric Laurent <elaurent@google.com> audioflinger: refactor thread config events

Merge config events and set parameters messaging mechanism.
- setting parameters now uses the config event mechanism
- config event now allow to wait for a condition and synchronize caller
binder thread with execution thread and return an execution status.
- simplify locking mechanism to avoid unlocking the thread
mutex while processing events.

Change-Id: Ia49cb3e617abec4bacb6c1f9a8cb304c4ed3902e
/frameworks/av/services/audioflinger/Threads.cpp
d776ac63ce9c013c9626226e43f7db606e035838 07-May-2014 Glenn Kasten <gkasten@google.com> IAudioFlinger::openRecord returns IMemory(s)

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
/frameworks/av/services/audioflinger/Threads.cpp
b880f5e5fc07397ddd09a94ba18bdf4fa62aae00 07-May-2014 Glenn Kasten <gkasten@google.com> Add a per-thread heap that is read-only to clients

Change-Id: I401263566ca20fbfb565689c8fa99458d3b283b2
/frameworks/av/services/audioflinger/Threads.cpp
828f883a43f66f77d776a75d0ea2b87c7c826071 07-May-2014 Glenn Kasten <gkasten@google.com> Fix a couple of fast capture typo bugs

AudioRecord constructor was not passing flags through to set().
Server-side check was using wrong kind of channel mask.

Change-Id: Ifaa880ec323771e9fd168262be05f3e539f53390
/frameworks/av/services/audioflinger/Threads.cpp
993fa0603707e94ce259e95e56838a85b5ccbdc5 02-May-2014 Glenn Kasten <gkasten@google.com> Use audio_is_linear_pcm()

Change-Id: I17b30fdb6dbb6454ad0a20dd703fd603a37a8397
/frameworks/av/services/audioflinger/Threads.cpp
c125f38cd0ae35409a01b98a99e483550daa1313 12-Apr-2014 Glenn Kasten <gkasten@google.com> audioflinger: forward device change to effects in direct thread

Device change during offload playback is not informed to effect chain
which causes effects still work on unexpected output devices. Add device
change notification in direct output thread.

Original author wjiang <wjiang@codeaurora.org>

CRs-Fixed: 630408
Bug: 14053172
Signed-off-by: Glenn Kasten <gkasten@google.com>
Change-Id: I094a99bdf540479cee2fca6614ec35c2fa7d6046
/frameworks/av/services/audioflinger/Threads.cpp
84a0c6e87c48f58a0d3be71961432c086a4d24cc 02-Apr-2014 Andy Hung <hunga@google.com> Change references of Q19.12 to Q4.27 for clarity

Change-Id: I5beb7daf6ff9bc123ff3582f7c294edcaf8652f6
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
3a6c90aa0617666d9abc94c02b752d9eb3d64772 13-Mar-2014 Glenn Kasten <gkasten@google.com> Add FIXMEs to createRecord for fast capture

Change-Id: I759be200fae32969212c52a409f46f2e704081e3
/frameworks/av/services/audioflinger/Threads.cpp
5c4fa907328c8ee586367272c7525cb87742f14d 26-Mar-2014 Glenn Kasten <gkasten@google.com> Merge "Use LOG_ALWAYS_FATAL instead of LOG_FATAL"
adad3d7d935da176ff24941b4ae9edf7340e9b96 21-Feb-2014 Glenn Kasten <gkasten@google.com> Use LOG_ALWAYS_FATAL instead of LOG_FATAL

LOG_FATAL is compiled out in most builds, so the
assertion checks were not being performed.

Change-Id: I774f0985ab9c5ccecd8989a0f1c940386b73fc35
/frameworks/av/services/audioflinger/Threads.cpp
66e4635cb09fadcaccf912f37c387396c428378a 17-Jan-2014 Glenn Kasten <gkasten@google.com> Use symbolic constants from <system/audio.h>

AUDIO_INTERLEAVE_*
AUDIO_STREAM_MIN
AUDIO_SESSION_ALLOCATE

Change-Id: I31dd6f327204685e50716079ce21c4ba206dff11
/frameworks/av/services/audioflinger/Threads.cpp
2d3ca68363f723fbe269d3ce52dab4985dfc7154 07-Mar-2014 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: OffloadThread fix for resume underrun

AudioFlinger can miss resuming h/w on a pause->resume transition
if sufficient data isn't available

Bug: 11358524.
Change-Id: Ic3c75256290d3515fd4a96dfcc900909fbe5bc15
/frameworks/av/services/audioflinger/Threads.cpp
8d6c292a0bed3d63b5b7297d09a604af6327c663 05-Feb-2014 Krishnankutty Kolathappilly <kkolat@codeaurora.org> audioflinger: Handle pause /resume in stopping state

-Pre-requisite:
Perform seek on the clip. After seek the data remaining till EOS
is little more than the driver and common block buffering.
-Framework state:
Offload thread is waiting for signal from the HAL for a free
buffer. Audio Player calls sink stop on reaching EOS. Audio
track is waiting on obtain buffer for a free space in common
block to send the last buffer. The track is moved to stopping
state as input EOS is reached.
-Issue:
Perform pause/ resume in this state(STOPPING), Audio playback
does not resume.
-Fix
Ensure resume is called in stopping state if frames ready is
greater than zero.

Bug: 12870871

Change-Id: Ib1378c4ee5ce4bea655691e93de0775f7b1d2804
Signed-off-by: Glenn Kasten <gkasten@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
15e5798908ccac14e10c84834eaf08c42931bd06 24-Sep-2013 Glenn Kasten <gkasten@google.com> Make error handling for audio driver initCheck more similar

Change-Id: I8222f00f7ac89d52235af0f64f3fee7a8c471e1e
/frameworks/av/services/audioflinger/Threads.cpp
c3df838434b37d8400eea2438083cc01a4c1cc71 13-Mar-2014 Glenn Kasten <gkasten@google.com> Replace if/else by switch

Change-Id: Ibe96c8fb1f0ba7f850c0561f60769ce63aceba5d
/frameworks/av/services/audioflinger/Threads.cpp
05997e21af6c4517f375def6563af4b9ebe95f39 13-Mar-2014 Glenn Kasten <gkasten@google.com> Whitespace and comments

Change-Id: I99752cca74a459c4746ea4718acb0115439e50bd
/frameworks/av/services/audioflinger/Threads.cpp
5b10a2037a835e790994b9ebec3c2e55052f1f3b 13-Mar-2014 Andy Hung <hunga@google.com> Fix Offload playback in AudioFlinger

This fixes Offload playback regression introduced by adding
flexible format to mSinkBuffer. Test case is AAC file playback.

Bug: 13450717
Change-Id: I0fa11978295ed4793be90c565e5b8abedf156914
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
010a1a1a552cdaad362cea8a0333b8906402dbcb 13-Mar-2014 Andy Hung <hunga@google.com> Revert "Revert "Convert AudioFlinger mSinkBuffer to flexible format""

This reverts commit e2a9c29f35e0c09782558542fc4cf9823779590e.
/frameworks/av/services/audioflinger/Threads.cpp
e2a9c29f35e0c09782558542fc4cf9823779590e 13-Mar-2014 Eric Laurent <elaurent@google.com> Revert "Convert AudioFlinger mSinkBuffer to flexible format"

This reverts commit e7e676fd2866fa4898712c4effa9e624e969c182.

Bug: 13450717.
Change-Id: Ib80b0d14428fecce33c62003a1fcf83f71cee03b
/frameworks/av/services/audioflinger/Threads.cpp
e7e676fd2866fa4898712c4effa9e624e969c182 05-Mar-2014 Andy Hung <hunga@google.com> Convert AudioFlinger mSinkBuffer to flexible format

Change-Id: I618d9c99a5f6f8c8d6a9f4b2d19e82c9ddc3b06e
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
98ef978df4e928f486d244c4d7f7ad9f13111e98 04-Mar-2014 Andy Hung <hunga@google.com> Add mEffectBuffer to AudioFlinger

Change-Id: Icf97c50040bc127723d56eb4d2fb6e790a7253d9
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
f69f9869514730aebe5724c461768507084dfff7 07-Mar-2014 Glenn Kasten <gkasten@google.com> NBAIO::Format_from_SR_C requires audio_format_t parameter

Change-Id: I4b65f6ed2f6ca3608b3a5f88f52a93af0b9b1f4a
/frameworks/av/services/audioflinger/Threads.cpp
e857b65c1d3aa055281cb48f59c9b5eb4a062dd0 07-Mar-2014 Narayan Kamath <narayan@google.com> am 3c9130a8: Merge "Make frameworks/av 64-bit compatible"

* commit '3c9130a8a12ce962dc8d22e04243b135b9e98b01':
Make frameworks/av 64-bit compatible
10ac79930120efea20b125f5faedfe89e8674676 07-Mar-2014 Glenn Kasten <gkasten@android.com> am 5930e8eb: Merge "AudioFlinger: Remove code for supporting resampling in fast tracks"

* commit '5930e8ebdacf3a59c13eef11fd03658ba58b443e':
AudioFlinger: Remove code for supporting resampling in fast tracks
32fbb48de0248518fc5a14099b32fe4b8e9fc102 07-Mar-2014 Glenn Kasten <gkasten@android.com> am 4361749d: Merge "AudioTrack: Never try to use the fast path if resampling is required"

* commit '4361749d74113069aafb0620a1189404205c58d0':
AudioTrack: Never try to use the fast path if resampling is required
55fbfbbbf00722dac3f789be69138445b771a1e1 06-Mar-2014 Glenn Kasten <gkasten@google.com> Merge "Use larger capture pipe since we support resampling by 6:1"
6cbccee701e74fa43a5ea49c15af7dd3267b6699 14-Dec-2013 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: Fix for a deadlock in track creation

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
/frameworks/av/services/audioflinger/Threads.cpp
4f4c9a22f4676c65bcae77f0805dcd699b3ba475 06-Mar-2014 Eric Laurent <elaurent@google.com> am 281dd4e1: audioflinger: fix static track end detection

* commit '281dd4e13309973dbb85bce531f884237e0d8fb0':
audioflinger: fix static track end detection
7028a2c8106ee5a22db88da5dad581820ee07254 05-Mar-2014 Eric Laurent <elaurent@google.com> am 7e92abea: audioflinger: fix offload write buffer offset

* commit '7e92abeafb184e8a34213d7149592e95a72601b0':
audioflinger: fix offload write buffer offset
281dd4e13309973dbb85bce531f884237e0d8fb0 21-Dec-2013 Eric Laurent <elaurent@google.com> audioflinger: fix static track end detection

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
/frameworks/av/services/audioflinger/Threads.cpp
7e92abeafb184e8a34213d7149592e95a72601b0 22-Nov-2013 Eric Laurent <elaurent@google.com> audioflinger: fix offload write buffer offset

Fix current audio HAL write buffer offset calculation
which assumes that the frame size is a multiple of 2.
'
Bug: 12823725.

Change-Id: I0195ed5cfef225a6f114e7dd405a02680bb7254e
/frameworks/av/services/audioflinger/Threads.cpp
21e81bca4d1e6f7d1ccac61b65da7c7a4a121064 05-Mar-2014 Haynes Mathew George <hgeorge@codeaurora.org> am e010f65e: audioflinger: Fix for a deadlock in track creation

* commit 'e010f65e6337267cb15f8894c950a3f64370dd36':
audioflinger: Fix for a deadlock in track creation
50c3157c5a3e0617be77716beff1ae8801d8a72f 04-Dec-2013 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: check for condition before waiting

AsyncCallbackThread must check for any condition that
was already been satisfied before waiting.

Bug: 11824817
Change-Id: I04683a1f355de4f440106cab47fd916aa39d5e35
/frameworks/av/services/audioflinger/Threads.cpp
e010f65e6337267cb15f8894c950a3f64370dd36 14-Dec-2013 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: Fix for a deadlock in track creation

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
/frameworks/av/services/audioflinger/Threads.cpp
788207057ed4b8df4719ed8089f376ef52de9ca1 01-Mar-2014 Andy Hung <hunga@google.com> Rename mSinkFormat to mMixerFormat for AudioMixer::track_t

AudioMixer::SINK_FORMAT also changes to AudioMixer::MIXER_FORMAT

Change-Id: Ic3f8be77d2c75c082c4fd140bc907e30c304d285
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
e842614837e5401adf77e90485300c288b9a7876 01-Mar-2014 Glenn Kasten <gkasten@google.com> Use larger capture pipe since we support resampling by 6:1

This avoids overruns on the client AudioRecord side,
without requiring client to use a large buffer.
It should not increase input latency, since a newly started AudioRecord
always joins the stream starting at the latest data.

Change-Id: Ib2b8de75cc40a6a3d493a1f8b46b41220f69264f
/frameworks/av/services/audioflinger/Threads.cpp
69aed5f0f4a3be3996d1e78a0473e1a72c1547da 26-Feb-2014 Andy Hung <hunga@google.com> Add MixerBuffer for accumulation of float audio

Path into and out of MixerBuffer is set up, but not
currently enabled.

Change-Id: I9d50752607d22dd2a3d9cc7e053babf8dfb22958
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
25c2dac12114699e90deb1c579cadebce7b91a97 27-Feb-2014 Andy Hung <hunga@google.com> Rename mixBufferSize to mSinkBufferSize in AudioFlinger

Change-Id: I4d1d18d716fa3ad8c0e7cc87f5a2823422f504eb
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
09a5007b17acb49d25cfa386a2e2534d942e8854 27-Feb-2014 Andy Hung <hunga@google.com> Rename constants for MixBufferSize to SinkBufferSize

Updated variable names are
kMinNormalSinkBufferSizeMs
kMaxNormalSinkBufferSizeMs

Change-Id: I91969eae3f8c10275db8778634cbf05fdec0712b
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
2098f2744cedf2dc3fa36f608aa965a34602e7c0 27-Feb-2014 Andy Hung <hunga@google.com> Rename mMixBuffer to mSinkBuffer in AudioFlinger

Change-Id: I1f55630425b8ce36e9df2aaf64e06a8960b69a47
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
323da1015a758243c2c43017b026a01c6cf0c6f2 22-Feb-2014 Glenn Kasten <gkasten@google.com> Merge "Account for unreleased frames when predicting resampler needs"
607fa3e928de696eba49f198af72d68e4591ca1b 21-Feb-2014 Glenn Kasten <gkasten@google.com> Account for unreleased frames when predicting resampler needs

Other changes related to resampling:
- improve logs
- use correct form of assert
- don't round up max usable circular buffer sizes to power of 2;
this gives more predictable results
- add some FIXMEs

Bug: 13133176
Change-Id: I8d3c90eed4eb0c0c1fbac3c864e179a2806c2301
/frameworks/av/services/audioflinger/Threads.cpp
8ea16e4b0a7d398d26887c18675b3899de5d779d 21-Feb-2014 Eric Laurent <elaurent@google.com> audioflinger: fix race condition in SyncEvent callback

Now that the SyncEvent callback is implemented by the
RecordTrack instead of the RecordThread, there is a possibility
that the callback is called after the track deletion.

SyncEvent callback now uses a weak pointer instead of
a raw pointer as cookie. This allows the callback implementer to
acquire a strong reference on the object pointed to by the cookie.

Bug: 13114128.
Change-Id: Id61b8f06044ed1e52c6f7e7c666cdede68340de2
/frameworks/av/services/audioflinger/Threads.cpp
4cc0a6a835c806d200ef83ef31fe5bef327c355c 17-Feb-2014 Glenn Kasten <gkasten@google.com> Multi-client recording continued

Remove mReqChannelCount and mReqSampleRate.
Increase number of input frames needed for sample rate converter.
Add TODO comments to investigate later.
Fix bugs in sample rate conversion.

Change-Id: I3aa54b862843d518b6e4ece9a7f52fd27d741629
/frameworks/av/services/audioflinger/Threads.cpp
25f4aa83efaa9179e65a20583a6d441de2c3ff3f 07-Feb-2014 Glenn Kasten <gkasten@google.com> Move handleSyncStartEvent and clearSyncStartEvent to RecordTrack

Change-Id: I611a63e63acf3eb17e2072c1a77b91fe9e62e36a
/frameworks/av/services/audioflinger/Threads.cpp
deca2ae0a7cf8bc54ff3f30b7dc39bbc78b94c0d 07-Feb-2014 Glenn Kasten <gkasten@google.com> Add _l suffix to readInputParameters/OutputParameters

They are always called while thread mutex is locked,
or in the thread constructor.

Change-Id: I56df71563a52a5cd6cea6fc0914df993519e1b74
/frameworks/av/services/audioflinger/Threads.cpp
6dd62fb91d82dedcfa3ab38c02eb0940b4ba932a 06-Dec-2013 Glenn Kasten <gkasten@google.com> Multi-client recording

Supports multiple clients both at native sample rate and with resampling.

Change-Id: Icea55b4fd30751761b7debaa3ce016c79e712d8d
/frameworks/av/services/audioflinger/Threads.cpp
1d6fa7af1288b550faabe4ec2cf98684236723db 11-Feb-2014 Narayan Kamath <narayan@google.com> resolved conflicts for merge of 566be7c3 to master

Change-Id: I7b1cc71057b2bd4f771e7bcf508a8c3abd6017ce
377b2ec9a2885f9b6405b07ba900a9e3f4349c38 03-Feb-2014 Kévin PETIT <kevin.petit@arm.com> Make frameworks/av 64-bit compatible

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
/frameworks/av/services/audioflinger/Threads.cpp
4b76d27d6c4751b31a1cb8ac5e6da1d4b7724a7b 10-Feb-2014 Glenn Kasten <gkasten@android.com> am 5a458ede: am 5930e8eb: Merge "AudioFlinger: Remove code for supporting resampling in fast tracks"

* commit '5a458ede3b7d303723fde4b856532bdc3b94971b':
AudioFlinger: Remove code for supporting resampling in fast tracks
3523e8c40bc60af0c95d1aa71a51a13d69ec80a2 10-Feb-2014 Glenn Kasten <gkasten@android.com> am 4e12dade: am 4361749d: Merge "AudioTrack: Never try to use the fast path if resampling is required"

* commit '4e12dadeec10993d2f77cce96600e73ca0dd86e2':
AudioTrack: Never try to use the fast path if resampling is required
9601c6efcb2552960d6f125d073525b581c1b7ec 10-Feb-2014 Marco Nelissen <marcone@google.com> Merge "Pretty up audioflinger dumpsys"
ec95f0e82a680931e9c7c9011dbbd68d5ab484c8 10-Feb-2014 Glenn Kasten <gkasten@google.com> Merge "Use printf format %#x for audio_format_t in logs"
b220884bf3129253cc5bc8d030bc475411ea4911 07-Feb-2014 Marco Nelissen <marcone@google.com> Pretty up audioflinger dumpsys

Change-Id: I57e44b4c36b99f7149542bbcf9645521c6152dfa
/frameworks/av/services/audioflinger/Threads.cpp
4944acb7355b3aa25748fd25945a363a69d65444 19-Aug-2013 Glenn Kasten <gkasten@google.com> Fix whitespace

Change-Id: I9add0872030a26933f6b6dad1be299154611cc56
/frameworks/av/services/audioflinger/Threads.cpp
cac3daa6332bf6d1f7d26adc4a9915f3d7992dd9 07-Feb-2014 Glenn Kasten <gkasten@google.com> Use printf format %#x for audio_format_t in logs

Change-Id: I1c611d1037685d52ccc84efe0fccd6413ec938e9
/frameworks/av/services/audioflinger/Threads.cpp
4c6a433d74d5ae8b9bc0557207e3ced43bf34a25 15-Jan-2014 Haynes Mathew George <hgeorge@codeaurora.org> AudioFlinger: Offload track transition fix

Trigger state changes in OffloadThread on adding a new offload track.

Bug: 12530661
Change-Id: I95b62764c7ac041d470702e86b951f812eb0e70f
/frameworks/av/services/audioflinger/Threads.cpp
7844f679be8d94c5cdf017f53754cb68ee2f00da 15-Jan-2014 Haynes Mathew George <hgeorge@codeaurora.org> AudioFlinger: Modify flush handling for offload path

Do not allow an offload track to directly control the offload thread
behavior. OffloadThread can check for any pending flush reporting
by its active tracks and decide to flush the HW or not.

Bug: 12530661
Change-Id: Ib33f023c942f6c091b618004136b153c38a6eef6
/frameworks/av/services/audioflinger/Threads.cpp
0f02f265123b7ef2fd6ac09ff70cde26eb5559ad 11-Jan-2014 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: OffloadThread state fix

When switching from one offload session to another that
reuses the same offload output, audio HAL is paused & flushed in
preparation for the new track

OffloadThread must reset mHwPaused to allow proper state transitions
for the second track. In addition, Offload thread need not
explicitly call resume on HAL while handling a flush.

Bug: 12530661
Change-Id: I8173845e1782b5a8b372a82c7d337299a61e0efe
/frameworks/av/services/audioflinger/Threads.cpp
3ce28aa3cb5262775180a8b423cfb4a5670ebc59 05-Feb-2014 Martin Storsjo <martin@martin.st> AudioFlinger: Remove code for supporting resampling in fast tracks

This isn't used at the moment.

Change-Id: I4e0fb2af5f7d959dbafd5ddb7defa1c6b8e8636a
/frameworks/av/services/audioflinger/Threads.cpp
7332c37c459f5f382a9e4105d522d1c5a7f6f0b5 05-Feb-2014 Glenn Kasten <gkasten@google.com> Merge "audioflinger: Fix for a deadlock in track creation"
0f11b51a57bc9062c4fe8af73747319cedabc5d6 01-Feb-2014 Glenn Kasten <gkasten@google.com> Fix unused parameter warnings in audio

Change-Id: I665ba3358dd9502f0adec70d486e7bf8a2e1b0fe
/frameworks/av/services/audioflinger/Threads.cpp
398f21348e5100289f6e5be30c8b5257fa04aaf9 31-Jan-2014 Martin Storsjo <martin@martin.st> AudioTrack: Never try to use the fast path if resampling is required

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
/frameworks/av/services/audioflinger/Threads.cpp
745e9a8283b56c7772ee7d72383a3f2e012e1ef9 21-Dec-2013 Eric Laurent <elaurent@google.com> audioflinger: fix static track end detection

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
/frameworks/av/services/audioflinger/Threads.cpp
03e9e83c47ab4a518da0a1f36b8f702f59221c95 14-Dec-2013 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: Fix for a deadlock in track creation

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
/frameworks/av/services/audioflinger/Threads.cpp
000a4193dd82549192277fd4b9bb571d8a4c262f 30-Jan-2014 Eric Laurent <elaurent@google.com> audioflinger: fix record thread exit pending check

RecordThread loop must not release the mutex after checking for
exitPending and before waiting for a new wake up condition.
This can happen under the hood when methods like processConfigEvents_l()
or checkForNewParameters_l() are called. So exitPending() must
be checked after calling these functions.

Bug: 12787961.
Change-Id: Ia18c518bd5344fbb2401067303fcfe76a86879c4
/frameworks/av/services/audioflinger/Threads.cpp
f0002d142e6d24c5438600b2c259679de710f8ac 24-Jan-2014 Glenn Kasten <gkasten@google.com> Merge "Replace control block frameCount_ by explicit in/out parameter"
0ce5ca5e113d58cbcb7cb48615d6dbbf3fbe7c66 17-Jan-2014 Glenn Kasten <gkasten@google.com> Merge "Cleanup createTrack error handling"
0cde076ddb283c84c3801a2df4cc3df99bd1577f 17-Jan-2014 Glenn Kasten <gkasten@google.com> Cleanup createTrack error handling

Similar to cleanup done earlier for openRecord in this CL:
> Change-Id: I84897dd7d30b370640b54e928f230604b873cb68

Bug: 10888816
Change-Id: I804a47f898e0319a60a9bd58906bbb037e45cc25
/frameworks/av/services/audioflinger/Threads.cpp
5f972c031d4061f4f037c9fda1ea4bd9b6a756cd 13-Jan-2014 Glenn Kasten <gkasten@google.com> AudioRecord::getInputFramesLost() cleanup

Fixed bug that if the binder call failed (for example if the
IAudioFlinger binder is dead), then getInputFramesLost was returning
garbage. Now it correctly returns zero, which is the error value for
this method.

The type declarations for getInputFramesLost were inconsistent:
a mixture of unsigned int, size_t, and uint32_t. Now it returns uint32_t
everywhere, which is what the underlying HAL API returns.

Added a FIXME about the side effect behavior. This will need review
for multi-client.

Change-Id: Ifa2e117a87dbd0c1f2c892a31d1c3dd919bf1a0a
/frameworks/av/services/audioflinger/Threads.cpp
13e4c960ea3db03a43e084fbd85d52aa77f7b871 21-Dec-2013 Eric Laurent <elaurent@google.com> audioflinger: fix static track end detection

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
/frameworks/av/services/audioflinger/Threads.cpp
74935e44734c1ec235c2b6677db3e0dbefa5ddb8 19-Dec-2013 Glenn Kasten <gkasten@google.com> Replace control block frameCount_ by explicit in/out parameter

in IAudioFlinger::createTrack and IAudioFlinger::openRecord

Change-Id: I09c644c80e92c8e744b1b99055988a2588b2a83d
/frameworks/av/services/audioflinger/Threads.cpp
c95616357a911e5c1c55873492b05ebfa3cf1894 04-Dec-2013 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: check for condition before waiting

AsyncCallbackThread must check for any condition that
has already been satisfied before waiting.

Bug: 11824817
Change-Id: Ic8c2090d521ecd6a30b76ee75635258d35eb1eff
/frameworks/av/services/audioflinger/Threads.cpp
688ca6330a5e7d072f67a1791e464fa7dec08b72 17-Dec-2013 Glenn Kasten <gkasten@google.com> am 5c474238: am 5893736d: am a67c7653: Merge "Increase kFastTrackMultiplier from 1 to 2"

* commit '5c474238bc579224ec8f7267d05651b0aa934100':
Increase kFastTrackMultiplier from 1 to 2
a67c76538fff102cd44b2f38dd073df5f2a33605 17-Dec-2013 Glenn Kasten <gkasten@google.com> Merge "Increase kFastTrackMultiplier from 1 to 2"
24a325d6f8c4bbf9330e6ce0c769d46e04266ffc 04-Dec-2013 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: check for condition before waiting

AsyncCallbackThread must check for any condition that
was already been satisfied before waiting.

Bug: 11824817
Change-Id: Ic8c2090d521ecd6a30b76ee75635258d35eb1eff
/frameworks/av/services/audioflinger/Threads.cpp
70aca464f7e39a3b208341f442b6fc2316e17147 05-Dec-2013 Glenn Kasten <gkasten@google.com> Merge "Add RecordThread media.log and deferred deallocation"
0312b69e65e4c8bf6a0c0757d9100dee3651c16e 05-Dec-2013 Glenn Kasten <gkasten@google.com> Merge "Change mActiveTrack to mActiveTracks vector"
481fb67a595f23c5b7f5be84b06db9b84a41a42f 30-Sep-2013 Glenn Kasten <gkasten@google.com> Add RecordThread media.log and deferred deallocation

This change allows a media.log buffer for RecordThread.

Unlike playback threads which stick around forever, the RecordThread comes
and goes for every capture session. This means that the media.log buffer
for a RecordThread would disappear too, and so was useless. Now when a
thread exits, it's associated media.log buffer is just marked for deferred
deallocation. It is only actually freed when the memory is needed.

Other changes:
- Fix bug in unregistering comparison, it was comparing the wrong pointers
- Increased size of log area so we can log for RecordThread also

Change-Id: If45d4c03a793b86390a0112ec3acc5d41b2e3635
/frameworks/av/services/audioflinger/Threads.cpp
b5fed68bcdd6f44424c9e4d12bfe9a3ff51bd62e 03-Dec-2013 Glenn Kasten <gkasten@google.com> Increase kFastTrackMultiplier from 1 to 2

Change-Id: I158f147295eebcea96e4047d7618069bc48bdd7d
/frameworks/av/services/audioflinger/Threads.cpp
866d90595a177f6027e97161781948baebf2aa68 02-Dec-2013 Glenn Kasten <gkasten@google.com> Merge "Code simplification and movement to prepare for mActiveTracks"
480acec40aa2d96119530c7d451282af8cf07327 23-Nov-2013 Glenn Kasten <gkasten@google.com> Merge "Fix bug in creation of EffectHandle when out of memory"
04733dbdede313fc5e291070014c1a0641fe6166 22-Nov-2013 Eric Laurent <elaurent@google.com> audioflinger: fix offload write buffer offset

Fix current audio HAL write buffer offset calculation
which assumes that the frame size is a multiple of 2.

Change-Id: I0195ed5cfef225a6f114e7dd405a02680bb7254e
/frameworks/av/services/audioflinger/Threads.cpp
2b806406ac1ec680b6fe3aaa84c54bdc4e43ad8d 21-Nov-2013 Glenn Kasten <gkasten@google.com> Change mActiveTrack to mActiveTracks vector

The size of mActiveTracks is still limited to 1 for now.

Change-Id: Ia6b06b25d8c4709f087110ae29c589999407a2a2
/frameworks/av/services/audioflinger/Threads.cpp
f10ffec18f930d92e1abe9200d60e746831841a7 21-Nov-2013 Glenn Kasten <gkasten@google.com> Code simplification and movement to prepare for mActiveTracks

Share code to acquire wake lock at entry to loop

Change-Id: I01fb645de9417055c0adfc6a4c4011bf22ea4f94
/frameworks/av/services/audioflinger/Threads.cpp
e75da4004b2c814987aa2adf8a76190f92d99c65 20-Nov-2013 Glenn Kasten <gkasten@google.com> Fix bug in creation of EffectHandle when out of memory

If there is insufficient client memory to create the EffectHandle,
it was returning a handle which would be useless. Now it correctly
reports the out-of-memory error back to client.

Change-Id: I894e65d5d17df39383032c1527be6ccd35f578bb
/frameworks/av/services/audioflinger/Threads.cpp
731076cc7857fe322eed018569a2a67f6eac0e54 15-Nov-2013 Eric Laurent <elaurent@google.com> am 06d62548: am d7e59228: audioflinger: do not use raw pointer for tracks

* commit '06d6254823b8f7a46690369e57b5f149c94c9f65':
audioflinger: do not use raw pointer for tracks
d7e59228caad3867794d847f6bf163c6495e9506 15-Nov-2013 Eric Laurent <elaurent@google.com> audioflinger: do not use raw pointer for tracks

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
/frameworks/av/services/audioflinger/Threads.cpp
561879df42b65f44b83c391d78d351e9ad4cb162 14-Nov-2013 Eric Laurent <elaurent@google.com> am 307aa870: am 4215e616: Merge "audioflinger: fix offload track transition" into klp-dev

* commit '307aa87038017dff8ae1dd0262c0ff87723894d7':
audioflinger: fix offload track transition
b04b25321dd323142eec7c5136c81dea3629cf14 14-Nov-2013 Eric Laurent <elaurent@google.com> am b50fa77b: am 9f357f31: Merge "audioflinger: fix offload resume after drain" into klp-dev

* commit 'b50fa77b2cc7dadae1b8ebb591d42976879ac43c':
audioflinger: fix offload resume after drain
9da3d9573a18ffe08365557c706cf52f09118d1c 13-Nov-2013 Eric Laurent <elaurent@google.com> audioflinger: fix offload track transition

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
/frameworks/av/services/audioflinger/Threads.cpp
1b9f9b134e732a48198e51f16424f330cbf03143 13-Nov-2013 Eric Laurent <elaurent@google.com> audioflinger: fix offload resume after drain

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
/frameworks/av/services/audioflinger/Threads.cpp
579dd27d96497022e534e859c6ebbec675ee07aa 08-Nov-2013 Glenn Kasten <gkasten@google.com> Fix build

Change-Id: I1ecccada22047d9c828152a53ad68b5599ff8827
/frameworks/av/services/audioflinger/Threads.cpp
8594843c15b4722ced39436fe9e64f3e57e7ace4 19-Aug-2013 Glenn Kasten <gkasten@google.com> Pull HAL reads out of RecordThread resample

Previously, the resample was indirectly calling HAL read
from within the BufferProvider's getNextBuffer. Now the HAL
read is done ahead of time into a circular buffer,
and the getNextBuffer just reads out of that memory.

This change will permit some future planned features.

Also removed the mono to mono resampling optimization,
as that optimization will no longer be valid in the future.

Change-Id: I59f5016a2df91078d697c37a7dec2d9d9f44542e
/frameworks/av/services/audioflinger/Threads.cpp
d8a1de6204829b0379bbd13042f1450bdb203f2b 08-Nov-2013 Glenn Kasten <gkasten@google.com> Merge "Channel counts are uint32_t"
f551e9961a6f66d63bb57f288c4be01b00725289 20-Aug-2013 Glenn Kasten <gkasten@google.com> Channel counts are uint32_t

Change-Id: I5676b6a291b72d7db6326f7eaf6d17588de51b05
/frameworks/av/services/audioflinger/Threads.cpp
09faf14b434bec0d184fecec947e3d750bcc64ff 07-Nov-2013 Glenn Kasten <gkasten@google.com> Merge "Rename standby methods"
0699ed950b307663e0f7e01aecdfb505e62df7d6 06-Nov-2013 Glenn Kasten <gkasten@google.com> Merge "Move local declarations to point of first use"
44f412a81dcca8f7149d483eeeee9057ad0101cf 06-Nov-2013 Eric Laurent <elaurent@google.com> am 44dc9155: am 48b6cd98: Merge "audioflinger: fix direct output underrun" into klp-dev

* commit '44dc91554521eaab478674a7f812cb8a4fa4f809':
audioflinger: fix direct output underrun
7bb88779cdc1a1fe1445d6d1691fb7daac932e74 06-Nov-2013 Glenn Kasten <gkasten@google.com> Merge "Rename TrackPaused to trackPaused"
1b3ec0f33cbdcac5e148c23abc5bc4f68d780ed4 06-Nov-2013 Glenn Kasten <gkasten@google.com> Merge "Use const more places"
a23f17ac334ff20a11ee63dd177cb1080e44c483 06-Nov-2013 Eric Laurent <elaurent@google.com> audioflinger: fix direct output underrun

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
/frameworks/av/services/audioflinger/Threads.cpp
93e471f620454f7de73d190521568b1e25879767 19-Aug-2013 Glenn Kasten <gkasten@google.com> Rename standby methods

ThreadBase::standby() returns the value of mStandby.

RecordThread::standby() "overrode" ThreadBase::standby(), but with a
different meaning and no return value. This meant you couldn't
access the parent's class definition within RecordThread.

This could be confusing, so this CL renames RecordThread::standby()
to standbyIfNotAlreadyInStandby().

Change-Id: I9196ee12701dd2dccdfaed922af2d7b8e8774676
/frameworks/av/services/audioflinger/Threads.cpp
b91aa63779ad1ce1846fbc604f9ec935e0c67852 19-Aug-2013 Glenn Kasten <gkasten@google.com> Move local declarations to point of first use

Change-Id: I8a078386e371caab5174fc07b47f48fb9f21609a
/frameworks/av/services/audioflinger/Threads.cpp
e6f35b13567d920af19f0b8dc35f9120b7cf1dc9 19-Aug-2013 Glenn Kasten <gkasten@google.com> Rename TrackPaused to trackPaused

Change-Id: I3b38e0c9a6bbb6e18cb5b1f72670139a3071cb8f
/frameworks/av/services/audioflinger/Threads.cpp
b2737d0b33c17e408d96d6f9eeaa3381479c94c7 19-Aug-2013 Glenn Kasten <gkasten@google.com> Use const more places

Change-Id: Ibc068d319d6fff26f2d11248e17481d8f7f027e0
/frameworks/av/services/audioflinger/Threads.cpp
1c7258b3c34b5656de92d845f6366a0f3ac1e0c6 31-Oct-2013 Eric Laurent <elaurent@google.com> am 4cf799fb: am 5c7ffaed: Merge "AudioFlinger: fix duplicating thread standby." into klp-dev

* commit '4cf799fbbb74de102d34ccb014ba7fbd9bfa5e14':
AudioFlinger: fix duplicating thread standby.
2c3740f01acca69c3e0bcc5e01bb0edc51b6777f 31-Oct-2013 Eric Laurent <elaurent@google.com> AudioFlinger: fix duplicating thread standby.

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
/frameworks/av/services/audioflinger/Threads.cpp
d21952fe5bc94f7bb6ee729f806c0e641fdb1a0d 29-Oct-2013 Eric Laurent <elaurent@google.com> am 7f8f7585: am fd477974: AudioFlinger: more fixes for offload audio lost

* commit '7f8f758506a95d6fe5c0e52aa7b5ef82fb18861a':
AudioFlinger: more fixes for offload audio lost
fd4779740ec3e9e865d5514464df26d015354388 26-Oct-2013 Eric Laurent <elaurent@google.com> AudioFlinger: more fixes for offload audio lost

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
/frameworks/av/services/audioflinger/Threads.cpp
9cae217050aa1347d4ac5053c305754879e3f97f 14-Jan-2013 Marco Nelissen <marcone@google.com> Assign blame for playback wakelocks.

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
/frameworks/av/services/audioflinger/Threads.cpp
462fd2fa9eef642b0574aa7409de0bde3fec8d43 14-Jan-2013 Marco Nelissen <marcone@google.com> Assign blame for playback wakelocks.

Set a work source for the playback wakelock, so that playback is
counted against the requesting app instead of the media server.

Change-Id: I7329f88a288a95a582a78005a1c3d16a5a611e31
/frameworks/av/services/audioflinger/Threads.cpp
6a7327f110b86613e6e8c7de105c49803acacc1d 18-Oct-2013 Eric Laurent <elaurent@google.com> am 6edd8ca5: am 6a51d7ed: audioflinger: fix track terminated before playing

* commit '6edd8ca5b7e3d169db4314d2b994bc9d48e9e082':
audioflinger: fix track terminated before playing
6a51d7ed7062536ccc892c8850a34ed55cbc8d5c 18-Oct-2013 Eric Laurent <elaurent@google.com> audioflinger: fix track terminated before playing

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
/frameworks/av/services/audioflinger/Threads.cpp
3278eed31fcf82045ac00dcd549dda5270c88971 15-Oct-2013 Narayan Kamath <narayan@google.com> am 8580679e: am 014e7fa2: Make Audio wakelock names less unique.

* commit '8580679e1780617d978d28a43e932314b86608ce':
Make Audio wakelock names less unique.
014e7fa2e90827d911c37bb0ce4d2e10e14d0bb3 14-Oct-2013 Narayan Kamath <narayan@google.com> Make Audio wakelock names less unique.

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
/frameworks/av/services/audioflinger/Threads.cpp
35295078ab59c8c5d143a54d5a55557c3ca62c51 07-Oct-2013 Glenn Kasten <gkasten@google.com> resolved conflicts for merge of 9a7d11f0 to master

Change-Id: Ie4d101185a93d37ec280f608813ad62a077a584e
fee4ce338d78eeb58af1f66831ead53322d3859e 07-Oct-2013 Glenn Kasten <gkasten@google.com> Merge "Cleanup openRecord error handling" into klp-dev
61f58c0c8d02970ea6d94ff816c54bf606f755b7 05-Oct-2013 Eric Laurent <elaurent@google.com> am c22a1a49: am ea0fadeb: audioflinger: offload: fix pause/flush/resume

* commit 'c22a1a495c26b8a36fa15233cc136cb6ce6d6bea':
audioflinger: offload: fix pause/flush/resume
ea0fadeb5d81ef3cb7f9db458c9033d628bdb86a 05-Oct-2013 Eric Laurent <elaurent@google.com> audioflinger: offload: fix pause/flush/resume

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
/frameworks/av/services/audioflinger/Threads.cpp
1c7feca9cc3e408dfeb632e7060cf31e5015227e 04-Oct-2013 Eric Laurent <elaurent@google.com> am 6c48a011: am 026c5b07: Merge "audioflinger: fix wake lock acquisition check" into klp-dev

* commit '6c48a01188746202164f8e10d63ff3775dfcf727':
audioflinger: fix wake lock acquisition check
547789d25dc6bd6561553bcf6b384fb0d4fee834 04-Oct-2013 Eric Laurent <elaurent@google.com> audioflinger: fix wake lock acquisition check

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
/frameworks/av/services/audioflinger/Threads.cpp
5918e0cb64200f64632595f7aea6062c65d43353 04-Oct-2013 Marco Nelissen <marcone@google.com> am b5677882: am 8097068d: Merge "Better recording wake lock accounting" into klp-dev

* commit 'b5677882cf9a34bd3f2daf76d10951282ea9b083':
Better recording wake lock accounting
8097068de97c0cdab8150931f290edbd5b3721e5 03-Oct-2013 Marco Nelissen <marcone@google.com> Merge "Better recording wake lock accounting" into klp-dev
e14a5d6d2cc91dd2fc09ffdf7aa670b37da0795d 03-Oct-2013 Marco Nelissen <marcone@google.com> Better recording wake lock accounting

Count wake lock use against the app that initiated the recording,
not against the media server.

b/10985160

Change-Id: Iae6e6c030b7f1c6081d9c79725d6990f60dadaaa
/frameworks/av/services/audioflinger/Threads.cpp
34717c83733def81287e2b4ba2f62b416325c7ae 02-Oct-2013 Eric Laurent <elaurent@google.com> am 3424d6e1: am 1adf20ce: Merge "fix volume and effect enable delay on offloaded tracks" into klp-dev

* commit '3424d6e17637e0743ddf3bf4688af8ee36e69264':
fix volume and effect enable delay on offloaded tracks
a6c7d98033c161592a062c61eaa6b7fd635e3006 30-Sep-2013 Eric Laurent <elaurent@google.com> am 0adc67df: Merge "audioflinger: fix crash when starting offload thread" into klp-dev

* commit '0adc67dfc5cedb211c36f06849681a60a32f5805':
audioflinger: fix crash when starting offload thread
59fe010bcc072597852454a2ec53d7b0a2002a3b 28-Sep-2013 Eric Laurent <elaurent@google.com> fix volume and effect enable delay on offloaded tracks

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
/frameworks/av/services/audioflinger/Threads.cpp
4de95592980dba88a35b3dc8f3fd045588387a4f 27-Sep-2013 Eric Laurent <elaurent@google.com> audioflinger: fix crash when starting offload thread

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
/frameworks/av/services/audioflinger/Threads.cpp
e93cf2ca27ae6f4a81d4ef548bbf10a34db6d98f 24-Sep-2013 Glenn Kasten <gkasten@google.com> Cleanup openRecord error handling

Bug: 10888816
Change-Id: I84897dd7d30b370640b54e928f230604b873cb68
/frameworks/av/services/audioflinger/Threads.cpp
c0dab528e8c63abce2022a391dface95c3ef67e5 24-Sep-2013 Eric Laurent <elaurent@google.com> am a57e2ab5: am 664539d2: audioflinger: fix ro.audio.silent in offload again

* commit 'a57e2ab58a17d3da35593a6c85f65e19249e9ebc':
audioflinger: fix ro.audio.silent in offload again
664539d25180ab8f77e0521533ea2821cf28985f 24-Sep-2013 Eric Laurent <elaurent@google.com> audioflinger: fix ro.audio.silent in offload again

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
/frameworks/av/services/audioflinger/Threads.cpp
0230a2a8a413076a138db4c4e1dea018104fd5e2 20-Sep-2013 Eric Laurent <elaurent@google.com> am c6bed216: am a3b97ad2: Merge "audioflinger: implement getTimestamp() for offloaded tracks" into klp-dev

* commit 'c6bed216e3a759a855ac4b9b743fbaed2d5929c1':
audioflinger: implement getTimestamp() for offloaded tracks
d2b80a1fb90cb4dc3f569e716af0279c1e1ea72d 20-Sep-2013 Eric Laurent <elaurent@google.com> am ce3e7cb0: am fbb2609f: Merge "audioflinger: fix lost offload thread resume event" into klp-dev

* commit 'ce3e7cb0bd09e7861d417b7d45c1e5921f10a93f':
audioflinger: fix lost offload thread resume event
a3b97ad288e6808c54c6275eaac1bd53108d8f11 20-Sep-2013 Eric Laurent <elaurent@google.com> Merge "audioflinger: implement getTimestamp() for offloaded tracks" into klp-dev
accc147666bfd37fc8b4ef745f18a8c751555ec2 20-Sep-2013 Eric Laurent <elaurent@google.com> audioflinger: implement getTimestamp() for offloaded tracks

Bug: 9587132.
Change-Id: Ie9d5f4cca96306d08bc9a2dbd6edd8953096702d
/frameworks/av/services/audioflinger/Threads.cpp
ede6c3b8b1147bc425f7b923882f559a513fe23b 19-Sep-2013 Eric Laurent <elaurent@google.com> audioflinger: fix lost offload thread resume event

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
/frameworks/av/services/audioflinger/Threads.cpp
dc8cae8c118e4aef4ef1f7b2c6f79becc1df4a05 18-Sep-2013 Eric Laurent <elaurent@google.com> am bf5e2397: am 5baf2af5: more support for audio effect offload

* commit 'bf5e23979a03da96ce1d63126c480103232f174b':
more support for audio effect offload
5baf2af52cd186633b7173196c1e4a4cd3435f22 13-Sep-2013 Eric Laurent <elaurent@google.com> more support for audio effect offload

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
/frameworks/av/services/audioflinger/Threads.cpp
6d07d9bd2e0549ca2682ad9e94118feee1f733f6 14-Sep-2013 Eric Laurent <elaurent@google.com> am 029838a9: am 7f91e5e0: Merge "audioflinger: fix ro.audio.silent in offload mode" into klp-dev

* commit '029838a98c9377299ef3341e21e9378fd5562ab6':
audioflinger: fix ro.audio.silent in offload mode
d455cdfad40ca0558b8f4f800ec192027e272c14 14-Sep-2013 Eric Laurent <elaurent@google.com> am c91eb605: am 972a173d: audioflinger: longer offload thread standby delay

* commit 'c91eb6059a6af8b84c48e0ce727b01829f9cd789':
audioflinger: longer offload thread standby delay
7f91e5e09cf3bd8068894b2e54cbdaac70bf53a0 14-Sep-2013 Eric Laurent <elaurent@google.com> Merge "audioflinger: fix ro.audio.silent in offload mode" into klp-dev
1abbdb4429479975718421c4fef3f79ce7c820e3 14-Sep-2013 Eric Laurent <elaurent@google.com> audioflinger: fix ro.audio.silent in offload mode

Change-Id: I5a1a79000d53146689b0a198cc5419c36509703f
/frameworks/av/services/audioflinger/Threads.cpp
972a173d7d1de1a3b5a617aae3e2abb6e05ae02d 04-Sep-2013 Eric Laurent <elaurent@google.com> audioflinger: longer offload thread standby delay

- 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
/frameworks/av/services/audioflinger/Threads.cpp
d5577f26de1ae3a0dc6fbea9c60a07d585f894bf 12-Sep-2013 Eric Laurent <elaurent@google.com> am 4823964d: am efc4d489: Merge "audioflinger: add HOTWORD audio source." into klp-dev

* commit '4823964d198228289ff21530bf8b01bb2ef196bb':
audioflinger: add HOTWORD audio source.
9a54bc27876acd5d8be5b1fc3dc46701fe76fbb3 09-Sep-2013 Eric Laurent <elaurent@google.com> audioflinger: add HOTWORD audio source.

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
/frameworks/av/services/audioflinger/Threads.cpp
bfc4214079875f0dc8c349e8c475d1813c234e67 06-Sep-2013 Eric Laurent <elaurent@google.com> am 99b84e8b: am 3b4529e0: audioflinger: remove async write race conditions

* commit '99b84e8b013a6e0b926693067b00e82cfbe2ca4f':
audioflinger: remove async write race conditions
3b4529e03c5fc7a44c22f9091ad15a269bfca3a8 06-Sep-2013 Eric Laurent <elaurent@google.com> audioflinger: remove async write race conditions

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
/frameworks/av/services/audioflinger/Threads.cpp
a7fef85e7d419a4f5d6a3144f9ba70ceff2f122a 04-Sep-2013 Glenn Kasten <gkasten@google.com> am f81d5fc1: am 943ba3cc: Merge "Add NBAIO_Sink::getTimestamp()" into klp-dev

* commit 'f81d5fc1d67a5252d0da1a45274460c4dd33b87b':
Add NBAIO_Sink::getTimestamp()
767094dd98b01baf21de2ad09c27b3c98776cf73 23-Aug-2013 Glenn Kasten <gkasten@google.com> Add NBAIO_Sink::getTimestamp()

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
/frameworks/av/services/audioflinger/Threads.cpp
0fd582e3ce5243c3e5a429fee3330aafc69b69fa 31-Aug-2013 Eric Laurent <elaurent@google.com> am 5d8cbf41: am 6bf9ae20: audioflinger: offloaded tracks flush/pause order

* commit '5d8cbf41ee7e511d20a649e240d6aecbbac3fae7':
audioflinger: offloaded tracks flush/pause order
6bf9ae20b3bd2dbb8f2e89ee167a6785222301cf 31-Aug-2013 Eric Laurent <elaurent@google.com> audioflinger: offloaded tracks flush/pause order

Make sure that a flush received after a pause is forwarded
to the HAL after the pause.

Change-Id: Ib3221f70c59f8b3dbbac20b23104f6b779b75be0
/frameworks/av/services/audioflinger/Threads.cpp
f557872b594d15599bdb65efd91eb5adeb1d0840 30-Aug-2013 Glenn Kasten <gkasten@google.com> am 908d3c09: am 51ec03c2: Merge "Implement Track::getTimestamp()" into klp-dev

* commit '908d3c09ca7f2ccb280aa5dc8d876099ff9a9d0f':
Implement Track::getTimestamp()
bd096fd9d8e5fc0e62f98807f4818a06f70d0812 23-Aug-2013 Glenn Kasten <gkasten@google.com> Implement Track::getTimestamp()

using a new timestamp latch in PlaybackThread, and
AudioTrackServerProxy::framesReleased() which returns mServer.

Change-Id: I1ebfba968c773faaab95648c272fd3ebd74718d6
/frameworks/av/services/audioflinger/Threads.cpp
7165268ffa6c7b6b405b6afad82e2a346500e8ee 15-Aug-2013 Glenn Kasten <gkasten@google.com> Don't lock and then immediately unlock effect chains

Change-Id: Id9a4b1e9c49cecfd3a008a7814b5c14dad9a5831
/frameworks/av/services/audioflinger/Threads.cpp
b86432b1d62e7c9034223f0120b9bceb44215c41 15-Aug-2013 Glenn Kasten <gkasten@google.com> Fix races in reading activeTrack->mState without lock

Change-Id: I8cfbd9884fa5959a846ddb52cdc797266b896769
/frameworks/av/services/audioflinger/Threads.cpp
9e98235a9e9bb870e1c76911e3b4d00386a52c39 14-Aug-2013 Glenn Kasten <gkasten@google.com> Simplify flow by having all mActiveTrack.clear() continue

Change-Id: Icd160b0aa79a747bd19fabaa7feee813afb155e0
/frameworks/av/services/audioflinger/Threads.cpp
5edadd46c76c5ff1c3edabf2ea943c2278e82e1c 15-Aug-2013 Glenn Kasten <gkasten@google.com> Don't sleep with effect chains locked

Change-Id: I6eae037304d3dc8a8f3ef55c5b210fd4f8856e99
/frameworks/av/services/audioflinger/Threads.cpp
ad5bcc29b216412dbc4d936c270d30620c68f361 14-Aug-2013 Glenn Kasten <gkasten@google.com> Copy mActiveTrack for stability and easier access

Change-Id: If0d88610ec35128054a22f42b2d79f07c4b724eb
/frameworks/av/services/audioflinger/Threads.cpp
1ba19cd7fcdf18ab6efab2a1b831affab9a46157 14-Aug-2013 Glenn Kasten <gkasten@google.com> Simplify code by pulling up mActiveTrack == 0 test

Change-Id: I225bb032b2fde97d891191f3599d9850c2d27bb2
/frameworks/av/services/audioflinger/Threads.cpp
d9fc34fb0fcfcc739f868b116edf50c62af19d5e 14-Aug-2013 Glenn Kasten <gkasten@google.com> Remove dead 'if'

Change-Id: I23c082f0115ae598cad293be0ac66a130afb692a
/frameworks/av/services/audioflinger/Threads.cpp
4ef0b463a56c19bad9197aa9f90d792090461429 14-Aug-2013 Glenn Kasten <gkasten@google.com> Fix race in checking exitPending() in RecordThread::threadLoop()

Change-Id: I97a1c5ab17a6c334d275be794392dcf6c9a88d0e
/frameworks/av/services/audioflinger/Threads.cpp
2cfbf88b89854f30b295e8ae26a031edb8d712f8 14-Aug-2013 Glenn Kasten <gkasten@google.com> Simplify code that checks for record standby

Take advantage of the new processConfigEvents_l()
and it's post condition that mConfigEvents is empty.

Change-Id: Icd40fb175f3e374203c9c8d2e9df2c3929bed89b
/frameworks/av/services/audioflinger/Threads.cpp
26a4029c95620a2b98187cf003cd3c58eea03747 14-Aug-2013 Glenn Kasten <gkasten@google.com> checkForNewParameters_l returns a value which is currently ignored

Change-Id: I19b9cc9df094d67560f6e832d94fa284dca18687
/frameworks/av/services/audioflinger/Threads.cpp
d5418eb594435c958d6c37fa9938161a0112adbd 14-Aug-2013 Glenn Kasten <gkasten@google.com> Use Autolock where possible

Change-Id: Id0e1836831c45beda4e5cb11e983005ea699fc2a
/frameworks/av/services/audioflinger/Threads.cpp
f777331418a86cd9fd709af898ef24a69967aeb4 14-Aug-2013 Glenn Kasten <gkasten@google.com> Add ThreadBase::processConfigEvents_l()

Change-Id: I6bcdc212a984c52ab98b0b0744943b4ecc1e1542
/frameworks/av/services/audioflinger/Threads.cpp
c527a7c2b1bfd26e8f3086e1b653d56e521379d9 14-Aug-2013 Glenn Kasten <gkasten@google.com> Pull in scope of effectChains

Change-Id: Id5336f8663099088a0958fb8bd59fc5df9f92829
/frameworks/av/services/audioflinger/Threads.cpp
47c2070b2ce8aedb7300c0aad91caccf3c383841 14-Aug-2013 Glenn Kasten <gkasten@google.com> Add record thread locking comments and FIXMEs

Change-Id: Ia5bdc9b8b013c2e40af17c82833051290bf4df70
/frameworks/av/services/audioflinger/Threads.cpp
2d94426cd3302cb1215c92c5f1c4b90c24ceb72b 13-Aug-2013 Glenn Kasten <gkasten@google.com> Convert if/else-if in threadLoop to switch

Change-Id: I7428abb332ead6c2a1df5903f6c4e166be1f7abb
/frameworks/av/services/audioflinger/Threads.cpp
3468e8a4d79cc6a7bb0f03f8382426195bed44df 14-Aug-2013 Glenn Kasten <gkasten@google.com> Fix switch indentation to follow our audio style

Change-Id: I137763917962b276838715319b163c763cb54c71
/frameworks/av/services/audioflinger/Threads.cpp
34fca34606b448e6b71c2942f63cb13a0aebd620 13-Aug-2013 Glenn Kasten <gkasten@google.com> Explicit comparison to 0 for integral types

Change-Id: I2bfe864d1bda719581e297a38d96abfc0e3748b9
/frameworks/av/services/audioflinger/Threads.cpp
6e2ebe97f2ad0a21907f20f9ee644c4eacbb7a40 13-Aug-2013 Glenn Kasten <gkasten@google.com> Use curly braces in 'if' to make it easier to add logs

Change-Id: I58b33fefdd8bf703647414157a99a3223be3531c
/frameworks/av/services/audioflinger/Threads.cpp
e198c360d5e75a9b2097844c495c10902e7e8500 13-Aug-2013 Glenn Kasten <gkasten@google.com> Whitespace

Change-Id: Id3ccc183a03421330d0498faaa62a45915cdc3d6
/frameworks/av/services/audioflinger/Threads.cpp
2fc14730e4697a6f456b4631549c9981f6b0b115 05-Aug-2013 Glenn Kasten <gkasten@google.com> Comments

Change-Id: I56f82904cb3855bad6f33ad1ff4ddf66a61c5720
/frameworks/av/services/audioflinger/Threads.cpp
c0029a8551d65929cbf51a55bd3bae3342a1f2fe 13-Aug-2013 Glenn Kasten <gkasten@google.com> Merge "Check input HAL channel mask instead of channel count"
030033342a6ea17003e6af38a56c7edc6d2ead01 07-Aug-2013 Glenn Kasten <gkasten@google.com> Clean up error handling in createTrack and openRecord

Outside callers now use initCheck() to determine whether a TrackBase
has been created successfully, instead of relying on internal knowledge.

Previously, callers needed to know that a TrackBase was only valid if it's
getCbk() != 0. For a Track (playback), they needed to know to also check
the track's name (track index). Now, outsiders can just call initCheck().

Other changes:
- Return a 0 reference if track creation fails
- Remove a dead line of code in AudioFlinger::openRecord

Change-Id: If374924a3f6fd27906f625aa83dd0a1e3f506e00
/frameworks/av/services/audioflinger/Threads.cpp
9156ef3e11b68cc4b6d3cea77f1f63673855a6d1 07-Aug-2013 Glenn Kasten <gkasten@google.com> Status pointer passed by caller is always non-NULL

in createTrack, openRecord, createEffect, createTrack_l,
createRecordTrack_l, and createEffect_l.

Change-Id: I2e459e4de9c78145f4d496e6abf289479a2f0941
/frameworks/av/services/audioflinger/Threads.cpp
e92db4bdb575d897d6bbd5086761fa9387393c83 12-Aug-2013 Glenn Kasten <gkasten@google.com> Merge "Pull up readyToRun into ThreadBase"
b0e6b967c290c905c4c696df4a8ac9e9d591928b 12-Aug-2013 Glenn Kasten <gkasten@google.com> Merge "Simplify the code that allocates mMixBuffer by removing mAllocMixBuffer"
309f7abb3c170ba764e67e9b6fed31fb442e9953 09-Aug-2013 Glenn Kasten <gkasten@google.com> Merge "Use 0 for sp<>, NULL for raw pointers"
f874f1375d758c8a7a84572a94371fbd4085f0df 08-Aug-2013 Glenn Kasten <gkasten@google.com> Merge "Pull up mBufferSize from RecordThread to ThreadBase"
ec3fb50c8ee25ac263a9c2cbe9242f877bef960c 17-Jul-2013 Glenn Kasten <gkasten@google.com> Check input HAL channel mask instead of channel count

The only supported channel masks are mono and stereo;
arbitrary channel masks are not yet allowed.

Change-Id: I9cebbe56480b53b98e59aa55245a1f03a30d2839
/frameworks/av/services/audioflinger/Threads.cpp
937098b9b564a779ff1c8c2d9e60769ee5c69810 26-Jun-2013 Glenn Kasten <gkasten@google.com> Use 0 for sp<>, NULL for raw pointers

Change-Id: Ia0595afdc41e1dec428d7a3db73558b54c417bf3
/frameworks/av/services/audioflinger/Threads.cpp
cf04c2cb8e031acc03c1c91cb1ccab15098c89b6 06-Aug-2013 Glenn Kasten <gkasten@google.com> Pull up readyToRun into ThreadBase

Change-Id: Ib150afd72c3b35d83599a61664e89302a8feb4b5
/frameworks/av/services/audioflinger/Threads.cpp
c1fac191069774c7bfcb062edbb821ea56e7dbc0 06-Aug-2013 Glenn Kasten <gkasten@google.com> Simplify the code that allocates mMixBuffer by removing mAllocMixBuffer

Change-Id: I5ac41210251789a034d760309c50fe018f2442ce
/frameworks/av/services/audioflinger/Threads.cpp
70949c47fbae3f836d15f040551d7631be3ed7c2 06-Aug-2013 Glenn Kasten <gkasten@google.com> Pull up mBufferSize from RecordThread to ThreadBase

Now both playback and record threads have a HAL buffer size for fast
tracks, and a potentially larger-sized buffer for normal tracks.

Change-Id: I6f57b85ecece3cbd4e9e64b8c41c3352f7656912
/frameworks/av/services/audioflinger/Threads.cpp
90e58b1fefc8caf70b34301a92bc86179580b6fc 01-Aug-2013 Glenn Kasten <gkasten@google.com> RecordThread::createRecordTrack_l use flags for fast tracks

Look at client's request for a fast track in the flags parameter,
and check whether the request can be satisfied.

Change-Id: I65ddaeb1b85670fe9066076f638bfed0cda01c0d
/frameworks/av/services/audioflinger/Threads.cpp
ddb0ccf3fb6fe8da8c71a6deb30561b821f3c0a2 01-Aug-2013 Glenn Kasten <gkasten@google.com> RecordTrack::createRecordTrack_l flags are in/out

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
/frameworks/av/services/audioflinger/Threads.cpp
f36dbfe3d517e9311be0a4d0fd6658380690e84c 02-Aug-2013 Glenn Kasten <gkasten@google.com> Merge "Report underruns for fast tracks also"
1a3739169becc850999c3c06db402541119a428c 01-Aug-2013 Glenn Kasten <gkasten@android.com> am 6d4d8790: am b687ff9f: Merge "Fix mismatched delete/new couple"

* commit '6d4d879037a495f9a4276a6996d1845594ce9090':
Fix mismatched delete/new couple
82aaf94a5b18939e4d790bbc752031f3070704a3 18-Jul-2013 Glenn Kasten <gkasten@google.com> Report underruns for fast tracks also

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
/frameworks/av/services/audioflinger/Threads.cpp
b08ab81bab9e8cd2e3a7fff02725a387070fd078 31-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Add resampler comments and fix a typo"
34af02647b387a252fb02bab8e2cb9f7bd9c8abb 30-Jul-2013 Glenn Kasten <gkasten@google.com> Add resampler comments and fix a typo

Change-Id: Ie071673875f663de4212eed4a4dff89d51a5a915
/frameworks/av/services/audioflinger/Threads.cpp
96f60d8f04432a1ed503b3e24d5736d28c63c9a2 12-Jul-2013 Glenn Kasten <gkasten@google.com> Rename control block flags to mFlags

Change-Id: I7b6d31e24531954ab1ecdf3ed56c19433700bd89
/frameworks/av/services/audioflinger/Threads.cpp
97252bb0e40a5a9b41f020163393cf6c5da10b7e 30-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "AudioRecord and HAL input stream must be 16-bit PCM only"
f20e1d8df84c5fbeeace0052d100982ae39bb7a4 12-Jul-2013 Glenn Kasten <gkasten@google.com> Rename control block server to mServer and add comments

Change-Id: Ieabd91acee92d0e84e66fbd358df5282b856306e
/frameworks/av/services/audioflinger/Threads.cpp
a30e75897934da2ce7b1b03bcb4b58e139d3e81e 30-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Fix theoretical race using TrackBase::sampleRate()"
eb144bbbd0b18427562b0d7db5b38e11f9484739 09-Oct-2012 Andrei V. FOMITCHEV <andreix.fomitchev@intel.com> Fix mismatched delete/new couple

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>
/frameworks/av/services/audioflinger/Threads.cpp
fa319e6d918b84f93fb5457af5d1cca6421ac517 30-Jul-2013 Glenn Kasten <gkasten@google.com> Remove CC_LIKELY and CC_UNLIKELY where not needed

Only keep them in performance-sensitive code

Change-Id: Ib257ddd7bc39ce9896997ffae008c524ac743d01
/frameworks/av/services/audioflinger/Threads.cpp
548efc94813c1dec6e8cf6c085ae41ccb04827f1 29-Nov-2012 Glenn Kasten <gkasten@google.com> Rename RecordThread::mInputBytes to the more generic mBufferSize

This prepares for using it in PlaybackThreads later

Change-Id: Id90a92aa6372e4b69914b0008cef07296ca5d6a3
/frameworks/av/services/audioflinger/Threads.cpp
9b58f63e45ef2fdfb839b9b9bb3411d81eb96128 16-Jul-2013 Glenn Kasten <gkasten@google.com> Move members from ThreadBase to PlaybackThread

Move mNormalFrameCount and frameCountHAL(), since they're not used by
record threads. Also comment which fields are updated by readParameters().

Change-Id: I5fc0a8a89cc637976f22d49271a5a3e136dab4e1
/frameworks/av/services/audioflinger/Threads.cpp
7f249fa9bcb64da324d19f551943fac7686d221c 29-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Use standard name and type for channel mask"
175f8338e67aae6d0ca420b8f45a5f7cab4394d5 29-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Simplify getParameters()"
f6ed423af92a56ef54bba23eba883b1f21448b54 16-Jul-2013 Glenn Kasten <gkasten@google.com> Treat mChannelCount as uint32_t consistently

mChannelCount was 8-, 16-, or 32-bits

Change-Id: I2cc2fedf3e33144e5c8bbd9894763282d9217f63
/frameworks/av/services/audioflinger/Threads.cpp
2eeca1f8e18106d118f7268cb9d8597539685c5c 29-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Move local variable declarations to point of first use"
b283374cbf79dc5a36f1eef0015d7baf8881792e 29-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Move delete AudioMixer closer to point of re-allocation"
afbbc6c5f6bc470d504dcf24ceb3ac21d57fb78d 29-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Simplify RecordTrack::stop()"
422801c5e9b795105f28e639c4bed5ee3f4e56f3 26-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "HAL stream format for mixer output threads must be stereo 16-bit PCM"
a8356f663014e7d4c27869629af83d8bb3441e19 25-Jul-2013 Glenn Kasten <gkasten@google.com> Simplify RecordTrack::stop()

Change-Id: Ib959c1e9dc9544d12277ce11bea445118b2e0521
/frameworks/av/services/audioflinger/Threads.cpp
bfb1b832079bbb9426f72f3863199a54aefd02da 07-Jan-2013 Eric Laurent <elaurent@google.com> AudioFlinger: offload playback, non-blocking write

- 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
/frameworks/av/services/audioflinger/Threads.cpp
9e8fcbcd8efa51d70d1207ff57bfbfe31324287a 25-Jul-2013 Glenn Kasten <gkasten@google.com> Move delete AudioMixer closer to point of re-allocation

No need to delete AudioMixer before readOutputParameters

Change-Id: Icafa785c9021bbe8d985e4f9527f8fc8c5e62622
/frameworks/av/services/audioflinger/Threads.cpp
7fc97ba08e2850f3f16db704b78ce78e3dbe1ff0 17-Jul-2013 Glenn Kasten <gkasten@google.com> HAL stream format for mixer output threads must be stereo 16-bit PCM

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
/frameworks/av/services/audioflinger/Threads.cpp
d8ea699dc8e7dac58bb32e9cdb31b0758da25817 16-Jul-2013 Glenn Kasten <gkasten@google.com> Simplify getParameters()

Change-Id: Iedfeca3cd477d023c350d6d4e6eed874ee467a32
/frameworks/av/services/audioflinger/Threads.cpp
34542acfa25c6413c87a94b6f7cc315a0c496277 26-Jun-2013 Glenn Kasten <gkasten@google.com> Move local variable declarations to point of first use

Change-Id: Ideb83dea2c3002651c34fa646753cba598e29e93
/frameworks/av/services/audioflinger/Threads.cpp
fad226abd12435dbcd232f7de396f1a097b2bd5f 17-Jul-2013 Glenn Kasten <gkasten@google.com> Use standard name and type for channel mask

Former name 'channels' was ambiguous with respect to channel count.

Change-Id: I716f792d95a7e0c787d27514ad6e93dbcef8a415
/frameworks/av/services/audioflinger/Threads.cpp
291bb6d8947c5b0c062f0895d623c529259bfa39 17-Jul-2013 Glenn Kasten <gkasten@google.com> AudioRecord and HAL input stream must be 16-bit PCM only

Currently there are 16-bit PCM assumptions in several places for capture:
- resampler API
- mRsmpInBuffer and mRsmpOutBuffer
- RecordThread::threadLoop upmix, downmix, and resampling
- possibly other places

Until those assumptions are removed, this CL enforces 16-bit PCM in both
client and server at all places where a format is checked.

Change-Id: I08b0570bff626ad0d341804825a72c14e61b4233
/frameworks/av/services/audioflinger/Threads.cpp
4182c4e2a07e2441fcd5c22eaff0ddfe7f826f61 15-Jul-2013 Glenn Kasten <gkasten@google.com> Use AudioSystem::setLowRamDevice() to configure memory

Bug: 9798886
Change-Id: I9321e3f369f1ed9429ae222e3926ebdeb012b8b0
/frameworks/av/services/audioflinger/Threads.cpp
153b9fe667e6e78e0218ff0159353097428c7657 15-Jul-2013 Glenn Kasten <gkasten@google.com> Make AudioFlinger::instantiate() more resilient when called from separate module

Bug: 8834855
Change-Id: I4cd842cdfb09d2aaaaab9df9ac3bec6179709bd3
/frameworks/av/services/audioflinger/Threads.cpp
c6ae3c8a261794fd4445e4e152d1ada074a3f92f 17-Jul-2013 Glenn Kasten <gkasten@google.com> Fix theoretical memory leak in mConfigEvents

Change-Id: I137f70676c8919661e716c33e0dd9c25c2b6285c
/frameworks/av/services/audioflinger/Threads.cpp
1ab85ec401801ef9a9184650d0f5a1639b45eeb9 31-May-2013 Glenn Kasten <gkasten@google.com> Include what is needed

Remove old includes.
Header files only include other header files that they directly need themselves.

Change-Id: Ic471386808d9f42ea19ccbd59cb50a5f83a89dd0
/frameworks/av/services/audioflinger/Threads.cpp
9fdcb0a9497ca290bcf364b10868587b6bde3a34 27-Jun-2013 Glenn Kasten <gkasten@google.com> Fix theoretical race using TrackBase::sampleRate()

In two places we assumed that TrackBase::sampleRate() would return the
same value when it is called twice in the same function. This is not
guaranteed; sampleRate() reads from the control block so the return
value could change. To fix this, only call sampleRate() once and cache
the return value to get a consistent value.

This was only a theoretical race. In MixerThread::prepareTracks_l()
it would have no bad effect. In TimedTrack::getNextBuffer() it could
cause a real problem, but we don't currently support dynamic sample rate
ratios for timed tracks.

Change-Id: I8e5c33f0121fc058d1e70c2ab5e9135397d3e0b7
/frameworks/av/services/audioflinger/Threads.cpp
9f80dd223d83d9bb9077fb6baee056cee4eaf7e5 19-Dec-2012 Glenn Kasten <gkasten@google.com> New control block for AudioTrack and AudioRecord

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
/frameworks/av/services/audioflinger/Threads.cpp
fe9a901a445633e70073b1b91fca3af34d8e8132 12-Jun-2013 Eric Laurent <elaurent@google.com> am bb35be24: am 7be48189: Merge "audioflinger: fix effects on direct output threads" into jb-mr2-dev

* commit 'bb35be24239f05f59715960a93cd491a4cd3b4d6':
audioflinger: fix effects on direct output threads
d0107bcd44fe608b0c00a8843d19fb6356c4cb69 11-Jun-2013 Eric Laurent <elaurent@google.com> audioflinger: fix effects on direct output threads

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
/frameworks/av/services/audioflinger/Threads.cpp
04b035e3ccbf2919e4447c66e6483c11f2889f01 07-Jun-2013 Eric Laurent <elaurent@google.com> am d3a5b48a: am 18b46679: Merge "AudioFlinger: do not cache audio device when 0." into jb-mr2-dev

* commit 'd3a5b48a1bc4f5d6ff4472f54f909abaadd5fa39':
AudioFlinger: do not cache audio device when 0.
7e1139c0377b6806942fb2a043737b3b9cf0ae91 07-Jun-2013 Eric Laurent <elaurent@google.com> AudioFlinger: do not cache audio device when 0.

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
/frameworks/av/services/audioflinger/Threads.cpp
7c027248e1a4ccd5b22bc4deafb03e2d87ac8f38 26-Dec-2012 Glenn Kasten <gkasten@google.com> Consistent whitespace

Change-Id: I118cce68d3b777f9ec9b6bfb70367496422a40f2
/frameworks/av/services/audioflinger/Threads.cpp
61d404efeaaf3ea1b615c160b843ac9f274d0018 20-May-2013 Dianne Hackborn <hackbod@google.com> Update to supply correct name for new power manager app ops.

Change-Id: Ia686319509d98a4f467479ea494e8a54f2c1e238
/frameworks/av/services/audioflinger/Threads.cpp
f8197a6a9d9363cb52bb8a2c15c0e5a52064355e 23-Apr-2013 Glenn Kasten <gkasten@google.com> Remove timing jitter during startup of audio

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
/frameworks/av/services/audioflinger/Threads.cpp
a07f17ca46db04c9d5d9e7d6b2878db59ca2b9ea 23-Apr-2013 Glenn Kasten <gkasten@google.com> Remove timing jitter during startup of audio

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
/frameworks/av/services/audioflinger/Threads.cpp
7fd54ff906c69400727fc8e90118a8a0429d7ab2 04-Apr-2013 Eric Laurent <elaurent@google.com> audioflinger: multiple tracks on direct output

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
/frameworks/av/services/audioflinger/Threads.cpp
d595b7c858c481a07745674ce2d8a6690e980e74 04-Apr-2013 Eric Laurent <elaurent@google.com> audioflinger: multiple tracks on direct output

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
/frameworks/av/services/audioflinger/Threads.cpp
a265845ecafe06c9668ce7ac67636657f4bedf86 26-Feb-2013 Glenn Kasten <gkasten@google.com> Miscellaneous cleanup

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
/frameworks/av/services/audioflinger/Threads.cpp
c9b2e20f7c9a71e07ef398152709c76079decbcd 26-Feb-2013 Glenn Kasten <gkasten@google.com> Miscellaneous cleanup

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
/frameworks/av/services/audioflinger/Threads.cpp
10774e144b3c99afad9a5070ccf50fdb12b5fb4e 02-Mar-2013 Glenn Kasten <gkasten@google.com> Merge "media.log cleanup" into jb-mr2-dev
bf04b5860182d8f4130dcb5d6d88ee68a58c99cd 02-Mar-2013 Glenn Kasten <gkasten@google.com> Merge "media.log cleanup" into jb-mr2-dev
d3c4b134a87b96227b90b9ec052d8a6e9880bbdf 27-Feb-2013 Glenn Kasten <gkasten@google.com> media.log cleanup

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
/frameworks/av/services/audioflinger/Threads.cpp
ab7d72f0804fbb7e91ad9d2a16f826d97e20e5d0 27-Feb-2013 Glenn Kasten <gkasten@google.com> media.log cleanup

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
/frameworks/av/services/audioflinger/Threads.cpp
dd0bda0c47871d4964b5035a096c7c8c27fa7469 26-Feb-2013 Glenn Kasten <gkasten@google.com> Remove tee sink debugging at compile time

Bug: 8223560
Change-Id: Iddbfb06c45d43d9f20bb428215dd4094931e19a7
/frameworks/av/services/audioflinger/Threads.cpp
46909e7eb074ce1b95b8a411eb71154f53f84f77 26-Feb-2013 Glenn Kasten <gkasten@google.com> Remove tee sink debugging at compile time

Bug: 8223560
Change-Id: Iddbfb06c45d43d9f20bb428215dd4094931e19a7
/frameworks/av/services/audioflinger/Threads.cpp
dd4abb5177b8d94cd30a787d4ce336d5110c185c 10-Jan-2013 Glenn Kasten <gkasten@google.com> Update tee sink

Implement rotation to reduce long-term storage use.
Implement optional per-track tee.
Dynamically enable at runtime based on property, instead of at compile-time.
Dynamic frame count not yet implemented.

Bug: 8223560
Change-Id: I3706443c6ec0cb0c6656dc288715a02ad5fea63a
/frameworks/av/services/audioflinger/Threads.cpp
da6ef1320d0161b1640dc84d7a9c5a25860c3619 10-Jan-2013 Glenn Kasten <gkasten@google.com> Update tee sink

Implement rotation to reduce long-term storage use.
Implement optional per-track tee.
Dynamically enable at runtime based on property, instead of at compile-time.
Dynamic frame count not yet implemented.

Bug: 8223560
Change-Id: I3706443c6ec0cb0c6656dc288715a02ad5fea63a
/frameworks/av/services/audioflinger/Threads.cpp
5f6f3764989601d3b3ee65beaf1447d2a6b5f284 16-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 32584a7d672864b20ab8b83a3cb23c1858e908b7

Change-Id: I9dc680578b955b1af462eeb7a49d61a0d45eb81b
/frameworks/av/services/audioflinger/Threads.cpp
7f5d335f7b4caecd0dfb8f1085f352f1d2da5d2e 16-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 32584a7d672864b20ab8b83a3cb23c1858e908b7

Change-Id: I9dc680578b955b1af462eeb7a49d61a0d45eb81b
/frameworks/av/services/audioflinger/Threads.cpp
dd9764290b3c1d801fea9505189cae29db919902 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size
- log mFastIndex when AudioMixer sees an invalid bufferProvider.
- log both potentially modified and actually modified tracks in FastMixer.
- fix benign bug where sq->end() was called more than once.
- log StateQueue push() call and return.
- increase StateQueue size from 4 to 8 entries
- log mixer->enable(), bufferProvider, and currentTrackMask
- log buffer provider addresses
- increase fast mixer log buffer again
- check logf format vs. argument list compatibility
- add logging to AudioMixer
- add checking of magic field in AudioMixer to detect overwrites
- add bool AudioMixer::enabled()
- increase log buffer sizes yet again
- enable assertion checking without ALOGV
- improve a few log messages
- check for corruption in more places
- log in all the process hooks
- add new mixer APIs so we can check for corruption of mixer state
- fix a build warning

Bug: 6490974
Change-Id: Ib0c4a73dcf606ef9bd898313b3b40ef61ab42f51
/frameworks/av/services/audioflinger/Threads.cpp
32584a7d672864b20ab8b83a3cb23c1858e908b7 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size
- log mFastIndex when AudioMixer sees an invalid bufferProvider.
- log both potentially modified and actually modified tracks in FastMixer.
- fix benign bug where sq->end() was called more than once.
- log StateQueue push() call and return.
- increase StateQueue size from 4 to 8 entries
- log mixer->enable(), bufferProvider, and currentTrackMask
- log buffer provider addresses
- increase fast mixer log buffer again
- check logf format vs. argument list compatibility
- add logging to AudioMixer
- add checking of magic field in AudioMixer to detect overwrites
- add bool AudioMixer::enabled()
- increase log buffer sizes yet again
- enable assertion checking without ALOGV
- improve a few log messages
- check for corruption in more places
- log in all the process hooks
- add new mixer APIs so we can check for corruption of mixer state
- fix a build warning

Bug: 6490974
Change-Id: Ib0c4a73dcf606ef9bd898313b3b40ef61ab42f51
/frameworks/av/services/audioflinger/Threads.cpp
ce70d400ff9fb614e334ab2b661df2933533ef57 15-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 639482c24c911b125398b31883ba6d55faebe28b

Change-Id: I11f2829072ab11e18b0663024f27bf31192f1d39
/frameworks/av/services/audioflinger/Threads.cpp
e186b51e0a9834b287d7a509e960eaf1b688db75 15-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 639482c24c911b125398b31883ba6d55faebe28b

Change-Id: I11f2829072ab11e18b0663024f27bf31192f1d39
/frameworks/av/services/audioflinger/Threads.cpp
5881f18029deb80eb83ea88046d0593441be79c7 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size
- log mFastIndex when AudioMixer sees an invalid bufferProvider.
- log both potentially modified and actually modified tracks in FastMixer.
- fix benign bug where sq->end() was called more than once.
- log StateQueue push() call and return.
- increase StateQueue size from 4 to 8 entries
- log mixer->enable(), bufferProvider, and currentTrackMask
- log buffer provider addresses
- increase fast mixer log buffer again
- check logf format vs. argument list compatibility
- add logging to AudioMixer
- add checking of magic field in AudioMixer to detect overwrites
- add bool AudioMixer::enabled()

Bug: 6490974
Change-Id: I1f3f18aa62d9fbd35bc32285b669f5ba40efe28e
/frameworks/av/services/audioflinger/Threads.cpp
639482c24c911b125398b31883ba6d55faebe28b 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size
- log mFastIndex when AudioMixer sees an invalid bufferProvider.
- log both potentially modified and actually modified tracks in FastMixer.
- fix benign bug where sq->end() was called more than once.
- log StateQueue push() call and return.
- increase StateQueue size from 4 to 8 entries
- log mixer->enable(), bufferProvider, and currentTrackMask
- log buffer provider addresses
- increase fast mixer log buffer again
- check logf format vs. argument list compatibility
- add logging to AudioMixer
- add checking of magic field in AudioMixer to detect overwrites
- add bool AudioMixer::enabled()

Bug: 6490974
Change-Id: I1f3f18aa62d9fbd35bc32285b669f5ba40efe28e
/frameworks/av/services/audioflinger/Threads.cpp
7f2f8042cf335ab1323dec3edbe9143a06109f4e 14-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 0ddd56316262ac74a95e9edb595697c163136d6d

Change-Id: I180a928af6f5a38d15a5efe44cd1fe927b5d961c
/frameworks/av/services/audioflinger/Threads.cpp
51eb3965caa8ba135bcdd8ffb7a2024a042ecdc0 14-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 0ddd56316262ac74a95e9edb595697c163136d6d

Change-Id: I180a928af6f5a38d15a5efe44cd1fe927b5d961c
/frameworks/av/services/audioflinger/Threads.cpp
b900234f9e772bb7591a551f06ba17ee1969368f 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size
- log mFastIndex when AudioMixer sees an invalid bufferProvider.
- log both potentially modified and actually modified tracks in FastMixer.
- fix benign bug where sq->end() was called more than once.
- log StateQueue push() call and return.

Bug: 6490974
Change-Id: Iee7c8f40e20b6000cd8286c0ec6a14fff4a37af1
/frameworks/av/services/audioflinger/Threads.cpp
0ddd56316262ac74a95e9edb595697c163136d6d 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size
- log mFastIndex when AudioMixer sees an invalid bufferProvider.
- log both potentially modified and actually modified tracks in FastMixer.
- fix benign bug where sq->end() was called more than once.
- log StateQueue push() call and return.

Bug: 6490974
Change-Id: Iee7c8f40e20b6000cd8286c0ec6a14fff4a37af1
/frameworks/av/services/audioflinger/Threads.cpp
c93aff0a698265501f46393f3146b884aa357aee 12-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 3051df27261e9952c0e642dec548515250e85f6a

Change-Id: I8bf5c3e91b65bd20de26f480c367c2854b62373c
/frameworks/av/services/audioflinger/Threads.cpp
ecd9389c8712aedeb2a79823ea0e4fb842684269 12-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 3051df27261e9952c0e642dec548515250e85f6a

Change-Id: I8bf5c3e91b65bd20de26f480c367c2854b62373c
/frameworks/av/services/audioflinger/Threads.cpp
a1bf28b533907b0b234e52c72bc372b3fa49c5a3 12-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size

Bug: 6490974
Change-Id: I4c030f171343fe4b483eae0ddea4427118d8d4b1
/frameworks/av/services/audioflinger/Threads.cpp
3051df27261e9952c0e642dec548515250e85f6a 12-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size

Bug: 6490974
Change-Id: I4c030f171343fe4b483eae0ddea4427118d8d4b1
/frameworks/av/services/audioflinger/Threads.cpp
83fa606bd629ac32a2dab5af255188acfa30db4a 04-Feb-2013 Eric Laurent <elaurent@google.com> Merge "AudioFlinger: fix RecordThread initial device"
59686720182dcaa1a1a4757964df38c16f1a5246 04-Feb-2013 Eric Laurent <elaurent@google.com> Merge "AudioFlinger: fix RecordThread initial device"
201fc9c9feb4765a12bc39e95d25f3aa1deb8ffe 02-Feb-2013 Eric Laurent <elaurent@google.com> AudioFlinger: fix RecordThread initial device

A regression was introduced when the audio device enums where
modified for a 32 bit representation: the device passed when
constructing a RecordThread was still the concatenation of input
device and output device bit fields on one 32 bit value which
is not possible anymore.

The fix consists in modifying the RecordThread constructor to accept
separate values for input and output devices.

Change-Id: I81fb5f4718428b54251e65d74b86e198ce15193e
/frameworks/av/services/audioflinger/Threads.cpp
d3922f72601d82c6fc067a98916fda0bd1291c5f 02-Feb-2013 Eric Laurent <elaurent@google.com> AudioFlinger: fix RecordThread initial device

A regression was introduced when the audio device enums where
modified for a 32 bit representation: the device passed when
constructing a RecordThread was still the concatenation of input
device and output device bit fields on one 32 bit value which
is not possible anymore.

The fix consists in modifying the RecordThread constructor to accept
separate values for input and output devices.

Change-Id: I81fb5f4718428b54251e65d74b86e198ce15193e
/frameworks/av/services/audioflinger/Threads.cpp
011aa652a9349750dd6bca1dcb1b82f19e07504e 19-Jan-2013 Glenn Kasten <gkasten@google.com> AudioFlinger uses media.log service for logging

Change-Id: Ia0f8204334f6b233f644d897762a18c95d936b4b
/frameworks/av/services/audioflinger/Threads.cpp
9e58b552f51b00b3b674102876bd6c77ef3da806 19-Jan-2013 Glenn Kasten <gkasten@google.com> AudioFlinger uses media.log service for logging

Change-Id: Ia0f8204334f6b233f644d897762a18c95d936b4b
/frameworks/av/services/audioflinger/Threads.cpp
3a948fceb6b59121cc2e5eeb458064150870ffde 18-Jan-2013 Eric Laurent <elaurent@google.com> AudioFlinger: fix build with debug log enabled

Change-Id: Id397155ec884c41cb84b35462ea09a97a04d3ed2
/frameworks/av/services/audioflinger/Threads.cpp
2592f6e68edbed386e004d5b045233f15e7b9ba1 18-Jan-2013 Eric Laurent <elaurent@google.com> AudioFlinger: fix build with debug log enabled

Change-Id: Id397155ec884c41cb84b35462ea09a97a04d3ed2
/frameworks/av/services/audioflinger/Threads.cpp
856ff4e4c3c43550f013e80277358fdf514342bf 22-Dec-2012 Glenn Kasten <gkasten@google.com> Merge "Start isolating control block accesses in a proxy"
d5681bc9a38fe4cd1d591e6ae62b9c68fb851041 22-Dec-2012 Glenn Kasten <gkasten@google.com> Merge "Start isolating control block accesses in a proxy"
92b1343f5fbc2fc43198a0a1252fe023cc9a5061 14-Dec-2012 Glenn Kasten <gkasten@google.com> Fix build warnings

Change-Id: I9e3cfa0c6b3467fe763ce55f759d179f02c5deea
/frameworks/av/services/audioflinger/Threads.cpp
c4974312e5a1e2ab94eca56045f991baf1508d73 14-Dec-2012 Glenn Kasten <gkasten@google.com> Fix build warnings

Change-Id: I9e3cfa0c6b3467fe763ce55f759d179f02c5deea
/frameworks/av/services/audioflinger/Threads.cpp
552f274d82fb4988fb972df69134e031d375abfe 04-Dec-2012 Glenn Kasten <gkasten@google.com> Start isolating control block accesses in a proxy

The proxy object will eventually be the only code that understands the
details of the control block. This should make it easier to change the
control block in the future.

Initial set of control block fields that are isolated:
- sample rate
- send level
- volume

Prepare for streaming/static separation by adding a union to the control
block for the new fields.

Fix bug in handling of max sample rate on a track. It was only checking
at re-configuration, not at each mix.

Simplify OutputTrack::obtainBuffer.

Change-Id: I2249f9d04f73a911a922ad1d7f6197292c74cd92
/frameworks/av/services/audioflinger/Threads.cpp
e3aa659e9cee7df5c12a80d285cc29ab3b2cbb39 04-Dec-2012 Glenn Kasten <gkasten@google.com> Start isolating control block accesses in a proxy

The proxy object will eventually be the only code that understands the
details of the control block. This should make it easier to change the
control block in the future.

Initial set of control block fields that are isolated:
- sample rate
- send level
- volume

Prepare for streaming/static separation by adding a union to the control
block for the new fields.

Fix bug in handling of max sample rate on a track. It was only checking
at re-configuration, not at each mix.

Simplify OutputTrack::obtainBuffer.

Change-Id: I2249f9d04f73a911a922ad1d7f6197292c74cd92
/frameworks/av/services/audioflinger/Threads.cpp
30c01816ddee2268fcd3d965240cba9c00301e7d 04-Dec-2012 Glenn Kasten <gkasten@google.com> Prepare for track invalidation to be done by proxy

Don't rely on control block to determine whether track has been marked
invalid. Instead, use a local flag that can't be corrupted by client.

Change-Id: I783dafe828f93c1c3d2d0e5a08105ea536436efb
/frameworks/av/services/audioflinger/Threads.cpp
5736c35b841de56ce394b4879389f669b61425e6 04-Dec-2012 Glenn Kasten <gkasten@google.com> Prepare for track invalidation to be done by proxy

Don't rely on control block to determine whether track has been marked
invalid. Instead, use a local flag that can't be corrupted by client.

Change-Id: I783dafe828f93c1c3d2d0e5a08105ea536436efb
/frameworks/av/services/audioflinger/Threads.cpp
4b3a49e3a9ced6e63adab08acc5b720f8feddefa 29-Nov-2012 Glenn Kasten <gkasten@google.com> AudioTrack::mute() is unused so remove it

If ever needed again, it could be implemented on client side by forcing
a track volume of 0.

Change-Id: I88a9b4f675b6dca2948549414f9ec2c192d29269
/frameworks/av/services/audioflinger/Threads.cpp
e4756fe3a387615acb63c6a05788c8db9b5786cb 29-Nov-2012 Glenn Kasten <gkasten@google.com> AudioTrack::mute() is unused so remove it

If ever needed again, it could be implemented on client side by forcing
a track volume of 0.

Change-Id: I88a9b4f675b6dca2948549414f9ec2c192d29269
/frameworks/av/services/audioflinger/Threads.cpp
af348741539ae4a84aa929a54ecf359dae96f3ee 30-Nov-2012 Alex Ray <aray@google.com> Remove conditional compilation of ATRACE functions

Tracing functions are meant to be dynamically controlled via sysprops.
Conditional compilation removes this functionality.

Change-Id: I26bc473d104d0b3c50a228dddfda3fa2428d157a
/frameworks/av/services/audioflinger/Threads.cpp
371eb9756c32109ea572b91216b19bb623f6d3fd 30-Nov-2012 Alex Ray <aray@google.com> Remove conditional compilation of ATRACE functions

Tracing functions are meant to be dynamically controlled via sysprops.
Conditional compilation removes this functionality.

Change-Id: I26bc473d104d0b3c50a228dddfda3fa2428d157a
/frameworks/av/services/audioflinger/Threads.cpp
7a90bc9265782788675af577c7b1c56e5d5be709 30-Nov-2012 Simon Wilson <simonwilson@google.com> Use ATRACE macros instead of Tracer statics

ATRACE_BEGIN and ATRACE_END have replaced the static
Tracer::traceBegin and Tracer::traceEnd functions, so
use them instead.

Fixes compilation errors when tracing is enabled.

Change-Id: I4d1147d2f76afcdf113e9986f0544cb848802b15
/frameworks/av/services/audioflinger/Threads.cpp
2d590964aa58e137d17a43e095e6443dd0fe2e98 30-Nov-2012 Simon Wilson <simonwilson@google.com> Use ATRACE macros instead of Tracer statics

ATRACE_BEGIN and ATRACE_END have replaced the static
Tracer::traceBegin and Tracer::traceEnd functions, so
use them instead.

Fixes compilation errors when tracing is enabled.

Change-Id: I4d1147d2f76afcdf113e9986f0544cb848802b15
/frameworks/av/services/audioflinger/Threads.cpp
ca7cc8273ffd88b9b89655808ee7e3df74162b83 19-Nov-2012 Eric Laurent <elaurent@google.com> AudioFlinger files reorganization

Audioflinger.cpp and Audioflinger.h files must be split to
improve readability and maintainability.

This CL splits the files as follows:

AudioFlinger.cpp split into:
- AudioFlinger.cpp: implementation of IAudioflinger interface and global methods
- AFThreads.cpp: implementation of ThreadBase, PlaybackThread, MixerThread,
DuplicatingThread, DirectOutputThread and RecordThread.
- AFTracks.cpp: implementation of TrackBase, Track, TimedTrack, OutputTrack,
RecordTrack, TrackHandle and RecordHandle.
- AFEffects.cpp: implementation of EffectModule, EffectChain and EffectHandle.

AudioFlinger.h is modified by inline inclusion of header files containing
the declaration of complex inner classes:
- AFThreads.h: ThreadBase, PlaybackThread, MixerThread, DuplicatingThread,
DirectOutputThread and RecordThread
- AFEffects.h: EffectModule, EffectChain and EffectHandle

AFThreads.h includes the follownig headers inline:
- AFTrackBase.h: TrackBase
- AFPlaybackTracks: Track, TimedTrack, OutputTrack
- AFRecordTracks: RecordTrack

Change-Id: I512ebc3a51813ab7a4afccc9a538b18125165c4c
/frameworks/av/services/audioflinger/Threads.cpp
81784c37c61b09289654b979567a42bf73cd2b12 19-Nov-2012 Eric Laurent <elaurent@google.com> AudioFlinger files reorganization

Audioflinger.cpp and Audioflinger.h files must be split to
improve readability and maintainability.

This CL splits the files as follows:

AudioFlinger.cpp split into:
- AudioFlinger.cpp: implementation of IAudioflinger interface and global methods
- AFThreads.cpp: implementation of ThreadBase, PlaybackThread, MixerThread,
DuplicatingThread, DirectOutputThread and RecordThread.
- AFTracks.cpp: implementation of TrackBase, Track, TimedTrack, OutputTrack,
RecordTrack, TrackHandle and RecordHandle.
- AFEffects.cpp: implementation of EffectModule, EffectChain and EffectHandle.

AudioFlinger.h is modified by inline inclusion of header files containing
the declaration of complex inner classes:
- AFThreads.h: ThreadBase, PlaybackThread, MixerThread, DuplicatingThread,
DirectOutputThread and RecordThread
- AFEffects.h: EffectModule, EffectChain and EffectHandle

AFThreads.h includes the follownig headers inline:
- AFTrackBase.h: TrackBase
- AFPlaybackTracks: Track, TimedTrack, OutputTrack
- AFRecordTracks: RecordTrack

Change-Id: I512ebc3a51813ab7a4afccc9a538b18125165c4c
/frameworks/av/services/audioflinger/Threads.cpp