History log of /frameworks/av/services/audioflinger/Threads.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0f7b5f2b231caf87da9b20b74d086e5a9d6f4a9d 19-Dec-2014 Eric Laurent <elaurent@google.com> audioflinger: pause HW A/V sync output when AudioTrack underruns

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

Bug: 17883772.

Change-Id: I11e6c97ec24360d75f9b602814d40a54b60cb7a7
/frameworks/av/services/audioflinger/Threads.cpp
d1f69b0b17acbd96987ecb2f3378abd394d05903 15-Dec-2014 Eric Laurent <elaurent@google.com> audioflinger: implement pause/resume for direct outputs

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

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

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

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

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

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

Bug: 18360054
Change-Id: If7aee81d62b7af8532abd14579677848a06fe2b1
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/services/audioflinger/Threads.cpp
275e8e9de2e11b4b344f5a201f1f0e51fda02d9c 01-Dec-2014 Eric Laurent <elaurent@google.com> audio policy: add support for custom mixes

Add support for custom mixes in AudioPolicyManager.

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

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

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

Bug: 16009464.

Change-Id: I3f1c2a485a0fb71b1f984ed0adc9b68aa971e408
/frameworks/av/services/audioflinger/Threads.cpp
9a1c8892f6835325db6931529dc74bf98cf0aee8 03-Dec-2014 Andy Hung <hunga@google.com> Fix getTimestamp if offload thread is not initialized.

Returns INVALID_OPERATION.

Bug: 18605649
Change-Id: I440fb687fbf9249098e049982fa83bcd1515fd80
/frameworks/av/services/audioflinger/Threads.cpp
e83b55dc29ca16092ba02f36f55fa6e0e37fd78c 14-Nov-2014 Eric Laurent <elaurent@google.com> audio policy: new getOutputForAttr() prototype.

Update getOutputForAttr() prototype and group all logic
dealing with audio attributes to stream type conversion in
audio policy manager.

getOutputForAttr():
- specifies the audio session (for future use)
- returns a status code
- receives either stream type (for legacy) or audio attributes
- returns an updated streamtype

Remove logic dealing with legacy stream types to attributes conversion
from AudioTrack.

Use correct type for audio sessions in other APIs (startOutput() ...).

releaseOutput() specifies the audio session (for future use).

Bug: 18067208.

Change-Id: I1bfbe9626c04c7955d77f8a70aecfad2cb204817
/frameworks/av/services/audioflinger/Threads.cpp
223fd5c9738e9665e495904d37d4632414b68c1e 11-Nov-2014 Eric Laurent <elaurent@google.com> audio: new routing strategies and stream types

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

Bug: 18067208.
Change-Id: I88f884b552e51e4a49c29125e5a1204cf58ff434
/frameworks/av/services/audioflinger/Threads.cpp
ec0eeafa8a7fd882e8206e9cf8c4c7e1db81857b 20-Nov-2014 Haynes Mathew George <hgeorge@codeaurora.org> Fix format conversion in DuplicatingThread

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

Bug: 18461844
Change-Id: If05254f87f9198e09a0fa3c4e857afbb53ae7073
/frameworks/av/services/audioflinger/Threads.cpp
02b5708776ba2a9b4ff8c09008483aef7dbe38c7 08-Nov-2014 Eric Laurent <elaurent@google.com> audioflinger: fix duplicating thread output buffers clear

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

Bug: 18262127.
Change-Id: I4c22bbeaccdcc8d7c10c5882dde3439eb73d6ede
/frameworks/av/services/audioflinger/Threads.cpp
ac302143551a8b964f026385a524dda9ff8ea5ba 20-Oct-2014 Marco Nelissen <marcone@google.com> Fix the fix

We need to clear the buffer a little more often.

Bug: 18023017
Change-Id: If8a522b9133a4269e2435af8958f6ced322e71e9
/frameworks/av/services/audioflinger/Threads.cpp
57088b5c8e76855b99b3e6b3e410de5b6382670e 18-Oct-2014 Marco Nelissen <marcone@google.com> Clear effect buffer before sending to chain

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

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

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

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

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

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

This reverts commit 54464ba861aaafd11ee5645f5d1ecd1171c6e9fe.

Bug: 17733142.

Change-Id: I9886d40032b2f7d96bee03e600e14f78943d8052
/frameworks/av/services/audioflinger/Threads.cpp
955e24d3a8e218d4711cabc6558781e095011132 30-Sep-2014 Glenn Kasten <gkasten@google.com> Merge "Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp" into lmp-dev
f71224ce266abb39f83ecba87783c2347631654a 30-Sep-2014 Eric Laurent <elaurent@google.com> Merge "audioflinger: forward flush to direct output streams" into lmp-dev
54464ba861aaafd11ee5645f5d1ecd1171c6e9fe 28-Sep-2014 Glenn Kasten <gkasten@google.com> Fix uncertainty of one normal mix buffer in AudioTrack::getTimestamp

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

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

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

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

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

Bug: 17578238
Change-Id: I0fd27a477b73ba0e1c5a658bdfad17c500f5dc67
/frameworks/av/services/audioflinger/Threads.cpp
80b617cf82e0030deef4f968a6341e2867166135 17-Sep-2014 Eric Laurent <elaurent@google.com> audioflinger: remove debug log.

Remove debug log left by commit ab5cdbaf.

bug: 17537746.
Change-Id: I10f672f607f8e87caaa8228fc05eff8aee7dfa15
/frameworks/av/services/audioflinger/Threads.cpp
aaa44478a373232d8416657035a9020f9c7aa7c3 13-Sep-2014 Eric Laurent <elaurent@google.com> audioflinger: fix pre processing effect leak

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

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

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

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

Bug: 17110064.
Change-Id: I5cd644daa357afd1f3548f9bcb28e6152d95fdb8
/frameworks/av/services/audioflinger/Threads.cpp
3abc2ded40066f3b1df23aceb553f22d569c5cd3 06-Sep-2014 Glenn Kasten <gkasten@google.com> Make IPowerManager native conform to .aidl for oneway

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

Bug: 16408906
Change-Id: I058a50906af810787e444a96819cb781b7f639ad
/frameworks/av/services/audioflinger/Threads.cpp
97d547da43c9c41711d1ed1e3f4fa87c2ee3cb9a 02-Sep-2014 Eric Laurent <elaurent@google.com> audio flinger: fix use of global effect buffer

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

But not enabled (kEnableExtendedChannels == false).

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

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

Bug: 14815883.

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

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

Also happens when restarting AudioFlinger.

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

Buffer frame count and notification frame count
are now calculated by server instead of by client.
The server has more information and can do a better job.

Also fix a few bugs:

- If a fast track was re-created, even with same pipe depth, it would fail.
Now it can correctly re-create a fast track provided the pipe depth is same.

- Notification frame count for fast tracks was calculated by client
as 1/2 of the total frame count, which is a large value due to the pipe.
Now the notification frame count is set by server to the HAL frame count.
This should reduce latency for fast tracks.

- EVENT_OVERRUN were happening frequently when there was sample rate conversion,
because the client didn't know about the sample rate conversion,
and under-estimated the necessary buffer size. Now since server
calculates the buffer sizes, EVENT_OVERRUN is unlikely.

- RecordThread::createRecordTrack_l was checking for mono and stereo
for fast tracks. This is not necessary, and now we can handle a
multi-channel fast track.

Bug: 7498763
Change-Id: I0c581618e8db33084d5ff9ed50a592990c9749e8
/frameworks/av/services/audioflinger/Threads.cpp
6e6704c06d61bc356e30c164081e5bcffb37920c 03-Jul-2014 Glenn Kasten <gkasten@google.com> Improve dumpsys for capture threads

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

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

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

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

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

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

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

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

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

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

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

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

Bug: 9428304.

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

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

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

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

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

commit 9128d6ffec43731d723f9b394f243d940f4c7e41
Author: Glenn Kasten <gkasten@google.com>
Date: Tue May 13 10:38:42 2014 -0700

Use of fast capture by normal capture

Will only configure fast capture path if the input buffer size is less than
10 ms and the input sample rate is same as the primary output sample rate.

Change-Id: I4a7cdc6069d750845412c626d27e83f72a1ab397

commit 2e5e0806a5abe7499848358ef5fde5c26405000d
Author: Glenn Kasten <gkasten@google.com>
Date: Mon Jun 2 08:29:22 2014 -0700

Add mPrimaryOutputSampleRate

Change-Id: I46b527fc3f2b5a5720a74b4f0b9a8f2e0d570b09

commit baf1d73467923996d1b1f2a9237260cc5697e050
Author: Andy Hung <hunga@google.com>
Date: Fri May 30 10:42:03 2014 -0700

Change parameter type for volume to float in AudioMixer

Change-Id: I4da1505ce852505f86f8e5b87f60e8edceeb30e0

commit 40fe20fa9760cd03c69778c2021cf7a490d75ece
Author: Andy Hung <hunga@google.com>
Date: Fri May 30 10:35:47 2014 -0700

Rename UNITY_GAIN to UNITY_GAIN_INT in AudioMixer

Change-Id: Ic040311305026f0b4c4280a5b3bef7a447ac1da3

commit 37c9a2b49f876abc5ff537a9ec036d7f0a423775
Author: Andy Hung <hunga@google.com>
Date: Thu May 29 21:33:13 2014 -0700

Refactor setVolumeRampVariables in AudioMixer

Change-Id: I8fcf3101bcea292de7c65433fa578f1c9cdd0974

commit 397070eca31f121d5d3993de1bfea99aaea5d4f3
Author: Andy Hung <hunga@google.com>
Date: Thu May 29 18:52:38 2014 -0700

Fix floating point output from mixer

A buffer pointer was being erroneously reset to buffer start,
potentially causing an audio glitch. The floating point
output mode is not enabled at this time, but will be in
the future.

Change-Id: If8b6414d232f064f3a2e2c5a6da889a91b27fb24

commit 2e61aa5b33b2247bbc5d4eaa0b519df9accd4bbc
Author: Andy Hung <hunga@google.com>
Date: Fri May 23 21:22:17 2014 -0700

Add multiple format capability to FastMixer

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

Change-Id: I0da17810ee71381a39a006c46faec71108d22c26

commit b9ea653c702a785bbd23a66c5e588d40b4192c4e
Author: Andy Hung <hunga@google.com>
Date: Thu May 29 15:53:09 2014 -0700

Avoid resetting BufferProviders in mixer unnecessarily

Change-Id: Iad85c4dfd21be1dbf89dc11906106b34219376f8

commit 7f1a6d6da21c616f80cf9ba21bea11b419ec561b
Author: Andy Hung <hunga@google.com>
Date: Tue May 27 12:32:17 2014 -0700

Update dynamic resampler buffer fetching

Make the criteria tight for fetching to avoid storing
excessive frame data internal to the resampler.
This should reduce jitter in frame delivery computation.

Bug: 14962343
Change-Id: I7adaf714d11c272696ccdbf218bda994c7217477

commit b5e4aac07b9a02f0c803c090058602b03ac09ebb
Author: Glenn Kasten <gkasten@google.com>
Date: Tue May 27 12:30:54 2014 -0700

Allow kFastTrackMultiplier to be specified per device

Change-Id: I4eaaaf038df720cec4f5d9221d1b632970f9e3dd

commit b93cd97a52af31122df2da2cc0415cda888c8c73
Author: Andy Hung <hunga@google.com>
Date: Fri May 23 21:13:31 2014 -0700

Rename mixBuffer to mMixerBuffer in FastMixer

Likewise mixBufferState becomes mMixerBufferState.
This harmonizes with the naming in AF::MixerThread.

Change-Id: I1255d7c07cc2c6ee925d7430925236d2bd163122

commit 8340758622b9711365a8801806cbdf934803c63f
Author: Andy Hung <hunga@google.com>
Date: Mon May 12 16:51:41 2014 -0700

Add multiple format capability to AudioMixer

Change-Id: I04ac1cafd90b6ed652f8d51888ad07576678f0bc
Signed-off-by: Andy Hung <hunga@google.com>

commit 6b695b9d094820c232a897a3fabbe83d2b7193fe
Author: Glenn Kasten <gkasten@google.com>
Date: Thu Mar 13 14:59:31 2014 -0700

Start adding FastCapture based on FastThread WIP

This version supports at most one fast capture client.

Change-Id: Idf609bfc80ae22433433d66a5232c043c65506df

commit e951ad05a2c388471d7e2806d91e7d51325a150a
Author: Glenn Kasten <gkasten@google.com>
Date: Mon May 12 11:06:26 2014 -0700

Move validation of frameCount from set to openRecord_l

This move is needed because frameCount is validated on server side for
fast tracks (as should be done for normal tracks too).

Change-Id: I6d99e80869fd90fab373cf60ef348c01f075fbca

commit 73e76992dbba794894837c38e5472312ea829cf3
Author: Glenn Kasten <gkasten@google.com>
Date: Tue May 13 10:41:52 2014 -0700

Allow track buffer "allocation" to be from pipe

Change-Id: Ib9ac170f8e8b7746b3588157a56cbee3b753a1cb

commit 60de1d7ded05c6304037d4858b401094b1d2b4d3
Author: Andy Hung <hunga@google.com>
Date: Fri May 9 15:02:21 2014 -0700

Add format parameter to getTrackName() and track_t

Change-Id: Ia152a839014e235fbfb656104c15d7c1b456d02e
Signed-off-by: Andy Hung <hunga@google.com>

Change-Id: Ied0ade8b25d23e89bb03319a7e3135c238f735b9
/frameworks/av/services/audioflinger/Threads.cpp
8f415570afb174f0781d8bf6b1c0fa6bdecca7cd 03-Jun-2014 Andy Hung <hunga@google.com> Merge "Change parameter type for volume to float in AudioMixer"
6dbb5e3336cfff1ad51d429fcb847307c06efd61 13-May-2014 Glenn Kasten <gkasten@google.com> Use of fast capture by normal capture

Will only configure fast capture path if the input buffer size is less than
10 ms and the input sample rate is same as the primary output sample rate.

Change-Id: I4a7cdc6069d750845412c626d27e83f72a1ab397
/frameworks/av/services/audioflinger/Threads.cpp
6be494077f8d7970f3a88129c5d139c5a0c88f6d 30-May-2014 Andy Hung <hunga@google.com> Change parameter type for volume to float in AudioMixer

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

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

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

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

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

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

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

Change-Id: Idaa5a883b19a45816651c58cac697640dc717cd9
/frameworks/av/services/audioflinger/Threads.cpp
5912117110ae6efadd862fcb0e395fdcd18aa00c 27-May-2014 Glenn Kasten <gkasten@google.com> Merge "Move validation of frameCount from set to openRecord_l"
c62476f0c0c1cf9283a38852bde0a4c9434df712 24-May-2014 Andy Hung <hunga@google.com> Merge "Add format parameter to getTrackName() and track_t"
29b703eec27b305e7b5b2343bf257643e38f6b68 12-May-2014 Glenn Kasten <gkasten@google.com> Move validation of frameCount from set to openRecord_l

This move is needed because frameCount is validated on server side for
fast tracks (as should be done for normal tracks too).

Change-Id: I6d99e80869fd90fab373cf60ef348c01f075fbca
/frameworks/av/services/audioflinger/Threads.cpp
87cebadd48710e42474756fc3513df678de045ce 22-May-2014 Elliott Hughes <enh@google.com> resolved conflicts for merge of f285c91e to master

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

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

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

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

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

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

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

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

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

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

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

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

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

* commit 'be2664dac34a6a9d9f754d4097b32158d4947cd2':
Codec Offload: Add NULL check as mCallbackThread is NULL when offloaded HAL is running BLOCKING mode
4c9bde7a3e636d3ecccd7905d142dbbb80e977a0 19-May-2014 Eric Laurent <elaurent@google.com> am ce473c32: Merge "Codec Offload: Add NULL check as mCallbackThread is NULL when offloaded HAL is running BLOCKING mode"

* commit 'ce473c32705e2d1c5fcc817198101e1220b3c8f7':
Codec Offload: Add NULL check as mCallbackThread is NULL when offloaded HAL is running BLOCKING mode
e541269be94f3a1072932d51537905b120ef4733 16-May-2014 Andy Hung <hunga@google.com> Use new channel count functions for audio masks

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

b/14897952

Change-Id: I159a33e1181c1a62d80ab4bd3337a35dafaad884
Signed-off-by: Uday Gupta <guptau@broadcom.com>
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
/frameworks/av/services/audioflinger/Threads.cpp
755b0a611f539dfa49e88aac592a938427c7e1b8 13-May-2014 Glenn Kasten <gkasten@google.com> Pull up mFlags and isFastTrack from Track to TrackBase

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

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

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

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

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

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

openRecord() now explicitly returns the control block and data buffer
as separate IMemory references. If the IMemory for data buffer
is 0, this means it immediately follows the control block.

Change-Id: Ic098f88f0e037f8fbe30006689e18cacacf09d06
/frameworks/av/services/audioflinger/Threads.cpp
b880f5e5fc07397ddd09a94ba18bdf4fa62aae00 07-May-2014 Glenn Kasten <gkasten@google.com> Add a per-thread heap that is read-only to clients

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

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

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

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

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

Original author wjiang <wjiang@codeaurora.org>

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

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

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

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

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

AUDIO_INTERLEAVE_*
AUDIO_STREAM_MIN
AUDIO_SESSION_ALLOCATE

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

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

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

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

Bug: 12870871

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

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

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

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

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

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

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

This reverts commit e7e676fd2866fa4898712c4effa9e624e969c182.

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

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

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

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

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

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

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

AudioFlinger enters a deadlock (with itself) on trying to free a
RecordTrack or Track object that failed initialization. Clear this
bad object from the caller instead.

Bug: 12423233
Change-Id: I926f2beb922a70f6924e593e2bbf1a5b5df85b16
/frameworks/av/services/audioflinger/Threads.cpp
4f4c9a22f4676c65bcae77f0805dcd699b3ba475 06-Mar-2014 Eric Laurent <elaurent@google.com> am 281dd4e1: audioflinger: fix static track end detection

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

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

If a static track is not a fast track,
prepareTracks_l() must rely on framesReady() to
detect end of buffer and remove the track from the active
track list.
Failing to do so results in the track staying active but
not processed by the mixer because in underrun. This leaves the
mix buffer content uninitialized and causes the effect process
function to accumulate its output onto undefined data.

Bug: 12013676.
Change-Id: I4b0819a9d93141ac3307b8786fc6a451dd585220
/frameworks/av/services/audioflinger/Threads.cpp
7e92abeafb184e8a34213d7149592e95a72601b0 22-Nov-2013 Eric Laurent <elaurent@google.com> audioflinger: fix offload write buffer offset

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

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

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

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

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

AudioFlinger enters a deadlock (with itself) on trying to free a
RecordTrack or Track object that failed initialization. Clear this
bad object from the caller instead.

Bug: 12423233
Change-Id: I926f2beb922a70f6924e593e2bbf1a5b5df85b16
/frameworks/av/services/audioflinger/Threads.cpp
788207057ed4b8df4719ed8089f376ef52de9ca1 01-Mar-2014 Andy Hung <hunga@google.com> Rename mSinkFormat to mMixerFormat for AudioMixer::track_t

AudioMixer::SINK_FORMAT also changes to AudioMixer::MIXER_FORMAT

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

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

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

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

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

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

Updated variable names are
kMinNormalSinkBufferSizeMs
kMaxNormalSinkBufferSizeMs

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Contains the necessary changes to make frameworks/av build and work
on a 64-bit machine.

Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>

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

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

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

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

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

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

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

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

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

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

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

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

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

This isn't used at the moment.

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

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

Unless AudioFlinger was built with FAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE
enabled, AudioFlinger would deny using the fast path (and internally
fall back to the normal codepath) when it realized that resampling
was required. Since the buffer size calculations within AudioFlinger
don't take resampling into account properly (see the calculation
below "AUDIO_OUTPUT_FLAG_FAST denied" in audioflinger/Threads.cpp,
just below the hunk that this patch changes), make sure AudioTrack
doesn't try to use the fast path if resampling is required.

This removes the possibility to enable
FAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE in AudioFlinger since it
AudioTrack now won't even try to use the fast path for content
that requires resampling, regardless of the AudioFlinger configuration.

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

If a static track is not a fast track,
prepareTracks_l() must rely on framesReady() to
detect end of buffer and remove the track from the active
track list.
Failing to do so results in the track staying active but
not processed by the mixer because in underrun. This leaves the
mix buffer content uninitialized and causes the effect process
function to accumulate its output onto undefined data.

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

AudioFlinger enters a deadlock (with itself) on trying to free a
RecordTrack or Track object that failed initialization. Clear this
bad object from the caller instead.

Bug: 12423233
Change-Id: I926f2beb922a70f6924e593e2bbf1a5b5df85b16
/frameworks/av/services/audioflinger/Threads.cpp
000a4193dd82549192277fd4b9bb571d8a4c262f 30-Jan-2014 Eric Laurent <elaurent@google.com> audioflinger: fix record thread exit pending check

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

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

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

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

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

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

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

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

If a static track is not a fast track,
prepareTracks_l() must rely on framesReady() to
detect end of buffer and remove the track from the active
track list.
Failing to do so results in the track staying active but
not processed by the mixer because in underrun. This leaves the
mix buffer content uninitialized and causes the effect process
function to accumulate its output onto undefined data.

Bug: 12013676.
Change-Id: Iad72c921fa18d34811abf7d1073890c093a27725
/frameworks/av/services/audioflinger/Threads.cpp
74935e44734c1ec235c2b6677db3e0dbefa5ddb8 19-Dec-2013 Glenn Kasten <gkasten@google.com> Replace control block frameCount_ by explicit in/out parameter

in IAudioFlinger::createTrack and IAudioFlinger::openRecord

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

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

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

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

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

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

This change allows a media.log buffer for RecordThread.

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

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

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

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

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

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

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

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

Share code to acquire wake lock at entry to loop

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

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

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

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

Commit 9da3d95 surfaced a problem caused by the use of a raw
pointer to a track in offload thread implementation.

Pointers to tracks should always be weak or strong pointers.

Bug: 11708529.
Change-Id: Ic48632532d186c9be8261f73cefdf824b9fbbd2b
/frameworks/av/services/audioflinger/Threads.cpp
561879df42b65f44b83c391d78d351e9ad4cb162 14-Nov-2013 Eric Laurent <elaurent@google.com> am 307aa870: am 4215e616: Merge "audioflinger: fix offload track transition" into klp-dev

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

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

Make sure that when transitioning from one active
offloaded track to the next we flush DSP content
if both tracks are not on the same audio session.
This happens when switching between two applications
playing the same type of content (e.g MP3, stereo, 44.1).
In this case, we reuse the same output thread because the track
formats are compatible.

Bug: 11247103.
Change-Id: I2b9031591149adeb70766da5e0d21ff2933a37e8
/frameworks/av/services/audioflinger/Threads.cpp
1b9f9b134e732a48198e51f16424f330cbf03143 13-Nov-2013 Eric Laurent <elaurent@google.com> audioflinger: fix offload resume after drain

When pausing and resuming during the drain,
the drain sequence number shuold not be modified
otherwise the drain callback will be ignored.
This causes failure to notify end of stream to audio
player and transition to next song.

Bug: 11247103.
Change-Id: I2a35c5cc3fd6aa667cdd257f9e9cc8715cef5159
/frameworks/av/services/audioflinger/Threads.cpp
579dd27d96497022e534e859c6ebbec675ee07aa 08-Nov-2013 Glenn Kasten <gkasten@google.com> Fix build

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

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

This change will permit some future planned features.

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

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

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

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

Underruns on tracks handled by a direct or offloaded
threads were not properly reported to the applications
causing a failure to automatically recover.

Bug: 11535001.
Change-Id: I7a8696b4d646f78b16710addfe7c108d0dd0038d
/frameworks/av/services/audioflinger/Threads.cpp
93e471f620454f7de73d190521568b1e25879767 19-Aug-2013 Glenn Kasten <gkasten@google.com> Rename standby methods

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

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

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

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

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

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

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

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

Commit fd47797 fixing issue 11247103 introduced a regression
where the duplicating thread does not exit standby state as
expected. This in turn prevents the tracks sending audio to
other threads to complete their activity cycle normally.

The fix conists in clearing mStandby state also in the specialized
threadLoop_write() method of DuplicatingThread subclass.

Bug: 11451415.
Change-Id: Ie8a92c819a56a2834ea25fa70a8b7b2125721775
/frameworks/av/services/audioflinger/Threads.cpp
d21952fe5bc94f7bb6ee729f806c0e641fdb1a0d 29-Oct-2013 Eric Laurent <elaurent@google.com> am 7f8f7585: am fd477974: AudioFlinger: more fixes for offload audio lost

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

mStandby being false was not a reliable indication that
something had been written to audio HAL.

Considering the last track in mActiveTracks vector as the
latest activated track was wrong as this is a SortedVector.

Bug: 11247103.
Change-Id: I397d011c5afcdd779def3fe25aaae7669a472cfc
/frameworks/av/services/audioflinger/Threads.cpp
9cae217050aa1347d4ac5053c305754879e3f97f 14-Jan-2013 Marco Nelissen <marcone@google.com> Assign blame for playback wakelocks.

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

Cherrypicked from master.

b/9464621

Change-Id: I7329f88a288a95a582a78005a1c3d16a5a611e31
/frameworks/av/services/audioflinger/Threads.cpp
462fd2fa9eef642b0574aa7409de0bde3fec8d43 14-Jan-2013 Marco Nelissen <marcone@google.com> Assign blame for playback wakelocks.

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

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

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

When a track is terminated before any audio was written,
we should not send a drain request to the HAL. The drain
will be ignored and we will wait the async callback for ever.

Also fix a potential deadlock by not deleting a track with the
thread mutex held: mPreviousTrack changed from a sp to a raw pointer.

Bug: 11247103.
Change-Id: I0a4b47b099204c7c326d45d700234ab8f72d8eae
/frameworks/av/services/audioflinger/Threads.cpp
3278eed31fcf82045ac00dcd549dda5270c88971 15-Oct-2013 Narayan Kamath <narayan@google.com> am 8580679e: am 014e7fa2: Make Audio wakelock names less unique.

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

These wakelocks now show up in the client process, where they
might cause wakelock overflows if AudioFlinger threads die often.

The client process should be agnostic of audio flinger threading,
so don't make the wakelock names rely on audioflinger thread names.

Wakelock names now depend only on the audio flinger thread type, and
not the ID itself.

bug: 11200551

Change-Id: Ia1f71b569cb7502d617b77596abc245f461a6ec0
/frameworks/av/services/audioflinger/Threads.cpp
35295078ab59c8c5d143a54d5a55557c3ca62c51 07-Oct-2013 Glenn Kasten <gkasten@google.com> resolved conflicts for merge of 9a7d11f0 to master

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

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

If a pause/flush/resume sequence is fast enough, resume is received while
we are still in PAUSING state in which case it is a NOP. If this happens,
flush is still forwarded to the audio HAL but is not preceeded by a pause
which can cause problems to the audio DSP.
It is necessary to preserve the flush as this sequence is typical to a seek.

The fix consists in forcing a pause/resume when a flush request must be
executed and the audio HAL has not been paused previously.

Bug: 11081559.
Change-Id: Ib84ed26d503a61c05933b923ec556b10cedfe140
/frameworks/av/services/audioflinger/Threads.cpp
1c7feca9cc3e408dfeb632e7060cf31e5015227e 04-Oct-2013 Eric Laurent <elaurent@google.com> am 6c48a011: am 026c5b07: Merge "audioflinger: fix wake lock acquisition check" into klp-dev

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

Commit e14a5d6 introduced a bug in ThreadBase::acquireWakeLock() where
the wake lock acquisition return code is not initialized before
being checked causing the wake lock token to be sometines not set
and potential failure to release the wake lock later.

Bug: 10985160.
Change-Id: Iffd40e773ae3bcfec3c148a844d5dbebbf474eaf
/frameworks/av/services/audioflinger/Threads.cpp
5918e0cb64200f64632595f7aea6062c65d43353 04-Oct-2013 Marco Nelissen <marcone@google.com> am b5677882: am 8097068d: Merge "Better recording wake lock accounting" into klp-dev

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

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

b/10985160

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

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

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

Volume: add a method to wake up the mediaserver playback
thread when a volume command is received on an offloaded track.

Effects: call effect chain process on offloaded playback threads
asynchronously from writes to allow effect state updates while
waiting for async write callback.

Bug: 10796540.

Change-Id: Id2747ae88783575d1d7ffd6fc86fbd054ab2c739
/frameworks/av/services/audioflinger/Threads.cpp
4de95592980dba88a35b3dc8f3fd045588387a4f 27-Sep-2013 Eric Laurent <elaurent@google.com> audioflinger: fix crash when starting offload thread

Passing a sp to parent thread to AsyncCallbackThread() constructor
causes a strong reference to be acquired on the OffloadThread inside
its constructor which causes an early launch of the thread loop
with unpredictable consequences.

Pass a wp to parent thread instead.

Also move the creation of the AsyncCallbackThread to
readOutputParameters() where mUseAsyncWrite is initialized which
makes more sense.

Also change the type of AsyncCallbackThread parent thread to PlaybackThread
instead of OffloadThread to allow a broder use of non blocking write which
in theory is not limited to audio offload use case.

Bug: 8174034.
Change-Id: I4b093b022030cd4f5eb8b8e477333e91098a6549
/frameworks/av/services/audioflinger/Threads.cpp
e93cf2ca27ae6f4a81d4ef548bbf10a34db6d98f 24-Sep-2013 Glenn Kasten <gkasten@google.com> Cleanup openRecord error handling

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

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

Commit 1abbdb4 was not working 100% of the times because
it is possible that the offload thread loop never sleeps
after being created in which case the property is never read.

The loop now reads the property once when starting.

Bug: 10899309.
Change-Id: I2e2ca332f2d7086e59d65f6010378c4d9618ba9e
/frameworks/av/services/audioflinger/Threads.cpp
0230a2a8a413076a138db4c4e1dea018104fd5e2 20-Sep-2013 Eric Laurent <elaurent@google.com> am c6bed216: am a3b97ad2: Merge "audioflinger: implement getTimestamp() for offloaded tracks" into klp-dev

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

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

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

It was possible that a resume request signaled by addTrack_l()
while waiting for an async write callback is lost. This is because
mSignalPending was not set and waitingAsyncCallback_l() would pause the
thread loop before executing prepareTracks_l().

The fix consists in using signal_l() method to wake the thread
loop o that mSignalPending is set.

Also make sure that sleepTime is reset to 0 when resuming to make sure
that we write any remaining bytes to the HAL.

Bug: 10810347.

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

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

Offloading of audio effects is now enabled for offloaded
output threads. If an effect not supporting offload is enabled,
the AudioTrack is invalidated so that it can be recreated in PCM
mode.

Fix some issues in effect proxy related to handling of effect
commands to offloaded and non offloaded effects.

Also fixed a bug on capture index in software Visualizer effect.

Bug: 8174034.

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

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

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

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

- Increase offloaded output thread standby delay to 1 second
to allow transition between tracks with going to stanby
if reusing the same audio track (gapless)

- Make sure pause/flush/resume sequence is sent to the HAL
in the right order

- Fix format display in track dump

Bug: 8174034.
Change-Id: I43ef6f8fdbf7427e4eff6cc2d0665d7d1463ea8a
/frameworks/av/services/audioflinger/Threads.cpp
d5577f26de1ae3a0dc6fbea9c60a07d585f894bf 12-Sep-2013 Eric Laurent <elaurent@google.com> am 4823964d: am efc4d489: Merge "audioflinger: add HOTWORD audio source." into klp-dev

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

HOTWORD is a special capture audio source that uses
the same audio tuning as VOICE_RECOGNITION but allows an
active capture to be preempted.

Bug: 10640877.

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

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

Remove possible race conditions between async callback
thread and offload thread when clearing and setting the
draining and write blocked flags.

Bug: 8174034.
Change-Id: I7af10491f39dc0e7d7414862a9d8e763daa2e2b7
/frameworks/av/services/audioflinger/Threads.cpp
a7fef85e7d419a4f5d6a3144f9ba70ceff2f122a 04-Sep-2013 Glenn Kasten <gkasten@google.com> am f81d5fc1: am 943ba3cc: Merge "Add NBAIO_Sink::getTimestamp()" into klp-dev

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

with a real implementation in AudioStreamOutSink
for dummy implementation initially in MonoPipe.

Use in AudioFlinger::PlaybackThread::threadLoop_write()
to keep the input to the timestamp latch up-to-date.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

The flags are currently unused, but will be used for requesting a fast
track. Making flags in/out will allow reporting back up to client that
the request is denied.

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

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

This fixes a regression that was introduced earlier
by commit 9f80dd223d83d9bb9077fb6baee056cee4eaf7e5
called "New control block for AudioTrack and AudioRecord".
That commit broke underrun reporting for fast tracks.

Also remove Track::mUnderrunCount, which counted the number of underrun
events, and was only used by dumpsys media.audio_flinger.

Now dumpsys media.audio_flinger reports the number of underrun frames,

Isolated underrun-related control block accesses via the proxy, so that
the server is not directly poking around in the control block.

The new proxy APIs are AudioTrackServerProxy::getUnderrunFrames() and
AudioTrackServerProxy::tallyUnderrunFrames(). getUnderrunFrames() returns
a rolling counter for streaming tracks, or zero for static buffer tracks
which never underrun, but do a kind of 'pause' at end of buffer.
tallyUnderrunFrames() increments the counter by a specified number of frames.

Change-Id: Ib31fd73eb17cbb23888ce3af8ff29f471f5bd5a2
/frameworks/av/services/audioflinger/Threads.cpp
b08ab81bab9e8cd2e3a7fff02725a387070fd078 31-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Add resampler comments and fix a typo"
34af02647b387a252fb02bab8e2cb9f7bd9c8abb 30-Jul-2013 Glenn Kasten <gkasten@google.com> Add resampler comments and fix a typo

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

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

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

In RecordThread::readInputParameters(), mRsmpInBuffer is allocated
with new[] and should be freed with delete[] instead of delete.

This error has been found by valgrind.

Change-Id: I2f947abb658a21a7d1e61eebb99270cb37d2d147
Signed-off-by: Andrei V. FOMITCHEV <andreix.fomitchev@intel.com>
Signed-off-by: David Wagner <david.wagner@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
/frameworks/av/services/audioflinger/Threads.cpp
fa319e6d918b84f93fb5457af5d1cca6421ac517 30-Jul-2013 Glenn Kasten <gkasten@google.com> Remove CC_LIKELY and CC_UNLIKELY where not needed

Only keep them in performance-sensitive code

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

This prepares for using it in PlaybackThreads later

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

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

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

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

Change-Id: I2cc2fedf3e33144e5c8bbd9894763282d9217f63
/frameworks/av/services/audioflinger/Threads.cpp
2eeca1f8e18106d118f7268cb9d8597539685c5c 29-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Move local variable declarations to point of first use"
b283374cbf79dc5a36f1eef0015d7baf8881792e 29-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Move delete AudioMixer closer to point of re-allocation"
afbbc6c5f6bc470d504dcf24ceb3ac21d57fb78d 29-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Simplify RecordTrack::stop()"
422801c5e9b795105f28e639c4bed5ee3f4e56f3 26-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "HAL stream format for mixer output threads must be stereo 16-bit PCM"
a8356f663014e7d4c27869629af83d8bb3441e19 25-Jul-2013 Glenn Kasten <gkasten@google.com> Simplify RecordTrack::stop()

Change-Id: Ib959c1e9dc9544d12277ce11bea445118b2e0521
/frameworks/av/services/audioflinger/Threads.cpp
bfb1b832079bbb9426f72f3863199a54aefd02da 07-Jan-2013 Eric Laurent <elaurent@google.com> AudioFlinger: offload playback, non-blocking write

- Added specialized playback thread class for offload playback,
derived from directoutput thread.
This thread type handles specific state transitions for offloaded
tracks and offloading commands (pause/resume/drain/flush..) to audio HAL.
As opposed to other threads, does not go to standby if the track is paused.

- Added support for asynchronous write and drain operations at audio HAL.
Use a thread to handle async callback events from HAL: this avoids locking
playback thread mutex when executing the callback and cause deadlocks when
calling audio HAL functions with the playback thread mutex locked.

- Better accouting for track activity: call start/stop and release Output
methods in audio policy manager when tracks are actually added and removed
from the active tracks list.
Added a command thread in audio policy service to handle stop/release commands
asynchronously and avoid deadlocks with playback thread.

- Track terminated status is not a state anymore. This condition is othogonal
to state to permitted state transitions while terminated.

Change-Id: Id157f4b3277620568d8eace7535d9186602564de
/frameworks/av/services/audioflinger/Threads.cpp
9e8fcbcd8efa51d70d1207ff57bfbfe31324287a 25-Jul-2013 Glenn Kasten <gkasten@google.com> Move delete AudioMixer closer to point of re-allocation

No need to delete AudioMixer before readOutputParameters

Change-Id: Icafa785c9021bbe8d985e4f9527f8fc8c5e62622
/frameworks/av/services/audioflinger/Threads.cpp
7fc97ba08e2850f3f16db704b78ce78e3dbe1ff0 17-Jul-2013 Glenn Kasten <gkasten@google.com> HAL stream format for mixer output threads must be stereo 16-bit PCM

Direct and tunnel output threads can support various HAL stream formats,
included encoded. But currently there are stereo 16-bit PCM assumptions
in several places for mixer and duplicating output threads:
- mMixBuffer and mixBuffer()
- AudioMixer including resampler
- FastMixer's mixBuffer
- effects
- NBAIO_Format
- anywhere FCC_2 is used
- possibly other places

Until those assumptions are removed, this CL enforces stereo 16-bit
PCM in mixer and duplicating threads at the place where the HAL format
is read. It was already being checked in checkForNewParameters_l(),
but not in readOutputParameters().

Change-Id: Ibe344cc922743da234299097aa1bb1f54795cc9b
/frameworks/av/services/audioflinger/Threads.cpp
d8ea699dc8e7dac58bb32e9cdb31b0758da25817 16-Jul-2013 Glenn Kasten <gkasten@google.com> Simplify getParameters()

Change-Id: Iedfeca3cd477d023c350d6d4e6eed874ee467a32
/frameworks/av/services/audioflinger/Threads.cpp
34542acfa25c6413c87a94b6f7cc315a0c496277 26-Jun-2013 Glenn Kasten <gkasten@google.com> Move local variable declarations to point of first use

Change-Id: Ideb83dea2c3002651c34fa646753cba598e29e93
/frameworks/av/services/audioflinger/Threads.cpp
fad226abd12435dbcd232f7de396f1a097b2bd5f 17-Jul-2013 Glenn Kasten <gkasten@google.com> Use standard name and type for channel mask

Former name 'channels' was ambiguous with respect to channel count.

Change-Id: I716f792d95a7e0c787d27514ad6e93dbcef8a415
/frameworks/av/services/audioflinger/Threads.cpp
291bb6d8947c5b0c062f0895d623c529259bfa39 17-Jul-2013 Glenn Kasten <gkasten@google.com> AudioRecord and HAL input stream must be 16-bit PCM only

Currently there are 16-bit PCM assumptions in several places for capture:
- resampler API
- mRsmpInBuffer and mRsmpOutBuffer
- RecordThread::threadLoop upmix, downmix, and resampling
- possibly other places

Until those assumptions are removed, this CL enforces 16-bit PCM in both
client and server at all places where a format is checked.

Change-Id: I08b0570bff626ad0d341804825a72c14e61b4233
/frameworks/av/services/audioflinger/Threads.cpp
4182c4e2a07e2441fcd5c22eaff0ddfe7f826f61 15-Jul-2013 Glenn Kasten <gkasten@google.com> Use AudioSystem::setLowRamDevice() to configure memory

Bug: 9798886
Change-Id: I9321e3f369f1ed9429ae222e3926ebdeb012b8b0
/frameworks/av/services/audioflinger/Threads.cpp
153b9fe667e6e78e0218ff0159353097428c7657 15-Jul-2013 Glenn Kasten <gkasten@google.com> Make AudioFlinger::instantiate() more resilient when called from separate module

Bug: 8834855
Change-Id: I4cd842cdfb09d2aaaaab9df9ac3bec6179709bd3
/frameworks/av/services/audioflinger/Threads.cpp
c6ae3c8a261794fd4445e4e152d1ada074a3f92f 17-Jul-2013 Glenn Kasten <gkasten@google.com> Fix theoretical memory leak in mConfigEvents

Change-Id: I137f70676c8919661e716c33e0dd9c25c2b6285c
/frameworks/av/services/audioflinger/Threads.cpp
1ab85ec401801ef9a9184650d0f5a1639b45eeb9 31-May-2013 Glenn Kasten <gkasten@google.com> Include what is needed

Remove old includes.
Header files only include other header files that they directly need themselves.

Change-Id: Ic471386808d9f42ea19ccbd59cb50a5f83a89dd0
/frameworks/av/services/audioflinger/Threads.cpp
9fdcb0a9497ca290bcf364b10868587b6bde3a34 27-Jun-2013 Glenn Kasten <gkasten@google.com> Fix theoretical race using TrackBase::sampleRate()

In two places we assumed that TrackBase::sampleRate() would return the
same value when it is called twice in the same function. This is not
guaranteed; sampleRate() reads from the control block so the return
value could change. To fix this, only call sampleRate() once and cache
the return value to get a consistent value.

This was only a theoretical race. In MixerThread::prepareTracks_l()
it would have no bad effect. In TimedTrack::getNextBuffer() it could
cause a real problem, but we don't currently support dynamic sample rate
ratios for timed tracks.

Change-Id: I8e5c33f0121fc058d1e70c2ab5e9135397d3e0b7
/frameworks/av/services/audioflinger/Threads.cpp
9f80dd223d83d9bb9077fb6baee056cee4eaf7e5 19-Dec-2012 Glenn Kasten <gkasten@google.com> New control block for AudioTrack and AudioRecord

Main differences between old and new control block:
- removes the mutex, which was a potential source of priority inversion
- circular indices into shared buffer, which is now always a power-of-2 size

Change-Id: I4e9b7fa99858b488ac98a441fa70e31dbba1b865
/frameworks/av/services/audioflinger/Threads.cpp
fe9a901a445633e70073b1b91fca3af34d8e8132 12-Jun-2013 Eric Laurent <elaurent@google.com> am bb35be24: am 7be48189: Merge "audioflinger: fix effects on direct output threads" into jb-mr2-dev

* commit 'bb35be24239f05f59715960a93cd491a4cd3b4d6':
audioflinger: fix effects on direct output threads
d0107bcd44fe608b0c00a8843d19fb6356c4cb69 11-Jun-2013 Eric Laurent <elaurent@google.com> audioflinger: fix effects on direct output threads

PlaybackThread::addTrack_l() uses the assumption that
effects are attached to a track only if the track accumulation
buffer is different from the mixer thread output buffer.
This is not true for direct output threads where only one track is active
an only one buffer is needed.
This assumption is an optimization to avoid checking for effect chains with
the same session ID each time a track is processed. The optimization
is not key if only one track is attached to the thread which is the case for
direct outputs.

Current code fails to increment the active track count in the effect chain
on direct output threads when a track is started thus making the effect
framework clear the mix buffer and produce silence each time the mixer runs.

The fix consists in removing the optimization described above.

Bug: 9324989.

Change-Id: Id7a6337450ed90d326299c2ce9fc02f4b9e2fa6f
/frameworks/av/services/audioflinger/Threads.cpp
04b035e3ccbf2919e4447c66e6483c11f2889f01 07-Jun-2013 Eric Laurent <elaurent@google.com> am d3a5b48a: am 18b46679: Merge "AudioFlinger: do not cache audio device when 0." into jb-mr2-dev

* commit 'd3a5b48a1bc4f5d6ff4472f54f909abaadd5fa39':
AudioFlinger: do not cache audio device when 0.
7e1139c0377b6806942fb2a043737b3b9cf0ae91 07-Jun-2013 Eric Laurent <elaurent@google.com> AudioFlinger: do not cache audio device when 0.

AudioFlinger should not cache the audio device
passed to the audio HAL when it is AUDIO_DEVICE_NONE
but keep previous valid selection instead.

Bug: 9323399.
Change-Id: I6f9480e55a21be4115453e6a5eebc5cf2536c476
/frameworks/av/services/audioflinger/Threads.cpp
7c027248e1a4ccd5b22bc4deafb03e2d87ac8f38 26-Dec-2012 Glenn Kasten <gkasten@google.com> Consistent whitespace

Change-Id: I118cce68d3b777f9ec9b6bfb70367496422a40f2
/frameworks/av/services/audioflinger/Threads.cpp
61d404efeaaf3ea1b615c160b843ac9f274d0018 20-May-2013 Dianne Hackborn <hackbod@google.com> Update to supply correct name for new power manager app ops.

Change-Id: Ia686319509d98a4f467479ea494e8a54f2c1e238
/frameworks/av/services/audioflinger/Threads.cpp
f8197a6a9d9363cb52bb8a2c15c0e5a52064355e 23-Apr-2013 Glenn Kasten <gkasten@google.com> Remove timing jitter during startup of audio

This fixes a regression introduced recently, that increased timing jitter
during the startup of the FastMixer and AudioTrack callback threads.

The regression was to make requestPriority() asynchronous as a way to
avoid an apparent priority inversion in system_server. This means that
the target thread could run briefly with the initial priority, before
the new priority takes effect.

This change removes the startup jitter for FastMixer, by making the
requestPriority() synchronous again for that case. It doesn't matter
that this restores the priority inversion involving normal mixer thread,
because it happens during startup of both threads.

The change also removes the startup jitter for the AudioTrack callback
thread, by having the target thread check whether the requestPriority()
has completed yet. If not, the target thread blocks with a timeout
until the priority boost finishes.

Finally, we now log an error message if the expected priority boost
doesn't happen.

Bug: 8698989
Change-Id: Id590e9a274b70ec1ba85b44a585ee37a22e41cbc
/frameworks/av/services/audioflinger/Threads.cpp
a07f17ca46db04c9d5d9e7d6b2878db59ca2b9ea 23-Apr-2013 Glenn Kasten <gkasten@google.com> Remove timing jitter during startup of audio

This fixes a regression introduced recently, that increased timing jitter
during the startup of the FastMixer and AudioTrack callback threads.

The regression was to make requestPriority() asynchronous as a way to
avoid an apparent priority inversion in system_server. This means that
the target thread could run briefly with the initial priority, before
the new priority takes effect.

This change removes the startup jitter for FastMixer, by making the
requestPriority() synchronous again for that case. It doesn't matter
that this restores the priority inversion involving normal mixer thread,
because it happens during startup of both threads.

The change also removes the startup jitter for the AudioTrack callback
thread, by having the target thread check whether the requestPriority()
has completed yet. If not, the target thread blocks with a timeout
until the priority boost finishes.

Finally, we now log an error message if the expected priority boost
doesn't happen.

Bug: 8698989
Change-Id: Id590e9a274b70ec1ba85b44a585ee37a22e41cbc
/frameworks/av/services/audioflinger/Threads.cpp
7fd54ff906c69400727fc8e90118a8a0429d7ab2 04-Apr-2013 Eric Laurent <elaurent@google.com> audioflinger: multiple tracks on direct output

Fix problems when multiple tracks exist on a direct output
thread: when multiple tracks are active, continue to update all
track states but only take into account the last track started
for audio HAL volume and mixer state control.

Bug 8388941

Change-Id: I57e6757286f41651dda99b11a5449e431812431b
/frameworks/av/services/audioflinger/Threads.cpp
d595b7c858c481a07745674ce2d8a6690e980e74 04-Apr-2013 Eric Laurent <elaurent@google.com> audioflinger: multiple tracks on direct output

Fix problems when multiple tracks exist on a direct output
thread: when multiple tracks are active, continue to update all
track states but only take into account the last track started
for audio HAL volume and mixer state control.

Bug 8388941

Change-Id: I57e6757286f41651dda99b11a5449e431812431b
/frameworks/av/services/audioflinger/Threads.cpp
a265845ecafe06c9668ce7ac67636657f4bedf86 26-Feb-2013 Glenn Kasten <gkasten@google.com> Miscellaneous cleanup

Abbreviation framesReady to fRdy for new systrace.
Put inline const on one line.
Use local copy of mState in state.
Improve logging.
Line length 100.

Change-Id: I8201c3ce0e53fd464fd33d02544e52c342d40b68
/frameworks/av/services/audioflinger/Threads.cpp
c9b2e20f7c9a71e07ef398152709c76079decbcd 26-Feb-2013 Glenn Kasten <gkasten@google.com> Miscellaneous cleanup

Abbreviation framesReady to fRdy for new systrace.
Put inline const on one line.
Use local copy of mState in state.
Improve logging.
Line length 100.

Change-Id: I8201c3ce0e53fd464fd33d02544e52c342d40b68
/frameworks/av/services/audioflinger/Threads.cpp
10774e144b3c99afad9a5070ccf50fdb12b5fb4e 02-Mar-2013 Glenn Kasten <gkasten@google.com> Merge "media.log cleanup" into jb-mr2-dev
bf04b5860182d8f4130dcb5d6d88ee68a58c99cd 02-Mar-2013 Glenn Kasten <gkasten@google.com> Merge "media.log cleanup" into jb-mr2-dev
d3c4b134a87b96227b90b9ec052d8a6e9880bbdf 27-Feb-2013 Glenn Kasten <gkasten@google.com> media.log cleanup

Remove almost all of the specific logs, but leave the media.log
logging infrastructure in place for the next time we need it.

Re-apply a few good changes that were reverted earlier:
- check logf format vs. argument list compatibility
- distinguish potentially modified and actually modified tracks in FastMixer
- fix benign bug where sq->end() was called more than once
- fix a build warning

Bug: 6490974
Change-Id: I02d3e83646c738acaebb415bd0d6b548638b4ef5
/frameworks/av/services/audioflinger/Threads.cpp
ab7d72f0804fbb7e91ad9d2a16f826d97e20e5d0 27-Feb-2013 Glenn Kasten <gkasten@google.com> media.log cleanup

Remove almost all of the specific logs, but leave the media.log
logging infrastructure in place for the next time we need it.

Re-apply a few good changes that were reverted earlier:
- check logf format vs. argument list compatibility
- distinguish potentially modified and actually modified tracks in FastMixer
- fix benign bug where sq->end() was called more than once
- fix a build warning

Bug: 6490974
Change-Id: I02d3e83646c738acaebb415bd0d6b548638b4ef5
/frameworks/av/services/audioflinger/Threads.cpp
dd0bda0c47871d4964b5035a096c7c8c27fa7469 26-Feb-2013 Glenn Kasten <gkasten@google.com> Remove tee sink debugging at compile time

Bug: 8223560
Change-Id: Iddbfb06c45d43d9f20bb428215dd4094931e19a7
/frameworks/av/services/audioflinger/Threads.cpp
46909e7eb074ce1b95b8a411eb71154f53f84f77 26-Feb-2013 Glenn Kasten <gkasten@google.com> Remove tee sink debugging at compile time

Bug: 8223560
Change-Id: Iddbfb06c45d43d9f20bb428215dd4094931e19a7
/frameworks/av/services/audioflinger/Threads.cpp
dd4abb5177b8d94cd30a787d4ce336d5110c185c 10-Jan-2013 Glenn Kasten <gkasten@google.com> Update tee sink

Implement rotation to reduce long-term storage use.
Implement optional per-track tee.
Dynamically enable at runtime based on property, instead of at compile-time.
Dynamic frame count not yet implemented.

Bug: 8223560
Change-Id: I3706443c6ec0cb0c6656dc288715a02ad5fea63a
/frameworks/av/services/audioflinger/Threads.cpp
da6ef1320d0161b1640dc84d7a9c5a25860c3619 10-Jan-2013 Glenn Kasten <gkasten@google.com> Update tee sink

Implement rotation to reduce long-term storage use.
Implement optional per-track tee.
Dynamically enable at runtime based on property, instead of at compile-time.
Dynamic frame count not yet implemented.

Bug: 8223560
Change-Id: I3706443c6ec0cb0c6656dc288715a02ad5fea63a
/frameworks/av/services/audioflinger/Threads.cpp
5f6f3764989601d3b3ee65beaf1447d2a6b5f284 16-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 32584a7d672864b20ab8b83a3cb23c1858e908b7

Change-Id: I9dc680578b955b1af462eeb7a49d61a0d45eb81b
/frameworks/av/services/audioflinger/Threads.cpp
7f5d335f7b4caecd0dfb8f1085f352f1d2da5d2e 16-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 32584a7d672864b20ab8b83a3cb23c1858e908b7

Change-Id: I9dc680578b955b1af462eeb7a49d61a0d45eb81b
/frameworks/av/services/audioflinger/Threads.cpp
dd9764290b3c1d801fea9505189cae29db919902 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size
- log mFastIndex when AudioMixer sees an invalid bufferProvider.
- log both potentially modified and actually modified tracks in FastMixer.
- fix benign bug where sq->end() was called more than once.
- log StateQueue push() call and return.
- increase StateQueue size from 4 to 8 entries
- log mixer->enable(), bufferProvider, and currentTrackMask
- log buffer provider addresses
- increase fast mixer log buffer again
- check logf format vs. argument list compatibility
- add logging to AudioMixer
- add checking of magic field in AudioMixer to detect overwrites
- add bool AudioMixer::enabled()
- increase log buffer sizes yet again
- enable assertion checking without ALOGV
- improve a few log messages
- check for corruption in more places
- log in all the process hooks
- add new mixer APIs so we can check for corruption of mixer state
- fix a build warning

Bug: 6490974
Change-Id: Ib0c4a73dcf606ef9bd898313b3b40ef61ab42f51
/frameworks/av/services/audioflinger/Threads.cpp
32584a7d672864b20ab8b83a3cb23c1858e908b7 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size
- log mFastIndex when AudioMixer sees an invalid bufferProvider.
- log both potentially modified and actually modified tracks in FastMixer.
- fix benign bug where sq->end() was called more than once.
- log StateQueue push() call and return.
- increase StateQueue size from 4 to 8 entries
- log mixer->enable(), bufferProvider, and currentTrackMask
- log buffer provider addresses
- increase fast mixer log buffer again
- check logf format vs. argument list compatibility
- add logging to AudioMixer
- add checking of magic field in AudioMixer to detect overwrites
- add bool AudioMixer::enabled()
- increase log buffer sizes yet again
- enable assertion checking without ALOGV
- improve a few log messages
- check for corruption in more places
- log in all the process hooks
- add new mixer APIs so we can check for corruption of mixer state
- fix a build warning

Bug: 6490974
Change-Id: Ib0c4a73dcf606ef9bd898313b3b40ef61ab42f51
/frameworks/av/services/audioflinger/Threads.cpp
ce70d400ff9fb614e334ab2b661df2933533ef57 15-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 639482c24c911b125398b31883ba6d55faebe28b

Change-Id: I11f2829072ab11e18b0663024f27bf31192f1d39
/frameworks/av/services/audioflinger/Threads.cpp
e186b51e0a9834b287d7a509e960eaf1b688db75 15-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 639482c24c911b125398b31883ba6d55faebe28b

Change-Id: I11f2829072ab11e18b0663024f27bf31192f1d39
/frameworks/av/services/audioflinger/Threads.cpp
5881f18029deb80eb83ea88046d0593441be79c7 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size
- log mFastIndex when AudioMixer sees an invalid bufferProvider.
- log both potentially modified and actually modified tracks in FastMixer.
- fix benign bug where sq->end() was called more than once.
- log StateQueue push() call and return.
- increase StateQueue size from 4 to 8 entries
- log mixer->enable(), bufferProvider, and currentTrackMask
- log buffer provider addresses
- increase fast mixer log buffer again
- check logf format vs. argument list compatibility
- add logging to AudioMixer
- add checking of magic field in AudioMixer to detect overwrites
- add bool AudioMixer::enabled()

Bug: 6490974
Change-Id: I1f3f18aa62d9fbd35bc32285b669f5ba40efe28e
/frameworks/av/services/audioflinger/Threads.cpp
639482c24c911b125398b31883ba6d55faebe28b 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size
- log mFastIndex when AudioMixer sees an invalid bufferProvider.
- log both potentially modified and actually modified tracks in FastMixer.
- fix benign bug where sq->end() was called more than once.
- log StateQueue push() call and return.
- increase StateQueue size from 4 to 8 entries
- log mixer->enable(), bufferProvider, and currentTrackMask
- log buffer provider addresses
- increase fast mixer log buffer again
- check logf format vs. argument list compatibility
- add logging to AudioMixer
- add checking of magic field in AudioMixer to detect overwrites
- add bool AudioMixer::enabled()

Bug: 6490974
Change-Id: I1f3f18aa62d9fbd35bc32285b669f5ba40efe28e
/frameworks/av/services/audioflinger/Threads.cpp
7f2f8042cf335ab1323dec3edbe9143a06109f4e 14-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 0ddd56316262ac74a95e9edb595697c163136d6d

Change-Id: I180a928af6f5a38d15a5efe44cd1fe927b5d961c
/frameworks/av/services/audioflinger/Threads.cpp
51eb3965caa8ba135bcdd8ffb7a2024a042ecdc0 14-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 0ddd56316262ac74a95e9edb595697c163136d6d

Change-Id: I180a928af6f5a38d15a5efe44cd1fe927b5d961c
/frameworks/av/services/audioflinger/Threads.cpp
b900234f9e772bb7591a551f06ba17ee1969368f 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size
- log mFastIndex when AudioMixer sees an invalid bufferProvider.
- log both potentially modified and actually modified tracks in FastMixer.
- fix benign bug where sq->end() was called more than once.
- log StateQueue push() call and return.

Bug: 6490974
Change-Id: Iee7c8f40e20b6000cd8286c0ec6a14fff4a37af1
/frameworks/av/services/audioflinger/Threads.cpp
0ddd56316262ac74a95e9edb595697c163136d6d 13-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size
- log mFastIndex when AudioMixer sees an invalid bufferProvider.
- log both potentially modified and actually modified tracks in FastMixer.
- fix benign bug where sq->end() was called more than once.
- log StateQueue push() call and return.

Bug: 6490974
Change-Id: Iee7c8f40e20b6000cd8286c0ec6a14fff4a37af1
/frameworks/av/services/audioflinger/Threads.cpp
c93aff0a698265501f46393f3146b884aa357aee 12-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 3051df27261e9952c0e642dec548515250e85f6a

Change-Id: I8bf5c3e91b65bd20de26f480c367c2854b62373c
/frameworks/av/services/audioflinger/Threads.cpp
ecd9389c8712aedeb2a79823ea0e4fb842684269 12-Feb-2013 Glenn Kasten <gkasten@google.com> Revert "Temporary additional logging to investigate bug"

This reverts commit 3051df27261e9952c0e642dec548515250e85f6a

Change-Id: I8bf5c3e91b65bd20de26f480c367c2854b62373c
/frameworks/av/services/audioflinger/Threads.cpp
a1bf28b533907b0b234e52c72bc372b3fa49c5a3 12-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size

Bug: 6490974
Change-Id: I4c030f171343fe4b483eae0ddea4427118d8d4b1
/frameworks/av/services/audioflinger/Threads.cpp
3051df27261e9952c0e642dec548515250e85f6a 12-Feb-2013 Glenn Kasten <gkasten@google.com> Temporary additional logging to investigate bug

The bug appears related to continuing to use an invalid buffer provider
in fast mixer after track destruction, so focus the added logs in that area.

Also includes a bug fix: was calling log in an unsafe place
near Threads.cpp AudioFlinger::PlaybackThread::createTrack_l line 1250.

Details:
- include caller pid or client pid where appropriate
- increase log buffer size

Bug: 6490974
Change-Id: I4c030f171343fe4b483eae0ddea4427118d8d4b1
/frameworks/av/services/audioflinger/Threads.cpp
83fa606bd629ac32a2dab5af255188acfa30db4a 04-Feb-2013 Eric Laurent <elaurent@google.com> Merge "AudioFlinger: fix RecordThread initial device"
59686720182dcaa1a1a4757964df38c16f1a5246 04-Feb-2013 Eric Laurent <elaurent@google.com> Merge "AudioFlinger: fix RecordThread initial device"
201fc9c9feb4765a12bc39e95d25f3aa1deb8ffe 02-Feb-2013 Eric Laurent <elaurent@google.com> AudioFlinger: fix RecordThread initial device

A regression was introduced when the audio device enums where
modified for a 32 bit representation: the device passed when
constructing a RecordThread was still the concatenation of input
device and output device bit fields on one 32 bit value which
is not possible anymore.

The fix consists in modifying the RecordThread constructor to accept
separate values for input and output devices.

Change-Id: I81fb5f4718428b54251e65d74b86e198ce15193e
/frameworks/av/services/audioflinger/Threads.cpp
d3922f72601d82c6fc067a98916fda0bd1291c5f 02-Feb-2013 Eric Laurent <elaurent@google.com> AudioFlinger: fix RecordThread initial device

A regression was introduced when the audio device enums where
modified for a 32 bit representation: the device passed when
constructing a RecordThread was still the concatenation of input
device and output device bit fields on one 32 bit value which
is not possible anymore.

The fix consists in modifying the RecordThread constructor to accept
separate values for input and output devices.

Change-Id: I81fb5f4718428b54251e65d74b86e198ce15193e
/frameworks/av/services/audioflinger/Threads.cpp
011aa652a9349750dd6bca1dcb1b82f19e07504e 19-Jan-2013 Glenn Kasten <gkasten@google.com> AudioFlinger uses media.log service for logging

Change-Id: Ia0f8204334f6b233f644d897762a18c95d936b4b
/frameworks/av/services/audioflinger/Threads.cpp
9e58b552f51b00b3b674102876bd6c77ef3da806 19-Jan-2013 Glenn Kasten <gkasten@google.com> AudioFlinger uses media.log service for logging

Change-Id: Ia0f8204334f6b233f644d897762a18c95d936b4b
/frameworks/av/services/audioflinger/Threads.cpp
3a948fceb6b59121cc2e5eeb458064150870ffde 18-Jan-2013 Eric Laurent <elaurent@google.com> AudioFlinger: fix build with debug log enabled

Change-Id: Id397155ec884c41cb84b35462ea09a97a04d3ed2
/frameworks/av/services/audioflinger/Threads.cpp
2592f6e68edbed386e004d5b045233f15e7b9ba1 18-Jan-2013 Eric Laurent <elaurent@google.com> AudioFlinger: fix build with debug log enabled

Change-Id: Id397155ec884c41cb84b35462ea09a97a04d3ed2
/frameworks/av/services/audioflinger/Threads.cpp
856ff4e4c3c43550f013e80277358fdf514342bf 22-Dec-2012 Glenn Kasten <gkasten@google.com> Merge "Start isolating control block accesses in a proxy"
d5681bc9a38fe4cd1d591e6ae62b9c68fb851041 22-Dec-2012 Glenn Kasten <gkasten@google.com> Merge "Start isolating control block accesses in a proxy"
92b1343f5fbc2fc43198a0a1252fe023cc9a5061 14-Dec-2012 Glenn Kasten <gkasten@google.com> Fix build warnings

Change-Id: I9e3cfa0c6b3467fe763ce55f759d179f02c5deea
/frameworks/av/services/audioflinger/Threads.cpp
c4974312e5a1e2ab94eca56045f991baf1508d73 14-Dec-2012 Glenn Kasten <gkasten@google.com> Fix build warnings

Change-Id: I9e3cfa0c6b3467fe763ce55f759d179f02c5deea
/frameworks/av/services/audioflinger/Threads.cpp
552f274d82fb4988fb972df69134e031d375abfe 04-Dec-2012 Glenn Kasten <gkasten@google.com> Start isolating control block accesses in a proxy

The proxy object will eventually be the only code that understands the
details of the control block. This should make it easier to change the
control block in the future.

Initial set of control block fields that are isolated:
- sample rate
- send level
- volume

Prepare for streaming/static separation by adding a union to the control
block for the new fields.

Fix bug in handling of max sample rate on a track. It was only checking
at re-configuration, not at each mix.

Simplify OutputTrack::obtainBuffer.

Change-Id: I2249f9d04f73a911a922ad1d7f6197292c74cd92
/frameworks/av/services/audioflinger/Threads.cpp
e3aa659e9cee7df5c12a80d285cc29ab3b2cbb39 04-Dec-2012 Glenn Kasten <gkasten@google.com> Start isolating control block accesses in a proxy

The proxy object will eventually be the only code that understands the
details of the control block. This should make it easier to change the
control block in the future.

Initial set of control block fields that are isolated:
- sample rate
- send level
- volume

Prepare for streaming/static separation by adding a union to the control
block for the new fields.

Fix bug in handling of max sample rate on a track. It was only checking
at re-configuration, not at each mix.

Simplify OutputTrack::obtainBuffer.

Change-Id: I2249f9d04f73a911a922ad1d7f6197292c74cd92
/frameworks/av/services/audioflinger/Threads.cpp
30c01816ddee2268fcd3d965240cba9c00301e7d 04-Dec-2012 Glenn Kasten <gkasten@google.com> Prepare for track invalidation to be done by proxy

Don't rely on control block to determine whether track has been marked
invalid. Instead, use a local flag that can't be corrupted by client.

Change-Id: I783dafe828f93c1c3d2d0e5a08105ea536436efb
/frameworks/av/services/audioflinger/Threads.cpp
5736c35b841de56ce394b4879389f669b61425e6 04-Dec-2012 Glenn Kasten <gkasten@google.com> Prepare for track invalidation to be done by proxy

Don't rely on control block to determine whether track has been marked
invalid. Instead, use a local flag that can't be corrupted by client.

Change-Id: I783dafe828f93c1c3d2d0e5a08105ea536436efb
/frameworks/av/services/audioflinger/Threads.cpp
4b3a49e3a9ced6e63adab08acc5b720f8feddefa 29-Nov-2012 Glenn Kasten <gkasten@google.com> AudioTrack::mute() is unused so remove it

If ever needed again, it could be implemented on client side by forcing
a track volume of 0.

Change-Id: I88a9b4f675b6dca2948549414f9ec2c192d29269
/frameworks/av/services/audioflinger/Threads.cpp
e4756fe3a387615acb63c6a05788c8db9b5786cb 29-Nov-2012 Glenn Kasten <gkasten@google.com> AudioTrack::mute() is unused so remove it

If ever needed again, it could be implemented on client side by forcing
a track volume of 0.

Change-Id: I88a9b4f675b6dca2948549414f9ec2c192d29269
/frameworks/av/services/audioflinger/Threads.cpp
af348741539ae4a84aa929a54ecf359dae96f3ee 30-Nov-2012 Alex Ray <aray@google.com> Remove conditional compilation of ATRACE functions

Tracing functions are meant to be dynamically controlled via sysprops.
Conditional compilation removes this functionality.

Change-Id: I26bc473d104d0b3c50a228dddfda3fa2428d157a
/frameworks/av/services/audioflinger/Threads.cpp
371eb9756c32109ea572b91216b19bb623f6d3fd 30-Nov-2012 Alex Ray <aray@google.com> Remove conditional compilation of ATRACE functions

Tracing functions are meant to be dynamically controlled via sysprops.
Conditional compilation removes this functionality.

Change-Id: I26bc473d104d0b3c50a228dddfda3fa2428d157a
/frameworks/av/services/audioflinger/Threads.cpp
7a90bc9265782788675af577c7b1c56e5d5be709 30-Nov-2012 Simon Wilson <simonwilson@google.com> Use ATRACE macros instead of Tracer statics

ATRACE_BEGIN and ATRACE_END have replaced the static
Tracer::traceBegin and Tracer::traceEnd functions, so
use them instead.

Fixes compilation errors when tracing is enabled.

Change-Id: I4d1147d2f76afcdf113e9986f0544cb848802b15
/frameworks/av/services/audioflinger/Threads.cpp
2d590964aa58e137d17a43e095e6443dd0fe2e98 30-Nov-2012 Simon Wilson <simonwilson@google.com> Use ATRACE macros instead of Tracer statics

ATRACE_BEGIN and ATRACE_END have replaced the static
Tracer::traceBegin and Tracer::traceEnd functions, so
use them instead.

Fixes compilation errors when tracing is enabled.

Change-Id: I4d1147d2f76afcdf113e9986f0544cb848802b15
/frameworks/av/services/audioflinger/Threads.cpp
ca7cc8273ffd88b9b89655808ee7e3df74162b83 19-Nov-2012 Eric Laurent <elaurent@google.com> AudioFlinger files reorganization

Audioflinger.cpp and Audioflinger.h files must be split to
improve readability and maintainability.

This CL splits the files as follows:

AudioFlinger.cpp split into:
- AudioFlinger.cpp: implementation of IAudioflinger interface and global methods
- AFThreads.cpp: implementation of ThreadBase, PlaybackThread, MixerThread,
DuplicatingThread, DirectOutputThread and RecordThread.
- AFTracks.cpp: implementation of TrackBase, Track, TimedTrack, OutputTrack,
RecordTrack, TrackHandle and RecordHandle.
- AFEffects.cpp: implementation of EffectModule, EffectChain and EffectHandle.

AudioFlinger.h is modified by inline inclusion of header files containing
the declaration of complex inner classes:
- AFThreads.h: ThreadBase, PlaybackThread, MixerThread, DuplicatingThread,
DirectOutputThread and RecordThread
- AFEffects.h: EffectModule, EffectChain and EffectHandle

AFThreads.h includes the follownig headers inline:
- AFTrackBase.h: TrackBase
- AFPlaybackTracks: Track, TimedTrack, OutputTrack
- AFRecordTracks: RecordTrack

Change-Id: I512ebc3a51813ab7a4afccc9a538b18125165c4c
/frameworks/av/services/audioflinger/Threads.cpp
81784c37c61b09289654b979567a42bf73cd2b12 19-Nov-2012 Eric Laurent <elaurent@google.com> AudioFlinger files reorganization

Audioflinger.cpp and Audioflinger.h files must be split to
improve readability and maintainability.

This CL splits the files as follows:

AudioFlinger.cpp split into:
- AudioFlinger.cpp: implementation of IAudioflinger interface and global methods
- AFThreads.cpp: implementation of ThreadBase, PlaybackThread, MixerThread,
DuplicatingThread, DirectOutputThread and RecordThread.
- AFTracks.cpp: implementation of TrackBase, Track, TimedTrack, OutputTrack,
RecordTrack, TrackHandle and RecordHandle.
- AFEffects.cpp: implementation of EffectModule, EffectChain and EffectHandle.

AudioFlinger.h is modified by inline inclusion of header files containing
the declaration of complex inner classes:
- AFThreads.h: ThreadBase, PlaybackThread, MixerThread, DuplicatingThread,
DirectOutputThread and RecordThread
- AFEffects.h: EffectModule, EffectChain and EffectHandle

AFThreads.h includes the follownig headers inline:
- AFTrackBase.h: TrackBase
- AFPlaybackTracks: Track, TimedTrack, OutputTrack
- AFRecordTracks: RecordTrack

Change-Id: I512ebc3a51813ab7a4afccc9a538b18125165c4c
/frameworks/av/services/audioflinger/Threads.cpp