History log of /frameworks/av/services/audioflinger/Tracks.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
1f3a28ec6ba9bafa4e0a6f0ae0838c392ce43b73 19-Jun-2017 Andy Hung <hunga@google.com> Merge "Track: Check buffer size of static tracks" into lmp-dev am: 782a30d2ab am: a3416fc6b4 am: 42f2fab126 am: 483cf88382 am: f89b2427ad am: 7779f826d4 am: c343fd2846 am: 69b0154d59 am: 1d66db35e5 am: 849b3d0cdb am: ef0a06bae0
am: 9a5104ddf1

Change-Id: Ia053b76c9dc3aa7d2e953bfc2eadadb40ea16b93
849b3d0cdba9e6b6c2e0142714c260b9e6e20567 19-Jun-2017 Andy Hung <hunga@google.com> Merge "Track: Check buffer size of static tracks" into lmp-dev am: 782a30d2ab am: a3416fc6b4 am: 42f2fab126 am: 483cf88382 am: f89b2427ad am: 7779f826d4 am: c343fd2846 am: 69b0154d59
am: 1d66db35e5

Change-Id: I962eeaea659e99f5a9f082ab2f479bbb4cface15
1d66db35e5da3eeaf311f95c65b0349c58bae280 19-Jun-2017 Andy Hung <hunga@google.com> Merge "Track: Check buffer size of static tracks" into lmp-dev am: 782a30d2ab am: a3416fc6b4 am: 42f2fab126 am: 483cf88382 am: f89b2427ad am: 7779f826d4 am: c343fd2846
am: 69b0154d59

Change-Id: Ifbb0da32f562fe5b1001e5dc2fcc3490305e694e
69b0154d59293511b3a4071342d9c3b769b4abfa 19-Jun-2017 Andy Hung <hunga@google.com> Merge "Track: Check buffer size of static tracks" into lmp-dev am: 782a30d2ab am: a3416fc6b4 am: 42f2fab126 am: 483cf88382 am: f89b2427ad am: 7779f826d4
am: c343fd2846

Change-Id: I72c4c8d74ffaa8b8bc03a265ae3ff06796bbeb5b
f89b2427ad2d17b83354e3b03603f99af000b1bd 19-Jun-2017 Andy Hung <hunga@google.com> Merge "Track: Check buffer size of static tracks" into lmp-dev am: 782a30d2ab am: a3416fc6b4 am: 42f2fab126
am: 483cf88382

Change-Id: I745c19ce57ca9055b5cb11a9ac5072b0b8954cd6
483cf88382bd6c8b9523d9d57eafd693cd06aaec 19-Jun-2017 Andy Hung <hunga@google.com> Merge "Track: Check buffer size of static tracks" into lmp-dev am: 782a30d2ab am: a3416fc6b4
am: 42f2fab126

Change-Id: Ifb95a65ef32c643b94554c3904b84678d5459625
a3416fc6b4fc40e65f36dc83038a40a2d778ddfa 19-Jun-2017 Andy Hung <hunga@google.com> Merge "Track: Check buffer size of static tracks" into lmp-dev
am: 782a30d2ab

Change-Id: Ie27330ced83beccaed5a5a3d69ec6833be7e36e1
782a30d2abbf20bf617c19983829fe78cdc235f1 19-Jun-2017 Andy Hung <hunga@google.com> Merge "Track: Check buffer size of static tracks" into lmp-dev
2eed9fd5a02ab67ad141b515b944b6dc5fc818a3 17-Jun-2017 Andy Hung <hunga@google.com> AudioFlinger: Fix memory allocation for client-less tracks am: 1159ffd5e3 am: f242b890c4 am: 24ef54ecb8 am: a35816475b am: 1ce123cf91 am: d06e47540d am: 103b751e55 am: 0851e2f4c6 am: aff0808bcf am: 109247df7a am: a92d05fc1e
am: 85c8828a32

Change-Id: I2ac2e1e00639f686905900308b3f675925e44a9d
85c8828a32679eb960d21ac992238471d4b2da3d 17-Jun-2017 Andy Hung <hunga@google.com> AudioFlinger: Fix memory allocation for client-less tracks am: 1159ffd5e3 am: f242b890c4 am: 24ef54ecb8 am: a35816475b am: 1ce123cf91 am: d06e47540d am: 103b751e55 am: 0851e2f4c6 am: aff0808bcf am: 109247df7a
am: a92d05fc1e

Change-Id: I73340a812c24ea421d68fa88f6b18cfa4867a0a5
a92d05fc1ec048541d888c4ef72ee63617ee18f1 17-Jun-2017 Andy Hung <hunga@google.com> AudioFlinger: Fix memory allocation for client-less tracks am: 1159ffd5e3 am: f242b890c4 am: 24ef54ecb8 am: a35816475b am: 1ce123cf91 am: d06e47540d am: 103b751e55 am: 0851e2f4c6 am: aff0808bcf
am: 109247df7a

Change-Id: I4f55d2cdd5ef430742e3b6e3680603d2a9618593
0851e2f4c6abe3340259b0e02b61857215762281 17-Jun-2017 Andy Hung <hunga@google.com> AudioFlinger: Fix memory allocation for client-less tracks am: 1159ffd5e3 am: f242b890c4 am: 24ef54ecb8 am: a35816475b am: 1ce123cf91 am: d06e47540d
am: 103b751e55

Change-Id: I3d03741eca351ad131d5bae700a5024fda36e1be
103b751e5511c2cf4b250455e07ec1e1fc4befe2 17-Jun-2017 Andy Hung <hunga@google.com> AudioFlinger: Fix memory allocation for client-less tracks am: 1159ffd5e3 am: f242b890c4 am: 24ef54ecb8 am: a35816475b am: 1ce123cf91
am: d06e47540d

Change-Id: I22405b81c7351961f8aca57289a15cc99e67525a
1ce123cf912a00547830fc742b927cf72007ff86 17-Jun-2017 Andy Hung <hunga@google.com> AudioFlinger: Fix memory allocation for client-less tracks am: 1159ffd5e3 am: f242b890c4 am: 24ef54ecb8
am: a35816475b

Change-Id: I77aa056b71679b0d0d6703a59f46c788e77d5351
a35816475b907f3cead491f1c39ea72967f49fe5 17-Jun-2017 Andy Hung <hunga@google.com> AudioFlinger: Fix memory allocation for client-less tracks am: 1159ffd5e3 am: f242b890c4
am: 24ef54ecb8

Change-Id: I0b413afa5c0e41fadcd0320f7481172cc2398018
f4aeab2bd69bead05ed75ae3254f53a6ab2316b5 13-Jun-2017 Andy Hung <hunga@google.com> Track: Check buffer size of static tracks

Merged-In: Ia7edd9a802905214a27961dbcec6352f6ef98f73
Test: Native POC
Bug: 38340117
Change-Id: I633caf563d3607dbe4b9be10be1687efce33469c
/frameworks/av/services/audioflinger/Tracks.cpp
1159ffd5e3f832206982d45a7b030b943cc4775e 14-Feb-2017 Andy Hung <hunga@google.com> AudioFlinger: Fix memory allocation for client-less tracks

Test: Ringtone with BT
Bug: 35350587
Bug: 38340117
Change-Id: If247d319d58f8f4d18b49f58ec950491871ebb2d
(cherry picked from commit afb31487f3156a7284d2f0d06646c7bc00d99537)
/frameworks/av/services/audioflinger/Tracks.cpp
a66d3899f7d13e69ee451f1071f0d999678803ce 04-May-2017 Mikhail Naganov <mnaganov@google.com> audioflinger: Do not report underruns for stopped or paused tracks

PlaybackThread::Track is missing checks for the track state
when reporting underruns. These checks present on other instances
when tallyUnderrunFrames is being called.

This eliminates fake underrun reportings when playing
multichannel tracks via deep buffer.

Bug: 36181621
Test: play multichannel track and check underrun count at the end
Change-Id: Ieff338b33807e66df91234d85b782ee383fe95b9
/frameworks/av/services/audioflinger/Tracks.cpp
da540db0fc21bc9319d9602aefe1a109d00a7e6c 20-Apr-2017 Andy Hung <hunga@google.com> VolumeShaper: improve logging and dumpsys

Test: CTS and dumpsys
Bug: 37536598
Change-Id: I9a838a8605defde3aaf42a872e48f01425df0f0e
/frameworks/av/services/audioflinger/Tracks.cpp
3c93457cfce2c82ee17b226c46942d133ed24b61 11-Mar-2017 Andy Hung <hunga@google.com> Merge "AudioFlinger: Check framecount overflow when creating track" into lmp-dev am: 51a3483ec9 am: 5dc0e88cc1 am: 6d4b5fc334 am: 5562d70451 am: 3fb4149ed2 am: 78ec332732 am: 9262496af9 am: 12b5b3b008
am: dfecfdb28f

Change-Id: I0b4de04aab9058db4beb6346c00208b697ed4f78
dfecfdb28fbc99b87588a9db0dd5dde9d621ea30 10-Mar-2017 Andy Hung <hunga@google.com> Merge "AudioFlinger: Check framecount overflow when creating track" into lmp-dev am: 51a3483ec9 am: 5dc0e88cc1 am: 6d4b5fc334 am: 5562d70451 am: 3fb4149ed2 am: 78ec332732 am: 9262496af9
am: 12b5b3b008

Change-Id: I9a46a6aaa2ff3afc4be729f7877703d1bf97faa7
12b5b3b00803eac0ab5b6c7ff09b8aad3d78c2e1 10-Mar-2017 Andy Hung <hunga@google.com> Merge "AudioFlinger: Check framecount overflow when creating track" into lmp-dev am: 51a3483ec9 am: 5dc0e88cc1 am: 6d4b5fc334 am: 5562d70451 am: 3fb4149ed2 am: 78ec332732
am: 9262496af9

Change-Id: I8df7a4c1308afb39a1f1a37a588e70e049a868fa
3fb4149ed2983be6f0f9a32fff2646f37eca6759 10-Mar-2017 Andy Hung <hunga@google.com> Merge "AudioFlinger: Check framecount overflow when creating track" into lmp-dev am: 51a3483ec9 am: 5dc0e88cc1 am: 6d4b5fc334
am: 5562d70451

Change-Id: Ia73c4a1d2911cf930700bf796fc7ee18d94500fe
5562d704519b5662d2165d688c50f85ff3d7aedd 10-Mar-2017 Andy Hung <hunga@google.com> Merge "AudioFlinger: Check framecount overflow when creating track" into lmp-dev am: 51a3483ec9 am: 5dc0e88cc1
am: 6d4b5fc334

Change-Id: Ie47307f09c5fcb49f81a2d034c42d69b8417c9a6
5dc0e88cc14128d54bae2297c0ee1bac2042b6a1 10-Mar-2017 Andy Hung <hunga@google.com> Merge "AudioFlinger: Check framecount overflow when creating track" into lmp-dev
am: 51a3483ec9

Change-Id: I6fe5fb0a7142218b16c84bc1966a84ac920fd70a
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/Tracks.cpp
09cf7cab168663ca98a440a9473b1515e0eb0cfa 15-Feb-2017 Andy Hung <hunga@google.com> Merge "AudioFlinger: Fix memory allocation for client-less tracks"
64e843f1c312382e3e1a6f6e17f8d895e9c6efe8 14-Feb-2017 Andy Hung <hunga@google.com> DO NOT MERGE AudioFlinger: Check framecount overflow when creating track

Test: Native POC
Bug: 34749571
Change-Id: I7529658e52ac7e64d162eb5338f10fb25eaa8fe7
/frameworks/av/services/audioflinger/Tracks.cpp
eaa3969f757291f151efedde17ec529b8659024d 14-Feb-2017 Andy Hung <hunga@google.com> AudioFlinger: Check framecount overflow when creating track

Test: Native POC
Bug: 34749571
Change-Id: I7529658e52ac7e64d162eb5338f10fb25eaa8fe7
(cherry picked from commit 1883f69de5f2c4e71df58d5b71d7c39f9779b50c)
/frameworks/av/services/audioflinger/Tracks.cpp
afb31487f3156a7284d2f0d06646c7bc00d99537 14-Feb-2017 Andy Hung <hunga@google.com> AudioFlinger: Fix memory allocation for client-less tracks

Test: Ringtone with BT
Bug: 35350587
Change-Id: If247d319d58f8f4d18b49f58ec950491871ebb2d
/frameworks/av/services/audioflinger/Tracks.cpp
1883f69de5f2c4e71df58d5b71d7c39f9779b50c 14-Feb-2017 Andy Hung <hunga@google.com> AudioFlinger: Check framecount overflow when creating track

Test: Native POC
Bug: 34749571
Change-Id: I7529658e52ac7e64d162eb5338f10fb25eaa8fe7
/frameworks/av/services/audioflinger/Tracks.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/Tracks.cpp
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
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/Tracks.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/Tracks.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/Tracks.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/Tracks.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/Tracks.cpp
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/Tracks.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
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/Tracks.cpp
e37736428f5393ea5f32729ad16f59c2c297c04f 14-Sep-2016 Phil Burk <philburk@google.com> AudioFlinger: flush direct tracks that are paused am: 4bb650bb3c am: b4fb66000f
am: 1935f31023

Change-Id: I7e6e7e73f2dd77c91995570c8719ab9c8e5561e9
4bb650bb3c4f15789232f3f3cf778c5441122360 09-Sep-2016 Phil Burk <philburk@google.com> AudioFlinger: flush direct tracks that are paused

Normally the flush is processed on ObtainBuffer.
But that is not called when the track is paused.
So it was not possible to flush and re-prime a
track that was paused.

Now we flush synchronously for inactive tracks,
and flush from prepareTracks_l for active tracks.

Bug: 19193985
Bug: 27791443
Change-Id: I39a7e4921e45041c3a51cf91fd3995b5edee6dd4
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/services/audioflinger/Tracks.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
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/Tracks.cpp
9a3fbd9f84656ca25acdfd202ef7d4461a640f74 04-Jun-2016 Chih-Hung Hsieh <chh@google.com> Fix misc-macro-parentheses warnings in Tracks.cpp.

Bug: 28705665
Change-Id: Ifa59d95b0242bef71762d862e3437fa1e914c552
/frameworks/av/services/audioflinger/Tracks.cpp
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
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/Tracks.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/Tracks.cpp
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
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/Tracks.cpp
8d9286e4d75b10da715e955ba91ba6fa2a2ae030 13-Apr-2016 Andy Hung <hunga@google.com> Merge "AudioTrack: Reset position on flush for extended timestamps." into nyc-dev am: aff4e46
am: 9f0fdd1

* commit '9f0fdd1edd70ab31c3b7d9b687afb44e83b868b7':
AudioTrack: Reset position on flush for extended timestamps.

Change-Id: Id2b09b1cfd21fcf4ec7c9d040f0f199f94e35c7a
e1e9846a786a0d77a13b44f8e798e03b4cba9d77 12-Apr-2016 Andy Hung <hunga@google.com> AudioTrack: Reset position on flush for extended timestamps.

Bug: 27940058
Change-Id: If91320669e2e84803e601137b1ce66b361b129f1
/frameworks/av/services/audioflinger/Tracks.cpp
adc4827a835087a2a7edd934967bc059aa0ee743 04-Apr-2016 Andy Hung <hunga@google.com> Merge "Implement client playback timestamps with 64 bit accuracy" into nyc-dev am: f3bcfeb
am: ba27fff

* commit 'ba27fff473a122a9d2ad3ac852eceb61002de3c6':
Implement client playback timestamps with 64 bit accuracy

Change-Id: I55f278982c03360a7c2e06f1e3810548afdda647
ea2b9c07b34079f0dbd8610a511e006e69a15adc 13-Feb-2016 Andy Hung <hunga@google.com> Implement client playback timestamps with 64 bit accuracy

Provide server timestamps if the HAL doesn't provide it.
Provide monotonic - boottime translation.

Bug: 17472992
Bug: 26682703
Bug: 27749434
Change-Id: I6c9b213d9f9284092e34d57f52870e02c72df62a
/frameworks/av/services/audioflinger/Tracks.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/Tracks.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/Tracks.cpp
fc1337d079ba7e6ffd7ce07706cfeeeb355c0200 18-Mar-2016 Phil Burk <philburk@google.com> Merge "AudioTrack: fix stall if setBufferSizeInFrames() called before play()" into nyc-dev
e8972b0a27fac327c997fceb20d9abae1dc1d899 04-Mar-2016 Phil Burk <philburk@google.com> AudioTrack: fix stall if setBufferSizeInFrames() called before play()

The server was waiting for a full buffer.
But the buffer was only getting partly filled.
So the stream was not starting.

The fix involves having the server look at the adjustable threshold.

Bug: 27505889
Change-Id: I5dbf686413e670dacbbecc9e0f838744e465f44f
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/services/audioflinger/Tracks.cpp
d848eb48c121c119e8ba7583efc75415fe102570 08-Mar-2016 Glenn Kasten <gkasten@google.com> Use audio_session_t consistently

Bug: 27562099
Change-Id: I328d8226191386b163f2ace41233607294c50dcd
/frameworks/av/services/audioflinger/Tracks.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/Tracks.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/Tracks.cpp
c54b1ffc92b8ad27608a8af21033d7cab33cb3a0 23-Feb-2016 Andy Hung <hunga@google.com> Fix AudioTrack presentationComplete regression

Bug: 27310929
Change-Id: Id52299660d90b07220a4fd9996da53fe755a41f1
/frameworks/av/services/audioflinger/Tracks.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/Tracks.cpp
6ae5843c281301a9ffd1059d185620a9337e15a2 17-Feb-2016 Andy Hung <hunga@google.com> Enable FastTrack timestamps

Bug: 26413951
Change-Id: Id54c32cb0f0be83d443f6cf1007181ebc461c586
/frameworks/av/services/audioflinger/Tracks.cpp
8ce8e264d0bf09ec131e4a7701fe1ebc3a678f8b 16-Feb-2016 Eric Laurent <elaurent@google.com> Revert "Enable FastTrack timestamps"

This reverts commit b3a486fecddc9e9264fe63d356eca0812493db27.

Reverting while investigating the root cause.

Bug: 27186414
/frameworks/av/services/audioflinger/Tracks.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/Tracks.cpp
e99556b85081778027653bd3e716a529ab518b35 12-Feb-2016 Andy Hung <hunga@google.com> Merge "Fix audio timestamp computation for pause, stop, and dynamic speed changes" into nyc-dev
b3a486fecddc9e9264fe63d356eca0812493db27 05-Aug-2015 Andy Hung <hunga@google.com> Enable FastTrack timestamps

Bug: 26413951
Change-Id: I99a69241a0bcd69f6bfebf785cac6d9ee1e2cd5f
/frameworks/av/services/audioflinger/Tracks.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/Tracks.cpp
3f0c902beb53a245c9db35e871607dba05b8d391 16-Jan-2016 Andy Hung <hunga@google.com> Add AudioRecord timestamps

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

Bug: 8278435
Change-Id: I095c1a4888e645e14d93b0b15fbef4524a831ca1
/frameworks/av/services/audioflinger/Tracks.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/Tracks.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/Tracks.cpp
954ca45ac30539a49f179580b667b0ab1056d113 09-Sep-2015 Andy Hung <hunga@google.com> For static obtainBuffer(), do not set mUnreleased if acknowledging flush.

static audio tracks use obtainBuffer() to update position in start().

Bug: 22938515
Change-Id: I8ae32f6cce4d122386d2cf8982e158049b04ba9a
/frameworks/av/services/audioflinger/Tracks.cpp
e6fb82a207f5256933e2d83e77262331af50a27f 09-Sep-2015 Andy Hung <hunga@google.com> For static obtainBuffer(), do not set mUnreleased if acknowledging flush.

static audio tracks use obtainBuffer() to update position in start().

Bug: 22938515
Change-Id: I8ae32f6cce4d122386d2cf8982e158049b04ba9a
/frameworks/av/services/audioflinger/Tracks.cpp
a542782d0045588e55e075a763cedcd2d504ad22 12-Sep-2015 Andy Hung <hunga@google.com> Workaround static fast track start-after-stop issue

Bug: 23291988
Bug: 23614327
Bug: 23924081
Change-Id: Id1a519ed4bb2a6f4cb197da8450f7069b55c0d48
/frameworks/av/services/audioflinger/Tracks.cpp
564d144fc28917d42e3a67718ac51d61bfc36315 09-Sep-2015 Eric Laurent <elaurent@google.com> Revert "Do not acknowledge flush() on start() for static tracks"

This reverts commit cafe86a9cb6625bb1ec6383e16e28e4c9e455f87.

Bug: 23924093.
Change-Id: I186d1013b06a286eca93c30bb9b3545dc36695ff
/frameworks/av/services/audioflinger/Tracks.cpp
cafe86a9cb6625bb1ec6383e16e28e4c9e455f87 14-Aug-2015 Andy Hung <hunga@google.com> Do not acknowledge flush() on start() for static tracks

Bug: 22938515
Change-Id: I1de653de169a3fbbaa693da6057897ea57772447
/frameworks/av/services/audioflinger/Tracks.cpp
4c6afaf1053ecbfda6d95098e0f49772ecbcf2e1 13-Jun-2015 Andy Hung <hunga@google.com> Fix AudioRecord cleanup if construction fails

Bug: 11671194
Change-Id: Id48350264f8b5ce53bf7ce2b308bf4ba21e59241
/frameworks/av/services/audioflinger/Tracks.cpp
1b42097f38e72574ed853a35f4e8a66e4739c421 22-Apr-2015 Phil Burk <philburk@google.com> AudioTrack: fix spurious retrograde messages

The retrograde motion was confused by some positions coming from
the DSP on offloaded tracks. So the retrograde check was moved up
into AudioTrack.cpp. This allows us to take advantage of the checks
for invalid positions based on timing.

Bug: 2047891
Change-Id: Ifcad2349201443a7f1711347c203297100449536
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/services/audioflinger/Tracks.cpp
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/Tracks.cpp
8edb8dc44b8a2f81bdb5db645b6b708548771a31 27-Mar-2015 Andy Hung <hunga@google.com> Add playback rate to AudioTrack

Bug: 19196501
Change-Id: I6411e1d3ce652b711a71a6d9df020cb5f60d4714
/frameworks/av/services/audioflinger/Tracks.cpp
86f79e3f3bc1de7b4e4dd045de8962b8a62ab5d5 09-Apr-2015 Andy Hung <hunga@google.com> Merge "Improve ResamplerBufferProvider"
73c02e4277b399c2ec1555d32b6ad5df23bb83dc 29-Mar-2015 Andy Hung <hunga@google.com> Improve ResamplerBufferProvider

Change-Id: I3cc3af221ad5797ff219d75227350733afa180db
/frameworks/av/services/audioflinger/Tracks.cpp
77a44e8d1f902a100500ea69a450e22889dcff31 09-Apr-2015 Andy Hung <hunga@google.com> Merge "Add RecordBufferConverter for RecordThread data processing"
97a893eb34f8687485c88eaf15917974a203f20b 29-Mar-2015 Andy Hung <hunga@google.com> Add RecordBufferConverter for RecordThread data processing

Change-Id: Ia3aab8590cd41e8a7cba0a7345d70d2866d92045
/frameworks/av/services/audioflinger/Tracks.cpp
3bcf8597189c592713675ec58326ecbef0ac4ae9 03-Apr-2015 Eric Laurent <elaurent@google.com> audio flinger: improve device to device audio patches

Allow creation of audio patches between input and output
devices managed by the same audio HW module.

Change-Id: I4b83268a4d5c41f3d5905d7581202cf5193efd32
/frameworks/av/services/audioflinger/Tracks.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/Tracks.cpp
6140c79c31f5dc237fba69554de5be641cedf113 19-Mar-2015 Phil Burk <philburk@google.com> AudioFlinger: prevent retrograde timestamps for direct mode

Prevent retrograde motion in the HAL or drivers from making it
up through the AudioFlinger to the app.

Bug: 19604395
Change-Id: I11d6c0f7cab69e75fd4b4a2a90f64960b4bb6d5a
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/services/audioflinger/Tracks.cpp
240934ba80d6c6165749db7681d243c6857a092f 12-Mar-2015 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: refresh fast track underrun state upon start

False underrun is detected when starting recycled fast tracks, which
leads to continuous fatal assertion failures and even AP reboot.

Track's last mObservedUnderruns isn't updated one at previous stop()
call. Hence, when we start the same track again, we should synchronize
it to the latest state instead of relying on stale one.

authored-by: Weiyin Jiang<wjiang@codeaurora.org>
CRs-Fixed: 803389
Bug: 19635137
Signed-off-by: Andy Hung <hunga@google.com>
Change-Id: Ia003a49c6896dba965798c062c98b8c367ef8369
/frameworks/av/services/audioflinger/Tracks.cpp
63238efb0d674758902918e3cdaac322126484b7 03-Mar-2015 Glenn Kasten <gkasten@google.com> Remove redundant semicolon from namespace closing

Change-Id: I163f9d3d216c283ae1160ce4802e5247cf44fba7
/frameworks/av/services/audioflinger/Tracks.cpp
7841f704fee0e5acd45fa6e47a336120c3cad42c 27-Feb-2015 Andy Hung <hunga@google.com> Merge "Do not pre-fill OutputTrack buffer for duplicating thread"
ad8510a339ffab330c2c46e5c247dd1cf9e15c22 18-Feb-2015 Glenn Kasten <gkasten@google.com> Include what you use

Change-Id: I1967861f383bb5ed6743fb69e3bd439907ed7033
/frameworks/av/services/audioflinger/Tracks.cpp
5bedff60b2facaa1ec5b9433647ebf1504f065ca 16-Jan-2015 Andy Hung <hunga@google.com> Do not pre-fill OutputTrack buffer for duplicating thread

It is not necessary to start the downstream MixerThread early,
rather allow stop() to flush the remaining frames.

Change-Id: Ibcf8e7f5eda09d0f915d50697ff0c24c32fd11c4
/frameworks/av/services/audioflinger/Tracks.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/Tracks.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
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/Tracks.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.
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
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/Tracks.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/Tracks.cpp
847cbecbfda35e27a73a767c93fd0150ba001882 18-Nov-2014 Andy Hung <hunga@google.com> am a248703b: am a3e2c146: am 4d0a5985: Merge "Prevent stopped audio tracks from mixing data" into lmp-mr1-dev

* commit 'a248703b0799a9a27481f0ec13df90214a661eb5':
Prevent stopped audio tracks from mixing data
27876c02c21cd3ab7ef01bdd1fc5400c5143584a 10-Sep-2014 Andy Hung <hunga@google.com> Prevent stopped audio tracks from mixing data

Static tracks should have zero framesReady when stopping or stopped,
to prevent mixer from running potentially indefinitely with loop mode.

Bug: 16070883

Change-Id: Iab9968044d1a6f8543bbcbfb246f49f27d68cace
/frameworks/av/services/audioflinger/Tracks.cpp
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
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/Tracks.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/Tracks.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
955e24d3a8e218d4711cabc6558781e095011132 30-Sep-2014 Glenn Kasten <gkasten@google.com> Merge "Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp" 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/Tracks.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/Tracks.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/Tracks.cpp
648c1ecee3f79ff9d754dd982be59484de08d752 03-Sep-2014 Glenn Kasten <gkasten@google.com> am 955d8f90: am 23c8cf95: Merge "Restore the ability to build tee sink for debugging" into lmp-dev

* commit '955d8f906e920fe8da66e7943a7f2bfa98422e19':
Restore the ability to build tee sink for debugging
329f6511ee4e03a4605c70bbda8d3a96d2544884 29-Aug-2014 Glenn Kasten <gkasten@google.com> Restore the ability to build tee sink for debugging

This changelist does not enable tee sink, but makes it possible to do so.
Tee sink had suffered some bit rot since it is not built by default.

Also fixes a crash for > 2 byte per sample or > 2 channels.
Still does not write correct header for floating-point;
that will be best solved by moving to libsndfile.

Bug: 16990102
Change-Id: I8e92c588ccc513d7802d696fcfb324e815772df6
/frameworks/av/services/audioflinger/Tracks.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/Tracks.cpp
c2730ba7c5e9559b7499ef5e0d7742deb18c5110 21-Jul-2014 Eric Laurent <elaurent@google.com> audio policy: add support for USB devices for voice call

Add possibility to use sink and source devices not on
the primary HW module for voice calls (e.g. USB headsets).

Bug: 15520724.

Change-Id: Ib27db4ba759b6d91ea1104dc2e35c87733517b30
/frameworks/av/services/audioflinger/Tracks.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/Tracks.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/Tracks.cpp
529c61b7e4468a3e21f302f2a92a660249daa722 19-Jul-2014 Glenn Kasten <gkasten@google.com> Fix copy/paste bug

introduced by Change-Id: I4e9b7fa99858b488ac98a441fa70e31dbba1b865

Change-Id: I9a0c8800f5cf3767cc259776f95c96cad972e392
/frameworks/av/services/audioflinger/Tracks.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/Tracks.cpp
5e58b0abe5b6c8f5bd96a8f78bbeeeb4d3892020 24-Jun-2014 Andy Hung <hunga@google.com> Add floating point volume handling to AudioMixer

Use floating point volume in AudioMixer mixing when floating
point input is used with the new mixer engine.
AudioResampler is updated to take floating point volume to match.
Both legacy integer and floating point mixer engines work.

For now, integer volume is used when the new mixer engine
runs in integer input mode, for backward compatibility with
the legacy mixer. The new mixer engine will generally run in
floating point input mode. When the legacy path is removed,
the integer volumes will be removed.

Change-Id: I79e80c292ae7c8b8bdd0aa371a1b2c3a1b618290
/frameworks/av/services/audioflinger/Tracks.cpp
3348e36c51e91e78020bcc6578eda83d97c31bec 07-Jul-2014 Andy Hung <hunga@google.com> Replace int bitDepth with audio_format_t in Resampler

Remove mBitDepth from class (not used).
Replace with audio_format_t in factory method to distinguish
between float and pcm 16-bit.

Change-Id: I166860796c68285077ef4458d8758d19b82523f9
/frameworks/av/services/audioflinger/Tracks.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/Tracks.cpp
3bcffa136909c1fb6e88ee4efd12ccac18360a85 13-Jun-2014 Eric Laurent <elaurent@google.com> force command flush after releasing a reference to shared memory

After releasing a reference to a shared memory interface,
IPCThreadState::self()->flushCommands() must be called to ensure
that the corresponding reference is also cleared immediately in the
remote process. Otherwise the binder implementaiton will not
push the clear systematically causing the memory region not to be freed.

See issues 10711502 and 2801375.

Bug: 14057166.
Change-Id: If55f36f00d452d6cf00cf83bd2fba1c8f3abcb57
/frameworks/av/services/audioflinger/Tracks.cpp
0ac53364b79dc72ee0c09f0efc46a22ab4374dbf 11-Jun-2014 Glenn Kasten <gkasten@google.com> Merge "Fix non-monotonic AudioTrack::getTimestamp after pause" into lmp-preview-dev
ced6e74215937182fe2f9f6b0867f7c28ccd02c1 10-Jun-2014 Glenn Kasten <gkasten@google.com> Fix non-monotonic AudioTrack::getTimestamp after pause

Bug: 15523502
Change-Id: Ifd4aa7fca197bc041c1620fc3f7d953a8902551a
/frameworks/av/services/audioflinger/Tracks.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/Tracks.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/Tracks.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/Tracks.cpp
b4db73d022f3de3530bc2b3c9c831ccfdd1a2ead 20-May-2014 Andy Hung <hunga@google.com> Merge "Use new channel count functions for audio masks"
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/Tracks.cpp
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/Tracks.cpp
deb9081a61b446dbe50461082974a4228899f178 14-May-2014 Glenn Kasten <gkasten@google.com> Merge "Pull up mFlags and isFastTrack from Track to TrackBase"
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/Tracks.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/Tracks.cpp
fe9570c7b937b49d3603ccb394aed732b79bc6be 07-May-2014 Glenn Kasten <gkasten@google.com> Remove obsolete IAudioRecord::getCblk()

Change-Id: Id20b5efd765b9796b0e391610e06dc928a829ebf
/frameworks/av/services/audioflinger/Tracks.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/Tracks.cpp
1a7be1ec9c769203e6c8e26378de0ab8e2ad493d 29-Apr-2014 Bill Yi <byi@google.com> Merge commit '91820d46b5f3065c2fded3cdf65d305715b33bb1' into HEAD
1b24cf32e02a1372e57b3a2a432bc0adfe496e6d 16-Apr-2014 Mark Salyzyn <salyzyn@google.com> am e80631aa: am 839d11d1: Merge changes I0a744dc7,Id993a70d

* commit 'e80631aa1992ca50af679cd6a018c0ffda7f9b17':
media: use size_t for integer iterator to Vector::size()
media: 64 bit compile issues
e80631aa1992ca50af679cd6a018c0ffda7f9b17 16-Apr-2014 Mark Salyzyn <salyzyn@google.com> am 839d11d1: Merge changes I0a744dc7,Id993a70d

* commit '839d11d1f7be9dff2f06c7d30a9eb39cb6782078':
media: use size_t for integer iterator to Vector::size()
media: 64 bit compile issues
3ab368e0810d894dcbc0971350c095049478a055 15-Apr-2014 Mark Salyzyn <salyzyn@google.com> media: use size_t for integer iterator to Vector::size()

Change-Id: I0a744dc7815a86a993df9b0623440be620ec8903
/frameworks/av/services/audioflinger/Tracks.cpp
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/Tracks.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/Tracks.cpp
164985121796cf214c7a83d32005d9b01125b558 18-Mar-2014 Eric Laurent <elaurent@google.com> AudioFlinger: Change track ready condition in STOPPING_1 state

Set FS_FILLED only if framesReady() > 0

Change-Id: Ibb1d2e988ff17fcf3a7ab61031a3f85df82f18d5
/frameworks/av/services/audioflinger/Tracks.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/Tracks.cpp
3ef14ef30359376006a233f6a21a165d4b65a7df 13-Mar-2014 Glenn Kasten <gkasten@google.com> Make error handling more similar for output and capture

And simplify error case

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

Change-Id: I99752cca74a459c4746ea4718acb0115439e50bd
/frameworks/av/services/audioflinger/Tracks.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
0504a198d6595e29e58d1d66ae59fac1d662384a 05-Mar-2014 Haynes Mathew George <hgeorge@codeaurora.org> am 632c3790: am 7c206e5b: am e0cd1051: audioflinger: update track ready condition

* commit '632c3790523896260dc43fd6cd40a158765cdb15':
audioflinger: update track ready condition
e0cd1051ed9fea0629745c29020516ae62298461 28-Dec-2013 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: update track ready condition

Signal track ready if the track isStopping().

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

Change-Id: I611a63e63acf3eb17e2072c1a77b91fe9e62e36a
/frameworks/av/services/audioflinger/Tracks.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/Tracks.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/Tracks.cpp
9601c6efcb2552960d6f125d073525b581c1b7ec 10-Feb-2014 Marco Nelissen <marcone@google.com> Merge "Pretty up audioflinger dumpsys"
b220884bf3129253cc5bc8d030bc475411ea4911 07-Feb-2014 Marco Nelissen <marcone@google.com> Pretty up audioflinger dumpsys

Change-Id: I57e44b4c36b99f7149542bbcf9645521c6152dfa
/frameworks/av/services/audioflinger/Tracks.cpp
8f762d577f2dcf34357eb8731070ae465649ec9a 08-Feb-2014 Glenn Kasten <gkasten@google.com> Merge "Fix whitespace"
a793625031a3e326a261a0843598c35a5784bbde 07-Feb-2014 Glenn Kasten <gkasten@google.com> Merge "Use Format_isValid() and Format_isEqual() instead of direct comparison"
4944acb7355b3aa25748fd25945a363a69d65444 19-Aug-2013 Glenn Kasten <gkasten@google.com> Fix whitespace

Change-Id: I9add0872030a26933f6b6dad1be299154611cc56
/frameworks/av/services/audioflinger/Tracks.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/Tracks.cpp
6e0d67d7b496ce17c0970a4ffd3a6f808860949c 31-Jan-2014 Glenn Kasten <gkasten@google.com> Use Format_isValid() and Format_isEqual() instead of direct comparison

Change-Id: Ie87607aa514976947540a77775e6425c4e56e7d9
/frameworks/av/services/audioflinger/Tracks.cpp
0f11b51a57bc9062c4fe8af73747319cedabc5d6 01-Feb-2014 Glenn Kasten <gkasten@google.com> Fix unused parameter warnings in audio

Change-Id: I665ba3358dd9502f0adec70d486e7bf8a2e1b0fe
/frameworks/av/services/audioflinger/Tracks.cpp
f0002d142e6d24c5438600b2c259679de710f8ac 24-Jan-2014 Glenn Kasten <gkasten@google.com> Merge "Replace control block frameCount_ by explicit in/out parameter"
0bcfa88149e2404b34d13c622e3921e1b846cdf8 28-Dec-2013 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: update track ready condition

Signal track ready if the track isStopping().

Bug: 12423190
Change-Id: Ie279995d5f90fa8211a20dfbeacc1cf9b921d0bf
/frameworks/av/services/audioflinger/Tracks.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/Tracks.cpp
663c2247b71086e30bfd3192979d1dd7f15c539e 24-Sep-2013 Glenn Kasten <gkasten@google.com> Consistent error checking for sp<IMemory> and pointer()

There have been concerns that an sp<IMemory> could be non-0, but the
associated pointer() still be NULL. There are rumors this may happen
when a non-0 sp<IMemory> is passed in by client but the shared memory cannot
be re-mapped into mediaserver.

There's also evidence in the early (2009/03/03) pre-git code of checking
pointer() for NULL, after a local allocate() returned a non-0 sp<IMemory>.
It's not clear if this is "cargo cult" paranoia, or if there was a
genuine reason for the check.

In any case, we now consistently check pointer() for sp<IMemory>
input parameters in createTrack() and queueTimedBuffer().

We also check after successful allocate(). If allocate() returns a
non-0 sp<> but NULL pointer(), then treat it as if the allocate() had
returned 0.

Change-Id: I3013ac5766b493d443ecef71711ec861076a623e
/frameworks/av/services/audioflinger/Tracks.cpp
30ff92cba19c5acd747631365db1e1084e45ab34 20-Nov-2013 Glenn Kasten <gkasten@google.com> Code simplification for timed allocate

Change-Id: I5acccd7418c5b4a4dc0112147c750fef9f74bf33
/frameworks/av/services/audioflinger/Tracks.cpp
1fc6cb5be26734938b3999e6bf4ce0e625e7d284 30-Oct-2013 Eric Laurent <elaurent@google.com> am ce275b7d: am 1c594b63: Merge "audioflinger: enable effects after registration if needed" into klp-dev

* commit 'ce275b7dd20e3d4781a46126c753e6eb998e6c0f':
audioflinger: enable effects after registration if needed
1c594b637df26499ce1dae2db34f2b3290efd838 30-Oct-2013 Eric Laurent <elaurent@google.com> Merge "audioflinger: enable effects after registration if needed" into klp-dev
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/Tracks.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/Tracks.cpp
a153b68f2260a8ed7fbb236fa659b13264ac5ac0 19-Oct-2013 Glenn Kasten <gkasten@google.com> am 77177fa2: am 95c03858: Merge "Allow releaseBuffer after flush" into klp-dev

* commit '77177fa20773d02b4f9c4147ecb98107f019fa7d':
Allow releaseBuffer after flush
2e422c472c91aa7912befd0fc038d1e11f354bc1 18-Oct-2013 Glenn Kasten <gkasten@google.com> Allow releaseBuffer after flush

After AudioTrack start checks for pending flush,
allow releaseBuffer on any previously obtained buffer.
For example, this can happen if the resampler has obtained
a buffer but not released the whole buffer yet.
Note that the resampler will be reading obsolete data.

Bug: 11285590
Change-Id: I0614fbb62e43604aac3089cce4b7797c87a306b5
/frameworks/av/services/audioflinger/Tracks.cpp
9138d32050411c04cc45c25094352cf8b6e01df9 18-Oct-2013 Glenn Kasten <gkasten@google.com> am e45796de: am dedc7b0f: Merge "Fix flush() followed by start()" into klp-dev

* commit 'e45796dee9c072cdb13a00b407e68be2cd55e2f2':
Fix flush() followed by start()
12022ff8d223ccf4dfae019c81e4a93a3f44985c 17-Oct-2013 Glenn Kasten <gkasten@google.com> Fix flush() followed by start()

Bug: 11259166
Change-Id: I72526cdfd4e3ff4b06e6a317e577f57cc285205d
/frameworks/av/services/audioflinger/Tracks.cpp
d72b7c0180ee83fc3754629ed68fc5887a125c4c 13-Oct-2013 Eric Laurent <elaurent@google.com> audioflinger: enable effects after registration if needed

This fixes a bug where effects were not properly reenabled after
being moved from one playback thread to another. The effect
is enabled but the audio policy manager sees it as disabled.

Bug: 11181933.
Change-Id: I19cac7acbaf61c546e667fd85ed7d4eda1c716d8
/frameworks/av/services/audioflinger/Tracks.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
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/Tracks.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/Tracks.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/Tracks.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/Tracks.cpp
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
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/Tracks.cpp
f523897787b64cf2217d0ab4946b564420c675fe 12-Sep-2013 Glenn Kasten <gkasten@google.com> am 8a220740: am dc33c542: Merge "Fix AudioTrack shared memory leak" into klp-dev

* commit '8a220740cd77eb844123d3914190a94513797b40':
Fix AudioTrack shared memory leak
dc33c542351449ceee95cc50a9009f495e7c72ba 12-Sep-2013 Glenn Kasten <gkasten@google.com> Merge "Fix AudioTrack shared memory leak" into klp-dev
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.
efc4d4899e03fb8464017dd48539106cec2163de 12-Sep-2013 Eric Laurent <elaurent@google.com> Merge "audioflinger: add HOTWORD audio source." into klp-dev
0c72b24f91c68442eb374bd1b338c394105b8262 11-Sep-2013 Glenn Kasten <gkasten@google.com> Fix AudioTrack shared memory leak

Bug: 2801375
Change-Id: I50e15164fe310f69ea019dca5b49171a02bc6992
/frameworks/av/services/audioflinger/Tracks.cpp
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/Tracks.cpp
8136cfae9c22ae8ff42eec9ed751833dda605444 09-Sep-2013 Eric Laurent <elaurent@google.com> am 8a910716: am 6ca83fad: Merge "audioflinger: no effects on offloaded tracks" into klp-dev

* commit '8a910716892d17a2ac62c7e9884af0e9d75b26bc':
audioflinger: no effects on offloaded tracks
813e2a74853bde19e37d878c596a044b3f299efc 31-Aug-2013 Eric Laurent <elaurent@google.com> audioflinger: no effects on offloaded tracks

Invalidate offloaded tracks when an effect is enabled
so that the track is recreated in PCM mode and the effect
can be applied.
This is temporary until effect offloading is implemented.

Bug: 8174034.

Change-Id: I77b8b54a10db6cb8334be76d863ea7e720eaad09
/frameworks/av/services/audioflinger/Tracks.cpp
344202e13a91c9d3d109fd8f4a67f5b23efa7800 04-Sep-2013 Glenn Kasten <gkasten@google.com> am 55817ab9: am fe346c70: Fix miscellanous AudioTrack::getTimestamp() bugs

* commit '55817ab9c1868f1e6a59155f55c768f01509cda5':
Fix miscellanous AudioTrack::getTimestamp() bugs
1462a2b84a578b5541683c824e0f77ebf2aa82ae 04-Sep-2013 Glenn Kasten <gkasten@google.com> am a4a82c5f: am 6466c9e6: Add ExtendedAudioBufferProvider::framesReleased and onTimestamp

* commit 'a4a82c5f8f3eccfa10ce30a52cbb4b1c5c983282':
Add ExtendedAudioBufferProvider::framesReleased and onTimestamp
fe346c707f59d763ded93bc3d27b51f0c0408258 30-Aug-2013 Glenn Kasten <gkasten@google.com> Fix miscellanous AudioTrack::getTimestamp() bugs

Check that get_presentation_position is non-NULL before calling.

AudioTrack::getTimestamp not implemented for fast tracks.

Fix typo in Track::getTimestamp().

Fix bugs in AudioTrack::getTimestamp after stop:
- getTimestamp while stopped is not allowed.
- stop, start, getTimestamp now returns the correct value.

Change-Id: Ie8d9dc1f28d8927634e04175a68b147ffc2ea8eb
/frameworks/av/services/audioflinger/Tracks.cpp
6466c9e6e6278c740aed77f695f679be9f5db478 23-Aug-2013 Glenn Kasten <gkasten@google.com> Add ExtendedAudioBufferProvider::framesReleased and onTimestamp

and implement them in SourceAudioBufferProvider using the associated NBAIO_Source,
and in Track using the associated AudioTrackServerProxy.

Change-Id: I60dc4adba63fc1dc452ff16caf347e4a7c8242c2
/frameworks/av/services/audioflinger/Tracks.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()
30c296c153447f5c2bb5251928bf4d3c4e28e552 30-Aug-2013 Glenn Kasten <gkasten@google.com> am 3ae0a58a: am 9841f636: Merge "Add AudioFlinger::PlaybackThread::Track::getTimestamp()" into klp-dev

* commit '3ae0a58a83d092d96672295c8a62908478f28a9b':
Add AudioFlinger::PlaybackThread::Track::getTimestamp()
ec9ad1b0947f5d6b465281312dbe92f096a8f881 30-Aug-2013 Glenn Kasten <gkasten@google.com> am f94b2946: am 56b59224: Merge "Add IAudioTrack::getTimestamp()" into klp-dev

* commit 'f94b2946a511c5cbb6b9001449ca8278cb332bda':
Add IAudioTrack::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/Tracks.cpp
573d80a8f463f648a515fc0975bf83951b272993 26-Aug-2013 Glenn Kasten <gkasten@google.com> Add AudioFlinger::PlaybackThread::Track::getTimestamp()

with a dummy implementation initially,
and use it in AudioFlinger::TrackHandle::getTimestamp()

Change-Id: I2da88fc52a135a7f0d9fd9538986e919dc8ccd3b
/frameworks/av/services/audioflinger/Tracks.cpp
53cec22821072719ee02c856e9ac2dda2496c570 29-Aug-2013 Glenn Kasten <gkasten@google.com> Add IAudioTrack::getTimestamp()

with dummy implementation in AudioFlinger::TrackHandle, and
implement AudioTrack::getTimestamp() using IAudioTrack.

Also document invariant that mAudioTrack and control block are always
non-0 after successful initialization.

Change-Id: I9861d1454cff7decf795d5d5898ac7999a9f3b7e
/frameworks/av/services/audioflinger/Tracks.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/Tracks.cpp
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/Tracks.cpp
6ae6b811666865815ebb1f670aacb1a0f2edaa73 06-Aug-2013 Glenn Kasten <gkasten@google.com> Remove obsolete field RecordTrack::mAudioRecordServerProxy

Change-Id: I054ba929e209797542940a0e734fc15f19f321c9
/frameworks/av/services/audioflinger/Tracks.cpp
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/Tracks.cpp
d054c32443a493513ab63529b0c8b1aca290278c 12-Jul-2013 Glenn Kasten <gkasten@google.com> Move control block mName to createTrack() output

This is part of a series of CLs to clean up the shared memory
control block, by removing any fields that don't have to be there.

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

Change-Id: I7b6d31e24531954ab1ecdf3ed56c19433700bd89
/frameworks/av/services/audioflinger/Tracks.cpp
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/Tracks.cpp
a30e75897934da2ce7b1b03bcb4b58e139d3e81e 30-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Fix theoretical race using TrackBase::sampleRate()"
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/Tracks.cpp
b59c1ad726b8bdf441f373d0bdc612539769334a 29-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Declare methods in binder opcode order"
3dcd00dddec86a1c5133083ad7ba2265d49c048c 17-Jul-2013 Glenn Kasten <gkasten@google.com> Declare methods in binder opcode order

Change-Id: I5f624b7a51ffe1a17a67c056cf984f74e4c56eac
/frameworks/av/services/audioflinger/Tracks.cpp
35cc4f3127322ad3e3dd1e15e8ae29ff4b4a3af6 25-Jul-2013 Glenn Kasten <gkasten@google.com> Remove obsolete mBufferEnd

Change-Id: I507c6109d66000bb30933ca23b912a1316f55e5e
/frameworks/av/services/audioflinger/Tracks.cpp
bd4c4fbb3b073e48963185d11a15da1fa18d2e54 25-Jul-2013 Glenn Kasten <gkasten@google.com> Remove obsolete TrackBase::step(), mStepCount, mStepServerFailed

Change-Id: I6347096f066b8b19451c6472db7b0671f0cf7702
/frameworks/av/services/audioflinger/Tracks.cpp
afbbc6c5f6bc470d504dcf24ceb3ac21d57fb78d 29-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Simplify RecordTrack::stop()"
420ea49539d23ab305a7b33c0854a7a475493dd4 27-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "CBLK_OVERRUN, not CBLK_UNDERRUN, is for record threads"
65d30dd9ee498f7b3bfc033735458a6ff399c207 27-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Remove obsolete TrackBase::reset()"
a8356f663014e7d4c27869629af83d8bb3441e19 25-Jul-2013 Glenn Kasten <gkasten@google.com> Simplify RecordTrack::stop()

Change-Id: Ib959c1e9dc9544d12277ce11bea445118b2e0521
/frameworks/av/services/audioflinger/Tracks.cpp
fc38a2e0268b5e531db2975c3a81462a3593c861 25-Jul-2013 Glenn Kasten <gkasten@google.com> CBLK_OVERRUN, not CBLK_UNDERRUN, is for record threads

Change-Id: I8948f76ef4717a423c37cd6ea7db4381636af612
/frameworks/av/services/audioflinger/Tracks.cpp
0fea74cdbc09c1259e08215e2ea90e7988d62df8 25-Jul-2013 Glenn Kasten <gkasten@google.com> Remove obsolete TrackBase::reset()

Change-Id: I38100b7e28a12d7af8cb40ae3f4d9cb4a0ebe701
/frameworks/av/services/audioflinger/Tracks.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/Tracks.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/Tracks.cpp
ad3af3305f024bcbbd55c894a4995e449498e1ba 25-Mar-2013 Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Public API changes for audio offload support.

NOTE: this does _not_ include all private member variables added
to classes as part of offload support. Only public/protected functions
and stubs functions/variables needed to make the changes buildable.

- isOffloadSupported() added to audio policy service
A stub implementation is required to build, this always returns false
- setParameters() added to IAudioTrack
A stub implementation is required to build, this always returns
INVALID_OPERATION

- CBlk flag for stream end

- Change AudioSystem::getRenderPosition() to take an audio_output_t
so caller can specify which output to query

- Add AudioSystem::isOffloadSupported()
This is fully implemented down to the AudioFlinger function
AudioPolicyServer::isOffloadSupported() which is just a stub
that always returns false.

- Add EVENT_STREAM_END to AudioTrack interface.
STREAM_END is used to signal when the hardware has actually finished
playing all the data it was sent.

- Add event type enumeration to media player interface AudioSink callbacks
so that the same callback can be used to handle multiple types of
event. For offloaded tracks we also have to handle STREAM_END and
TEAR_DOWN events

- Pass audio_offload_info_t to various functions used for opening outputs,
tracks and audio players. This passes additional information about the
compressed stream down to the HAL when using offload.
For publicly-available APIs this is an optional parameter (for some of
the internal and low-level APIs around the HAL interface it is mandatory)

- Add getParameters() and setParameters() API to AudioTrack
Currently dummy implementations.

- Change AudioPlayer contructor so that it takes a set of bitflags defining what
options are required. This replaces the original bool which only specified
whether to use deep buffering.

- Changes to StageFright class definition related to handling tearing-down of
an offloaded track when we need to switch back to software decode

- Define new StageFright utility functions used for offloaded tracks
Currently dummy implementations.

- AudioFlinger changes to use extended audio_config_t.
Fills in audio_offload_info_t member if this info is passed in when
opening an output.

- libvideoeditor changes required to add the new event type parameter
to AudioSink callback functions

- libmediaplayerservice changes required to add the new event type parameter
to AudioSink callback functions

Change-Id: I3ab41138aa1083d81fe83b886a9b1021ec7320f1
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Eric Laurent <elaurent@google.com>
/frameworks/av/services/audioflinger/Tracks.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/Tracks.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/Tracks.cpp
7c027248e1a4ccd5b22bc4deafb03e2d87ac8f38 26-Dec-2012 Glenn Kasten <gkasten@google.com> Consistent whitespace

Change-Id: I118cce68d3b777f9ec9b6bfb70367496422a40f2
/frameworks/av/services/audioflinger/Tracks.cpp
8d2d4932b96632e9eb3af4a3d4000192ef603960 25-Apr-2013 Eric Laurent <elaurent@google.com> audioflinger: fix duplicating track sampling rate

Add missing initialization of client proxy sampling rate
and volumes in OutputTrack constructor.

Bug: 8687522
Change-Id: I813e700315bb97083a63dd32279f1998ac775483
/frameworks/av/services/audioflinger/Tracks.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/Tracks.cpp
bf04b5860182d8f4130dcb5d6d88ee68a58c99cd 02-Mar-2013 Glenn Kasten <gkasten@google.com> Merge "media.log cleanup" into jb-mr2-dev
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/Tracks.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/Tracks.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/Tracks.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/Tracks.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/Tracks.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/Tracks.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/Tracks.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/Tracks.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/Tracks.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/Tracks.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/Tracks.cpp
9e58b552f51b00b3b674102876bd6c77ef3da806 19-Jan-2013 Glenn Kasten <gkasten@google.com> AudioFlinger uses media.log service for logging

Change-Id: Ia0f8204334f6b233f644d897762a18c95d936b4b
/frameworks/av/services/audioflinger/Tracks.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/Tracks.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/Tracks.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/Tracks.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/Tracks.cpp