History log of /frameworks/av/media/libmedia/AudioTrack.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
07eee80b3422c0304491f24bbc415deb0badbefc 22-Jun-2016 Andy Hung <hunga@google.com> Limit cached timestamp use if HW fails to provide them

On some devices, if the HDMI cable is disconnected during use,
cached timestamp info can become very old.

Bug: 29423451
Change-Id: Ieecf5e98bad14d00b4f5f14b032c2cf66ae94ceb
/frameworks/av/media/libmedia/AudioTrack.cpp
69488c4ef115c9de52c85f4fcae27c7774720298 17-May-2016 Andy Hung <hunga@google.com> AudioTrack: Fix timestamp startup condition

Suppress timestamps without valid kernel information or
a server update.

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

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

Bug: 28771691
Change-Id: I2cd25dad638ca1d0b1355d87d175d908f3bddb26
/frameworks/av/media/libmedia/AudioTrack.cpp
9ea77cdba8c422940adb57a790b44ac04fe0353f 07-Apr-2016 Haynes Mathew George <hgeorge@codeaurora.org> audioflinger: Pass pid of process creating track or opening record

AudioFlinger allocates a Client heap for each unique pid.
If two applications use mediaplayer APIs, the same Client heap
is reused as the pid used is not the application pid but that
of mediaserver. With this change, the pid of the application
pid is used to decide the heap to be used.

Bug: 23525542
Bug: 28772898
Change-Id: I31a695b0b321eff6e2aca80c3bc4aeb3e1cd9ac7
/frameworks/av/media/libmedia/AudioTrack.cpp
6d7b119a416c9f10288051e562f294365e5d954c 08-May-2016 Andy Hung <hunga@google.com> Improve timestamp jitter fix

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

Bug: 28465713
Change-Id: I33590d6922980f288355f947bc56279245058429
/frameworks/av/media/libmedia/AudioTrack.cpp
7aa45dd7fc5c2bd959f1571231556ac06b7ec8ae 03-May-2016 Andy Hung <hunga@google.com> Merge "AudioTrack: Fix timestamp jitter" into nyc-dev
aebe9dc29988c94a774208ba659c4f156d274d79 02-May-2016 Glenn Kasten <gkasten@google.com> Normal tracks use triple buffering if resampling

Bug: 26230944
Change-Id: I40f6cd7147db1be95f297af406c77c6404a76f37
/frameworks/av/media/libmedia/AudioTrack.cpp
b01faa31462e19957ae3c0c3ada07c9576a9494f 27-Apr-2016 Andy Hung <hunga@google.com> AudioTrack: Fix timestamp jitter

When HAL out_get_presentation_position returns error,
use server position adjusted for latency.

Bug: 28250436
Change-Id: I3dbcb9b7c4e56d34e7e161d1a02d8f64afd602b9
/frameworks/av/media/libmedia/AudioTrack.cpp
ea38ee7742e799b23bd8675f5801ef72f94de0f4 18-Apr-2016 Glenn Kasten <gkasten@google.com> Can now indicate the desired number of notifications (sub-buffers)

per fast track buffer when using the default buffer size.

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

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

Bug: 27819623
Bug: 28117362
Change-Id: Ifc2121e874f51718cd56ec04e4bd5f89f4963132
/frameworks/av/media/libmedia/AudioTrack.cpp
0c4a97e6e1470b2d8b8810792af8d66689020c51 13-Apr-2016 Andy Hung <hunga@google.com> Merge "NuPlayer: Reserve buffer for 8x max speed" into nyc-dev
f2c87b3f88d987d2af6322e9763eb8224a2bae48 08-Apr-2016 Andy Hung <hunga@google.com> NuPlayer: Notify if drain message time is unexpectedly long

Bug: 27940058
Change-Id: Id8897c30e21b6b9de545a710e7766ffceb491455
/frameworks/av/media/libmedia/AudioTrack.cpp
ff874dc957f9ea70d87f4d627bf903e1fc86d58b 12-Apr-2016 Andy Hung <hunga@google.com> NuPlayer: Reserve buffer for 8x max speed

Affects Photos with Bluetooth and 240x recording.

Bug: 26986060
Change-Id: I228223221f9811e05c274d64cd42ac104db04c36
/frameworks/av/media/libmedia/AudioTrack.cpp
e1e9846a786a0d77a13b44f8e798e03b4cba9d77 12-Apr-2016 Andy Hung <hunga@google.com> AudioTrack: Reset position on flush for extended timestamps.

Bug: 27940058
Change-Id: If91320669e2e84803e601137b1ce66b361b129f1
/frameworks/av/media/libmedia/AudioTrack.cpp
e13f8a603867280de9b02ce4839202a182556416 30-Mar-2016 Andy Hung <hunga@google.com> NuPlayer: Play out remaining audio data when recycling isn't possible

Don't flush it immediately.

Bug: 26530291
Change-Id: I0427633402fa251ec62e2b70e47a0a7b451d3ea2
/frameworks/av/media/libmedia/AudioTrack.cpp
ea2b9c07b34079f0dbd8610a511e006e69a15adc 13-Feb-2016 Andy Hung <hunga@google.com> Implement client playback timestamps with 64 bit accuracy

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

Bug: 17472992
Bug: 26682703
Bug: 27749434
Change-Id: I6c9b213d9f9284092e34d57f52870e02c72df62a
/frameworks/av/media/libmedia/AudioTrack.cpp
5fe2151459fd6c88958c5ebd71f28004d49d8b65 29-Mar-2016 Andy Hung <hunga@google.com> Merge "Read from proxy for PCM direct and offloaded track position" into nyc-dev
7a490e7ab39ef0b22baf24b03f2463c46dc068ed 23-Mar-2016 Andy Hung <hunga@google.com> Read from proxy for PCM direct and offloaded track position

Bug: 27776737
Change-Id: I721bf2b4d46271bf84ad9fc29ff5c4ecd4759206
/frameworks/av/media/libmedia/AudioTrack.cpp
9b3359feabbf138bb965da5173434da78bfe0929 24-Mar-2016 Haynes Mathew George <hgeorge@codeaurora.org> libmedia: Initialize state vars to avoid possible crash

If playback or record track creation fails on server side,
some state is left initialized incorrectly.
This can cause a crash when the object is destroyed
because of a reference to a NULL object.

Initialize state vars properly in the initialization list
to avoid this behavior.

authored-by: Zhou Song <zhous@codeaurora.org>

CRs-Fixed: 992608
Change-Id: If8c3611e3229c0c1b14b81285e07b9357fec7658
/frameworks/av/media/libmedia/AudioTrack.cpp
79629f0716f04e79064256362be56730077b8c50 24-Mar-2016 Andy Hung <hunga@google.com> AudioTrack: Do not resume callback thread on start failure

Bug: 27673375
Change-Id: I1df1db51e75cee57f19824ac6506bf02000714fd
/frameworks/av/media/libmedia/AudioTrack.cpp
fc1337d079ba7e6ffd7ce07706cfeeeb355c0200 18-Mar-2016 Phil Burk <philburk@google.com> Merge "AudioTrack: fix stall if setBufferSizeInFrames() called before play()" into nyc-dev
e8972b0a27fac327c997fceb20d9abae1dc1d899 04-Mar-2016 Phil Burk <philburk@google.com> AudioTrack: fix stall if setBufferSizeInFrames() called before play()

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

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

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

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

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

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

bug: 27567768
Change-Id: I8d0753429d4113498258b1f61bd8ac5939a612f0
/frameworks/av/media/libmedia/AudioTrack.cpp
ae34ed2bcc9fa49a22fe7497327adb689ef27e8d 28-Jan-2016 Haynes Mathew George <hgeorge@codeaurora.org> AudioTrack: Use original flags during track recreation

Also the OFFLOAD and DIRECT flags aren't denied by server.

authored-by: Pavan Chikkala<pavanc@codeaurora.org>
Bug: 27554925
Change-Id: I6fd6b129928af4513bb0cba271019288605310f8
/frameworks/av/media/libmedia/AudioTrack.cpp
7fd0422fbd17af3b24eb04421d37fce50f3826e2 02-Feb-2016 Glenn Kasten <gkasten@google.com> Sample rate 0 means a route-dependent rate

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

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

Bug: 25641253
Bug: 21019153
Change-Id: I65dc128e760c245f3d90559635a8981b186c87d7
/frameworks/av/media/libmedia/AudioTrack.cpp
818e7a32ce3633980138aff2c2bfcc5158b3cfcc 17-Feb-2016 Andy Hung <hunga@google.com> Implement server side playback timestamps with 64 bit accuracy

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

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

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

This reverts commit b3a486fecddc9e9264fe63d356eca0812493db27.

Reverting while investigating the root cause.

Bug: 27186414
/frameworks/av/media/libmedia/AudioTrack.cpp
b0a144d705a021994628d136a170a6d2bd4282e7 12-Feb-2016 Phil Burk <philburk@google.com> Merge "AudioTrack: support ENCODING_IEC61937" into nyc-dev
fdb3c07db5d44535eb8c3ec46dc78ad8446c01eb 09-Feb-2016 Phil Burk <philburk@google.com> AudioTrack: support ENCODING_IEC61937

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

Bug: 24541671
Bug: 20891646
Bug: 26373761
Change-Id: Ia32036b18683b084d6c9887593df87397ea0afd9
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/media/libmedia/AudioTrack.cpp
b3a486fecddc9e9264fe63d356eca0812493db27 05-Aug-2015 Andy Hung <hunga@google.com> Enable FastTrack timestamps

Bug: 26413951
Change-Id: I99a69241a0bcd69f6bfebf785cac6d9ee1e2cd5f
/frameworks/av/media/libmedia/AudioTrack.cpp
d79072e9dff59f767cce2cda1caab80ce5a0815b 06-Jan-2016 Glenn Kasten <gkasten@google.com> Remove TimedAudioTrack and associated code

Bug: 8278435
Change-Id: I095c1a4888e645e14d93b0b15fbef4524a831ca1
/frameworks/av/media/libmedia/AudioTrack.cpp
bbe98f009fc2c3181a8d4ab71b3e145f76c01755 17-Jan-2016 Phil Burk <philburk@google.com> Merge "AudioTrack: Add getUnderrunCount()"
27e583ba1d0d4fdc11d6eeee0c416e727045cbbc 17-Jan-2016 Phil Burk <philburk@google.com> Merge "AudioTrack: add setBufferSizeInFrames()"
33ff89ba94a527e4293ee5349da01483252d5c83 30-Nov-2015 Phil Burk <philburk@google.com> AudioTrack: lower Java latency

Add AUDIO_FLAG_LOW_LATENCY to enable Fast track.

Change-Id: Ib1bff635afaa57af7754cb751b57c6afc4c2ab2b
Bug: 21019153
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/media/libmedia/AudioTrack.cpp
c0adecb800b197cb8c028513130ebabf2d0f37ba 08-Jan-2016 Phil Burk <philburk@google.com> AudioTrack: add setBufferSizeInFrames()

Also add getBufferCapacityInFrames().
These can be used to dynamically raise or lower latency.

Bug: 21019153
Signed-off-by: Phil Burk <philburk@google.com>
Change-Id: I02ca7f6f5cc4e089fcd81cc8a2b6ff234e0381a8
/frameworks/av/media/libmedia/AudioTrack.cpp
2812d9ea3a3a33142dd8e23c9d949c498d6f7a12 04-Jan-2016 Phil Burk <philburk@google.com> AudioTrack: Add getUnderrunCount()

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

Change-Id: I8eb14e92f6fc1007718a29b0666ab51ace30cdb8
Bug: 25641253
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/media/libmedia/AudioTrack.cpp
90e8a97dd5c9d391d7a2ea6a2290ed976f928379 10-Nov-2015 Andy Hung <hunga@google.com> Use modulo position variables in AudioTrack and AudioRecord

More type safety, plus correct treatment for sanitization.

Bug: 25569906
Bug: 25232421
Change-Id: Id852277b81a1792c5e67392cd74bc39cba7ed1ad
/frameworks/av/media/libmedia/AudioTrack.cpp
7095f876565f8c52bafe02e7c6ba04aa0c274dfa 09-Nov-2015 Chad Brubaker <cbrubaker@google.com> Merge "Whitelist getTimestamp from integer sanitization"
am: 51cd9a441e

* commit '51cd9a441ed0acf6e3b9c221e9b7f9424073191f':
Whitelist getTimestamp from integer sanitization
ec3806a8be1a014631b39df59edd596f8eb5be01 09-Nov-2015 Chad Brubaker <cbrubaker@google.com> Whitelist getTimestamp from integer sanitization

The timestamp math relies on modulo 32 bit math, whitelist this function
for now until we can find a better way to tackle this.

Bug: 25490803
Change-Id: I3e2b19db023b4622f5884933feab96363756e8c6
/frameworks/av/media/libmedia/AudioTrack.cpp
3845ba35a0bf364f30bd46029b89e7b5fff28793 28-Oct-2015 Dan Austin <danielaustin@google.com> Merge "Refactor setPlaybackRate to avoid benign unsigned integer overflow." am: a38594e92f
am: 9b698dcfb4

* commit '9b698dcfb41cbadd4a21d09eede0de672912959d':
Refactor setPlaybackRate to avoid benign unsigned integer overflow.
9b698dcfb41cbadd4a21d09eede0de672912959d 28-Oct-2015 Dan Austin <danielaustin@google.com> Merge "Refactor setPlaybackRate to avoid benign unsigned integer overflow."
am: a38594e92f

* commit 'a38594e92fea7f88c5edad98a4992b5f1b688436':
Refactor setPlaybackRate to avoid benign unsigned integer overflow.
e34eae2de7bd6dcba5dea132dabb09f63ac46adc 28-Oct-2015 Dan Austin <danielaustin@google.com> Refactor setPlaybackRate to avoid benign unsigned integer overflow.

There is a check that results in a benign unsigned integer overflow.
This has been refactored to avoid the unsigned integer overflow.

Bug: 25327431
Change-Id: Ib112a7cd585c680f13e4bee3d7e9f45da7d66f1d
/frameworks/av/media/libmedia/AudioTrack.cpp
2eb225313de241d02979c66e2730983901ad05ea 23-Oct-2015 Glenn Kasten <gkasten@google.com> Merge "Workaround for busy wait bug" into mnc-dr-dev am: d34cf6d95c
am: 6a92190261

* commit '6a9219026124f9075c03a861101cea985f01cdce':
Workaround for busy wait bug
606fbc1030d686bf1f8dc03d14a79342aca2ca41 23-Oct-2015 Glenn Kasten <gkasten@google.com> Workaround for busy wait bug

Underlying bug 25195759 is not yet fixed.

Bug: 24263351
Change-Id: I04b644246640054d38c8de79e0eb80fcbfef0e48
/frameworks/av/media/libmedia/AudioTrack.cpp
c67c65882f7cf1d3ae617bff41ff9c7ec8a0fd27 14-Oct-2015 Glenn Kasten <gkasten@google.com> am 5116febf: am cfda8c43: Merge "AudioTrack: Skip callback EVENT_STREAM_END on DEAD_OBJECT." into mnc-dr-dev

* commit '5116febf966875c19a0b137a3deef0ba0ebe42df':
AudioTrack: Skip callback EVENT_STREAM_END on DEAD_OBJECT.
39609a0a6d95d003b0f237e6c139b070b4df7071 04-Sep-2015 Andy Hung <hunga@google.com> AudioTrack: Skip callback EVENT_STREAM_END on DEAD_OBJECT.

Send only EVENT_NEW_IAUDIOTRACK to initiate teardown.

Bug: 23750452
Change-Id: Ib5dcd578b5b6a6a1d91a03e58ef8da0acd994243
/frameworks/av/media/libmedia/AudioTrack.cpp
7d7a11ca73c9684b63275e82b327f6f90fcc114e 07-Oct-2015 Glenn Kasten <gkasten@google.com> am 9ea0680e: am b177e8a7: Merge "AudioTrack: Prevent stop() from reissuing last marker event" into mnc-dr-dev

* commit '9ea0680e4d77d21fb0698fec3ccd7779213eca62':
AudioTrack: Prevent stop() from reissuing last marker event
61be84167c1a11c8a030e00a2b79b2bc4fdf617f 06-Oct-2015 Andy Hung <hunga@google.com> AudioTrack: Prevent stop() from reissuing last marker event

Avoid a duplicate marker event race condition (1 in 30 or less)
by clearing marker reached in start() not stop().

Bug: 24497521
Change-Id: I9520d063c7d173d2e642174bf60a2bfe75edf085
/frameworks/av/media/libmedia/AudioTrack.cpp
54b3c3c7acf18226f6abf788a220837bc5737677 29-Sep-2015 Dan Austin <danielaustin@google.com> am 6c4cf7fb: Merge "Fix benign overflow in AudioTrack"

* commit '6c4cf7fb4c8a48450f8290380710ddeb6a8cc625':
Fix benign overflow in AudioTrack
039c27aeaee809182fc1491311ca6dcbc1ec441b 24-Sep-2015 Chad Brubaker <cbrubaker@google.com> Fix benign overflow in AudioTrack

two uint32_t's were being used in a computation that could be negative,
cast to int32_t before the subtraction to prevent incorrect overflow
detection.

Change-Id: I33c5ef79a0ebbba055daa0ea041b42229d0c3152
/frameworks/av/media/libmedia/AudioTrack.cpp
e9fa23fe940c287bf2f6e8b28f4cf9161818cb80 23-Sep-2015 Chad Brubaker <cbrubaker@google.com> resolved conflicts for 1f8749f2 to stage-aosp-master

Change-Id: Idda60a9d39f9be81e0c314f06fc080ad7fa35c7b
20b82e0cb5c615a4f88f245c12fec9ee0ec49894 22-Sep-2015 Chad Brubaker <cbrubaker@google.com> Fix benign unsigned overflow in AudioTrack

An unsigned overflow could occur in timestamp computation when
mTimestamp < mServer.

Change-Id: I9e01897478a6d481dd6fb7303d325617466497cf
/frameworks/av/media/libmedia/AudioTrack.cpp
97c9f4fd7bc31e2968d816402659ba1c64f10b42 12-Aug-2015 Eric Laurent <elaurent@google.com> NuPlayerRenderer: handle error when resuming an offloaded track

Make sure that an offloaded audio track is torn down if
start() returns an error in onResume().
This makes sure that a track invalidated due to a potential
audio path change while paused is re created on the correct
output.

Bug: 22256441.
Change-Id: I6c7bfec6e7322415daffc0451bab46d0c558522a
/frameworks/av/media/libmedia/AudioTrack.cpp
2c7d0f2013203588f9307166cad42902eb5a676f 24-Jul-2015 Andy Hung <hunga@google.com> Merge "Fix restore position warning and static track adjustment" into mnc-dev
d7bd69e4d1e74f25413721804d5290c53ea87f2b 24-Jul-2015 Andy Hung <hunga@google.com> Fix restore position warning and static track adjustment

Remove unnecessary restoreTrack_l() position warning when
AudioTrack output device changes.

Also, fix rare getPosition() offset error if a static track is
continuously playing a long time (> 24 hours at 48khz sampling)
and its output device changes.

Bug: 22524122
Bug: 21699132
Change-Id: I5a35c13d62ff9f0702b09d5cd9362c730364b18c
/frameworks/av/media/libmedia/AudioTrack.cpp
a8d0890ca969ec40fdcf1cfcbeef85c0c379cfaf 22-Jul-2015 Andy Hung <hunga@google.com> Fix race condition in AudioTrackThread::wake

Bug: 22533684
Change-Id: I2f46770dca44fc9dae41e067d3bec893c42a826e
/frameworks/av/media/libmedia/AudioTrack.cpp
55a2dcce3a409393dc51ab2eb433914331f2df51 23-Jun-2015 Ricardo Garcia <rago@google.com> Merge "Using centralized isAudioPlaybackRateValid to validate parameters" into mnc-dev
6c7f062d3149d6890daaee64828959ad6f61ea54 01-May-2015 Ricardo Garcia <rago@google.com> Using centralized isAudioPlaybackRateValid to validate parameters

Centralized validation code
bug: 20701446

Change-Id: I9d9941c7639c05b2afe069ff4f858c693c910bfe
/frameworks/av/media/libmedia/AudioTrack.cpp
6653c935d2518a713587b3887ca09aa09ebfa7fd 08-Jun-2015 Andy Hung <hunga@google.com> Return DEAD_OBJECT if getTimestamp cannot restore track

Bug: 21699132
Change-Id: I90443f8674ed949e2546048b231be75cd6fe6615
/frameworks/av/media/libmedia/AudioTrack.cpp
1f1db8356b599bc40703c907fb69e6e539343532 08-Jun-2015 Andy Hung <hunga@google.com> Fix AudioTrack comments relating to use of restoreTrack_l()

Bug: 21699132
Change-Id: Ib0d029a5e28676aeffbbbafc88c52a17367a413c
/frameworks/av/media/libmedia/AudioTrack.cpp
c8e09c610fabc7390297ecb48e939acbdfe27325 04-Jun-2015 Andy Hung <hunga@google.com> Improve AudioTrack offload timestamp startup glitch detector

New or existing glitch behavior for Nexus 5 offload audio:
we receive several 0 timestamps,
then we get a stale timestamp (very large),
then a few ms later we get a correct nonzero timestamp.

We attempt to hide the glitch because the retrograde timestamp
correction makes the glitch "sticky".

Bug: 21633313
Change-Id: I39153af718c151f9435e7d315651a811f72743da
/frameworks/av/media/libmedia/AudioTrack.cpp
a7f03353d5f172016f324e2a01f301cca6794152 01-Jun-2015 Andy Hung <hunga@google.com> Compute sleep time when AudioTrack client callback returns no PCM data

Callbacks can go into a sleep-wait cycle if the client/app is unable to
deliver data. This can happen if the buffer is large, or if
the client/app cannot keep the buffer filled, or upon a stream end condition.
We improve the sleep time computation for AudioTrack PCM callbacks.

This minimizes the number of callbacks to NuPlayerRenderer.

Bug: 21198655
Change-Id: I4247798a6638def2f0d8f1b46f60323482065cb2
/frameworks/av/media/libmedia/AudioTrack.cpp
9f9e21ed9a342e0ca945818bdc6c0c4fb3bfb9bd 01-Jun-2015 Andy Hung <hunga@google.com> Store server latency, sample rate, framecount information in AudioTrack

Bug: 21198655
Change-Id: I24590196642a97ea5d61bc6356f0aff782bd37d3
/frameworks/av/media/libmedia/AudioTrack.cpp
faeb0f291330134dc4468359a36e099aae508449 21-May-2015 Ronghua Wu <ronghuawu@google.com> libmediaplayerservice: try to open audio sink in offload mode in error.

Bug: 19061432
Bug: 21370108
Change-Id: Iaa757555ef37fd1ac87b6e2d5a9969bb58cc5ebc
/frameworks/av/media/libmedia/AudioTrack.cpp
296fb13dd9b5e90d6a05cce897c3b1e7914a478a 01-May-2015 Eric Laurent <elaurent@google.com> Implement audio device callback

Add class AudioSystem::AudioDeviceCallback notifying
AudioSystem clients upon device selection change on a given
input or output thread.
Maintain a list of installed callback per I/O handle in AudioSystem
and call registered callbacks when an OPEN of CONFIG_CHANGED event
is received on IAudioFlingerClient::ioConfigChanged().
Add methods to AudioTrack and AudioRecord to add and remove device
change callbacks.
Add methods to AudioTrack and AudioRecord to query currently selected
device.
ioConfigChanged() events now convey the audio patch describing
the input or output thread routing.

Fix AudioRecord failure to start when invalidation is
handled by start().

Change-Id: I9e938adf025fa712337c63b1e02a8c18f2a20d39
/frameworks/av/media/libmedia/AudioTrack.cpp
4c5a3675ed6b429dfaa2707acf2b3faf2808baf2 01-May-2015 Phil Burk <philburk@google.com> AudioTrack: reduce retrograde motion spew

Change-Id: I96aced52b136ceea924aa3d9ef56374dd4c49784
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/media/libmedia/AudioTrack.cpp
3a474aa67fc31505740526dd249d96204c08bf79 25-Apr-2015 Lajos Molnar <lajos@google.com> stagefright: support setting/getting playback/sync config in MediaSync

Bug: 18249558
Bug: 19666434
Bug: 20057497
Change-Id: I5868b17423d7c20cfaf4a399f3eb67bfba440605
/frameworks/av/media/libmedia/AudioTrack.cpp
5aab9254a5c4f1951c12216a71550ab95b4adeaa 30-Apr-2015 Phil Burk <philburk@google.com> AudioTrack: fix build

Using format %llu did not work for uint64_t on 64-bit systems!

Change-Id: I727094e460141b9da3e433ceaa95e069dad948bc
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/media/libmedia/AudioTrack.cpp
dc0ac804721efff054ec9720d53e93ecca86cf5e 30-Apr-2015 Phil Burk <philburk@google.com> Merge "AudioTrack: fix spurious retrograde messages" into mnc-dev
8c7e6dac6f5eb38cef627dab92eac8b38513450c 22-Apr-2015 Eric Laurent <elaurent@google.com> audio policy: session routes continued.

- Clear session routes when client process dies.
- Enforce the route only when the requesting session is active.
- Fix requested route not working if an output mix change is required
(e.g forcing to SPEAKER when the default route is USB or A2DP).
- Make sure all sessions sharing the strategy with a rerouted session
have the same route (needed for volume control consistency)

Change-Id: I0ab347a8fb97e73e2c5965374544c5f4fe509ef1
/frameworks/av/media/libmedia/AudioTrack.cpp
1b42097f38e72574ed853a35f4e8a66e4739c421 22-Apr-2015 Phil Burk <philburk@google.com> AudioTrack: fix spurious retrograde messages

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

Bug: 2047891
Change-Id: Ifcad2349201443a7f1711347c203297100449536
Signed-off-by: Phil Burk <philburk@google.com>
/frameworks/av/media/libmedia/AudioTrack.cpp
983f2e02b342ef3ac4004471cbfd4cd8d5aecf7d 22-Apr-2015 Ricardo Garcia <rago@google.com> Merge "Use AudioPlaybackRate to hold TimestretchBufferProvider parameters"
5a8a95de6dad1a3bcf3da5a37b35766e89086e13 18-Apr-2015 Ricardo Garcia <rago@google.com> Use AudioPlaybackRate to hold TimestretchBufferProvider parameters

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

Change-Id: I19099924a7003c62e48bb6ead56c785cb129fba2
/frameworks/av/media/libmedia/AudioTrack.cpp
493404d8c396e15ed73455acd39aa0f1940996e2 22-Apr-2015 Eric Laurent <elaurent@google.com> audio policy: fix AudioTrack output device selection

Have AudioTrack::setOutputDevice() set CBLK_INVALID flag instead
of calling restoreTrack_l(). This allows restoreTrack_l() to be called in
a safe context.

Allow device change while the AudioTrack is active by forcing a new
device selection in startOutput() if the output route for this
session was changed.

Remove some warnings.

Change-Id: I2d921a63c9bfa0e122233645e2d6d39f95f5f17d
/frameworks/av/media/libmedia/AudioTrack.cpp
f1063e2659cad01ec334a265c31734c63c319cc4 18-Apr-2015 Lajos Molnar <lajos@google.com> libmedia: fix all warning, make warnings errors, use clang

Change-Id: Ic00d2c5d0bbb1605e96666e25c9ccc22bea6d3ff
/frameworks/av/media/libmedia/AudioTrack.cpp
26145643ce22d797b3b1675c82c47a2d8c79ecaa 16-Apr-2015 Andy Hung <hunga@google.com> Work around lack of pitch adjustment in Timestretcher

Change-Id: I3e057b97c250a826133248b6aa1ff9ed677d88df
/frameworks/av/media/libmedia/AudioTrack.cpp
b23cabdb71b98dc5e852f5d06be271696fea92c7 14-Apr-2015 Glenn Kasten <gkasten@google.com> Merge "AudioRecord::obtainBuffer() can return nonContig like AudioTrack"
551b5355d34aa42890811fc3606d3b63429296cd 20-Mar-2015 Glenn Kasten <gkasten@google.com> AudioRecord::obtainBuffer() can return nonContig like AudioTrack

And fix error handling in both AudioRecord and AudioTrack.

Change-Id: I4853d736cc6d2c05de5b18b0eac62716edfa62ec
/frameworks/av/media/libmedia/AudioTrack.cpp
8edb8dc44b8a2f81bdb5db645b6b708548771a31 27-Mar-2015 Andy Hung <hunga@google.com> Add playback rate to AudioTrack

Bug: 19196501
Change-Id: I6411e1d3ce652b711a71a6d9df020cb5f60d4714
/frameworks/av/media/libmedia/AudioTrack.cpp
aa9811945f575614b3482d09e4d969792701cebb 21-Mar-2015 Paul McLean <pmclean@google.com> Adding explicit routing API to AudioTrack

Change-Id: I40c048c7644c46f4e4f7103875206c0785c4b1dc
/frameworks/av/media/libmedia/AudioTrack.cpp
5cbb5785a58655e21f5f7805274b8c78b986216b 28-Mar-2015 Andy Hung <hunga@google.com> Reject sample rate changes for fast tracks

This is needed for a SoundPool fix.

Bug: 19970735
Change-Id: I46b69e059aabf0d06b16b31ea436bb71f7146750
/frameworks/av/media/libmedia/AudioTrack.cpp
bfd318402924414fbde4d31c9d23cc423f10b630 20-Mar-2015 Glenn Kasten <gkasten@google.com> set() in AudioRecord and AudioTracks needs no lock

Change-Id: I9d61b3d117e9b21fbbfad772d8981a5abb8fafae
/frameworks/av/media/libmedia/AudioTrack.cpp
4c36d6f48f4eecacc148317f775f65961a4f03d2 20-Mar-2015 Glenn Kasten <gkasten@google.com> Logging

Move log of latency to where it is first computed.
Log more parameters when a fast track is denied by client.
Log session ID in destructor.
Remove obsolete ALOGV that were for debugging a particular problem.
Log more parameters of set().

Change-Id: I0156bceaf397f2faa053214572c57136705685ee
/frameworks/av/media/libmedia/AudioTrack.cpp
4408d8ab70d3385ac043d0f9a210a971c3a570c2 23-Mar-2015 Andy Hung <hunga@google.com> Merge "Fix position when restoring streaming audio track"
138d6f9b0b77d94773a8a29d3c5bdb78f38ee142 20-Mar-2015 Glenn Kasten <gkasten@google.com> Update AudioTrack code to match AudioRecord

session ID check
buffer error code check

Change-Id: I092a61adfd249122f9127dceedf67c0a3bdcfe7b
/frameworks/av/media/libmedia/AudioTrack.cpp
40bc906252974d0b389ae4a147232d0c9a97193f 20-Mar-2015 Glenn Kasten <gkasten@google.com> namespace does not need a closing semicolon

Change-Id: Ie8f9d42fc061f6d558f23b98414e04eb3d14b376
/frameworks/av/media/libmedia/AudioTrack.cpp
ae4b879d04c4b07c62241a8f507c8dce11e628e4 20-Mar-2015 Glenn Kasten <gkasten@google.com> Declare and initialize in one statement

Change-Id: Ie8593692907e67558f9d7654c9a4bf8cbce99bd8
/frameworks/av/media/libmedia/AudioTrack.cpp
7ccdaad38054474b1d84b7c37ceffd98e9df354d 20-Mar-2015 Andy Hung <hunga@google.com> Fix position when restoring streaming audio track

Bug: 19802225
Change-Id: I19ca7836bc89627f6cead4961641b94c6b27b5f6
/frameworks/av/media/libmedia/AudioTrack.cpp
c6bd5db9d9cf4bba1649b5b7ddea2d23f5de23a9 10-Mar-2015 Eric Laurent <elaurent@google.com> fix flush on HW A/V sync tracks

Fix mismatch between track flags on client and server side
when HW A/V sync is requested.

The audio track was connected to a direct output by the audio policy
manager but the client failed to set the direct flag when creating
the track resulting in the direct flag not being set in audio flinger.

Bug: 19665934.
Change-Id: I0a5257b20bf76c9c4d89bc2ad9b44777b81f13bf
/frameworks/av/media/libmedia/AudioTrack.cpp
1dfe2f9c2d03fc8d0ed0cdfe0b9fb894bc0bcc11 09-Mar-2015 Glenn Kasten <gkasten@google.com> Allow TRANSFER_OBTAIN to be used for fast tracks

Change-Id: I8fa20c26f076567b38210af4a680fe1cb2eacee4
/frameworks/av/media/libmedia/AudioTrack.cpp
b46f394a85d704dd05287cf9bb77cf86e3c02a38 09-Mar-2015 Glenn Kasten <gkasten@google.com> AudioTrack::obtainBuffer() now returns number of non-contiguous frames

Change-Id: I1f61d7e3d057c3254babe456b4aa0f6a1809da55
/frameworks/av/media/libmedia/AudioTrack.cpp
54a8a456c2b4b382b3ffe3d99e40703df79c0717 09-Mar-2015 Glenn Kasten <gkasten@google.com> AudioTrack::releaseBuffer parameter is const *

Change-Id: I31ac20863107de05b83cd7f8cd7dd61bed98e456
/frameworks/av/media/libmedia/AudioTrack.cpp
3f02be2ceeaa4b67dc0b1a81aebcfa049276fad8 09-Mar-2015 Glenn Kasten <gkasten@google.com> AudioTrack obtain/release buffer comments

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

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

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

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

Change-Id: I2f2ca0e599ee20e16559bc5c5dab61ed100da16c
/frameworks/av/media/libmedia/AudioTrack.cpp
abdb990953ffe94a9dc544aea0bed17ef7d5f484 13-Jan-2015 Andy Hung <hunga@google.com> Allow AUDIO_FORMAT_PCM_8_BIT AudioTrack buffers

Previously conversion to AUDIO_FORMAT_PCM_16_BIT was required.
Client shared memory for static tracks and AudioFlinger track creation
and buffer delivery now use native 8 bit PCM data.

Change-Id: I485c07a4971fde9a25442bd43fed95019d39abcc
/frameworks/av/media/libmedia/AudioTrack.cpp
2d85f097d653b21d1ff2c34f0b732c674d20ccc2 07-Jan-2015 Andy Hung <hunga@google.com> Fix cumulative error in setPositionNotificationPeriod

Time for AudioTrackThread sleep due to periodic notification
needs to be computed from actual position.
External reported AOSP issue 65807.

Change-Id: Ic46b64588e6c5803afcd8252cde8837eb3fbf6ff
/frameworks/av/media/libmedia/AudioTrack.cpp
3c09c78aabcb9d314dfb400258fb99a37c7b50c9 30-Dec-2014 Andy Hung <hunga@google.com> Event driven wake for AudioTrackThread notification changes

Used for setMarkerPosition and setPositionUpdatePeriod.

Change-Id: I0d94b929438a5cd94b295d7c1884f876fae8b5e7
/frameworks/av/media/libmedia/AudioTrack.cpp
53c3b5fc1afe162a8669cb3d27d6bb14e1847e39 16-Dec-2014 Andy Hung <hunga@google.com> Improve AudioTrack EVENT_LOOP_END and EVENT_BUFFER_END accuracy

Fix timing computation to consider current position.
Fix EVENT_LOOP_END count accuracy (some could be dropped before)
for non-infinite loop static AudioTracks.

Change-Id: I255f692915b55ab6f08ccd6a2365fee3f5d0a4fe
/frameworks/av/media/libmedia/AudioTrack.cpp
4ede21d9c1f957baf5e561849ff9bbe4bcbefc20 13-Dec-2014 Andy Hung <hunga@google.com> Fix loop and position restoration in static AudioTracks

Allow restoration of loop and position.
Make position and loop synchronously readable.

Bug: 17964637
Change-Id: I8cfb5036e665f55fdff5c67d27e1363ce9a8665d
/frameworks/av/media/libmedia/AudioTrack.cpp
9b4615887c23548438fd0d8e3d8f04ac21912850 02-Dec-2014 Andy Hung <hunga@google.com> Fix loop and position setting in static AudioTracks

Allow independent setting of position and loop.

Bug: 17964637
Change-Id: I8b3bd97a244b932728b68da7684044f2636984a5
/frameworks/av/media/libmedia/AudioTrack.cpp
85aca658ac7d20584b0647427256df50a5f243ef 17-Dec-2014 Eric Laurent <elaurent@google.com> am d33712d7: am 145cf5d8: Merge "audioflinger: implement pause/resume for direct outputs" into lmp-mr1-dev

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

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

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

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

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

Bug: 17883772.
Change-Id: I89b360d69818f7a9204bd36e3ec63a79e106ecf1
/frameworks/av/media/libmedia/AudioTrack.cpp
b279f5adfa2fd6f22c87b3a7106fbb62a0b9a5d2 10-Dec-2014 Eric Laurent <elaurent@google.com> am c49d9cda: am 2dda40d6: Merge "audio policy: add support for custom mixes" into lmp-mr1-dev

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

Add support for custom mixes in AudioPolicyManager.

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

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

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

Bug: 16009464.

Change-Id: I3f1c2a485a0fb71b1f984ed0adc9b68aa971e408
/frameworks/av/media/libmedia/AudioTrack.cpp
be837c328ae1ea2b193d05aaa3d4214c263b5b77 22-Nov-2014 seunghak.han <seunghak.han@lge.com> Track volume should be maintained even if track is restored

If track is restored when it set its volume to a non-unity value (such as mute),
the volume was forced to unity again. Now, the previous volume is restored.

Bug: 18570664
Change-Id: I79f34c6c7d6f535baba813fd3b8ba8e55cac8ad7
/frameworks/av/media/libmedia/AudioTrack.cpp
aef46aa8eff1f975ae5253a334cf0c978427ca86 02-Dec-2014 Glenn Kasten <gkasten@android.com> am bde85d05: am 5458756a: Merge "Track volume should be maintained even if track is restored"

* commit 'bde85d05414cdd3888071635dd05e9ff78679d5e':
Track volume should be maintained even if track is restored
e6a9d65845032644b0865b6e3d0b5a820f35d9e4 22-Nov-2014 seunghak.han <seunghak.han@lge.com> Track volume should be maintained even if track is restored

If track is restored when it set its volume to a non-unity value (such as mute),
the volume was forced to unity again. Now, the previous volume is restored.

Bug: 18570664
Change-Id: I79f34c6c7d6f535baba813fd3b8ba8e55cac8ad7
/frameworks/av/media/libmedia/AudioTrack.cpp
61280541836947ce0b281b240ffa4c55bbf5bd55 27-Nov-2014 Eric Laurent <elaurent@google.com> am 390ef843: am f20c4356: Merge "AudioRecord: use audio attributes instead of audio source." into lmp-mr1-dev

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

* commit 'bf14c62e7973ed793a3b00c2c67beca4484c1c7a':
audio policy: new getOutputForAttr() prototype.
0e47b16ffcf78acb81b0ebf14d058db191f74af0 26-Nov-2014 Andy Hung <hunga@google.com> am 1e18795a: am d325005e: Merge "Fix AudioTrack loop mode to play audio from buffer start" into lmp-mr1-dev

* commit '1e18795a4847e9368baa7ecee146d3901b283cd0':
Fix AudioTrack loop mode to play audio from buffer start
72215491c60fbcdb9a2f0be782e24e39cca249c5 26-Nov-2014 Eric Laurent <elaurent@google.com> am 1a475921: am 223fd5c9: audio: new routing strategies and stream types

* commit '1a475921c0577a4650d1bbe40a85b732d1766939':
audio: new routing strategies and stream types
caf7f48a0ef558689d39aafd187c1571ff4128b4 26-Nov-2014 Eric Laurent <elaurent@google.com> AudioRecord: use audio attributes instead of audio source.

Added AudioRecord constructor with audio attributes.
Replaced AudioPolicymanager::getInput() by getInputForAttr().

No new functionality for now.

Also:

- Fixed warnings in AudioPolicyManager
- Allocate audio session ID before calling getOutputForAttr() in
AudioTrack.

Bug: 16006090.
Change-Id: I15df21e4411db688e3096dd801cf579d76d81711
/frameworks/av/media/libmedia/AudioTrack.cpp
72bf901ca905ce154fe7866f06d25a01aadcf974 26-Nov-2014 Eric Laurent <elaurent@google.com> Merge "audio policy: new getOutputForAttr() prototype." into lmp-mr1-dev
d325005e4a3be45c57e950f8c18b329c968602ce 26-Nov-2014 Andy Hung <hunga@google.com> Merge "Fix AudioTrack loop mode to play audio from buffer start" into lmp-mr1-dev
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/media/libmedia/AudioTrack.cpp
680b795435a5a501a56610258dce5eda40a1725d 12-Nov-2014 Andy Hung <hunga@google.com> Fix AudioTrack loop mode to play audio from buffer start

Bug: 18217633
Change-Id: Ica77acf0a32832d9b04eb657ef2f4f5329f8fbda
/frameworks/av/media/libmedia/AudioTrack.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/media/libmedia/AudioTrack.cpp
9544a8e904955f4b96ec9f2d6f4edc2a72afd270 18-Nov-2014 Eric Laurent <elaurent@google.com> am bfa77b5c: am 8cd37d67: Merge "audio policy: do not prevent routing to A2DP when suspended." into lmp-mr1-dev

* commit 'bfa77b5c687f217e26267693306aaa6cc8a63672':
audio policy: do not prevent routing to A2DP when suspended.
29e6cecdd8562700ab625c5645ddd6a7753789f1 14-Nov-2014 Eric Laurent <elaurent@google.com> audio policy: do not prevent routing to A2DP when suspended.

Allow A2DP sink selection even if A2DP is suspended.
It is not because use of A2DP is temporarily disabled by SCO
selection that the policy rule routing a given use case
to A2DP should be altered. The source will be routed to A2DP
but it will remain silent until suspend condition is cleared
which is the purpose of suspend mode.

Also make sure that accessibility prompts are audible while in call
by forcing stream type to STREAM_VOICE_CALL.
Fix inconsistent logic between AudioTrack::setStreamTypeFromAttributes()
and AudioPolicyManager::getStrategyForAttr()

Bug: 18095151.
Change-Id: I1c75dd8288ed3dd494eb942060eac9c9660dca50
/frameworks/av/media/libmedia/AudioTrack.cpp
77e79a509d19ab50b1867fe3903b5a8fae450591 17-Nov-2014 Marco Nelissen <marcone@google.com> resolved conflicts for merge of e78a27ca to lmp-mr1-dev-plus-aosp

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

to use the new static version.

Change-Id: Ia7b10eb38ca55b72278bfd33d3bf647f338b4e6a

Conflicts:
media/libmedia/IAudioFlinger.cpp
media/libmedia/IMediaPlayer.cpp
media/libstagefright/CameraSource.cpp
/frameworks/av/media/libmedia/AudioTrack.cpp
0d6db582f2ccc9f8943c5f3965e2994b7d137158 13-Nov-2014 Eric Laurent <elaurent@google.com> remove AudioSystem::getOutputSamplingRateForAttr()

It is safer to query the output sampling rate once the output
have been acquired by calling getOutputForAttr().

Bug: 16009464.
Change-Id: Ib561facd19fba5359a6b837d75f1a1cd2dc51b29
/frameworks/av/media/libmedia/AudioTrack.cpp
d2d089fc86c62843992e7d5b371ee9227189a1e6 05-Nov-2014 Glenn Kasten <gkasten@google.com> Improve AudioTrack recovery from mediaserver death

1. Fix race condition in handling of binder death notifications.

AudioSystem has a mixture of APIs for both ordinary app clients,
and the AudioFlinger and AudioPolicy services within mediaserver.
Due to this mix of uses, it is possible for there to be "surprising"
sequences of calls on the call stack.

Previously, we used a single mutex for all global variables, but
this caused a deadlock. To avoid the deadlock, we unlocked the mutex
during the critical sequence of calls. But this was a a
crucial place where it should have stayed locked;
see Change-Id I315c1c5066f62b05e1c13b04fae1272b5fbce977

Now we use separate mutexes for the AudioFlinger, AudioPolicy, and audio port
related global variables. This allows us to correctly hold each mutex
throughout the atomic region, even when AudioFlinger calls AudioPolicy
via AudioSystem, or vice-versa.

2. AudioSystem::clearAudioConfigCache now clears the IAudioFlinger reference.

3. Make AudioSystem::get_audio_policy_service more like get_audio_flinger.

Bug: 18242291
Change-Id: I9761443d8337df5bf66d4ca2316a9fd0bd11be94
/frameworks/av/media/libmedia/AudioTrack.cpp
461b02d3eccefea48fa15c67a9cd3a5895bd2765 04-Nov-2014 Eric Laurent <elaurent@google.com> Merge "audio: fix talkback why alarm is playing" into lmp-mr1-dev
03fcdcd0aa9758b6d882b18218fcfb9a1ccffdad 04-Nov-2014 Eric Laurent <elaurent@google.com> audio: fix talkback why alarm is playing

Convert attributes usage "assistance accessibility" to
a stream type guarantying that the prompt is audible
and not muted by policy manager.

Bug: 17994328.
Change-Id: I89f53f2ce84b499b859336c0a1a3a0332ee670f5
/frameworks/av/media/libmedia/AudioTrack.cpp
d9cfeb447356cb6334379eaf5da1e49424eb5979 23-Sep-2014 Jean-Michel Trivi <jmtrivi@google.com> Support speaker routing for FLAG_BEACON

Add support for routing audio stream to the speaker when audio
attributes carry the FLAG_BEACON value:
- associate streams with FLAG_BEACON to the up-to-now unused
STREAM_TTS ("Transmitted Through Speaker").
The remapping happens in AudioTrack.
- AudioPolicyManager: define new strategy for handling the Beacon
behavior, that only goes to speaker. Define new volume curves
for STREAM_TTS that are not silence only for the speaker device
category. Keep ref count of other streams and never play Beacon
streams when anything else is playing: either don't start playback
if something else is playing, or unmute STREAM_TTS when it's
allowed to play and mute when it's done.
- Take into account muting latency when starting an output.

Bug 15415971

Change-Id: I26539c7ec1a486accd85bbeb1623e9c7d3a1192f
/frameworks/av/media/libmedia/AudioTrack.cpp
c2813e568aa476e03d159529c0af28c99536db8d 17-Oct-2014 Andy Hung <hunga@google.com> Fix AudioTrack retrograde getPosition when restoring tracks

mReleased represents the number of frames written to the
track, but was cleared on start() causing a mismatch if the
client wrote to the track before starting. Moved the clearing
to entering the STATE_STOPPED or STATE_FLUSHED state.

Bug: 18017947
Bug: 18022276
Change-Id: I3788c98c4c3c4d9cc004378432797b3f3138e22e
/frameworks/av/media/libmedia/AudioTrack.cpp
7985dcb06e0c29d5cc12d0c0e17e03d5d863cf53 08-Oct-2014 Eric Laurent <elaurent@google.com> AudioTrack: fix AudioTrackThread crash upon exit

In case of error during createTrack_l(), there is a possibility
that a newly created AudioTrackThread is resumed by requestExit()
just after entering the Thread class _threadLoop() but before
entering the class threadLoop(). In this case, processAudioBuffer()
is executed once with mCblk == 0 and we assert.

Bug: 17894033.
Change-Id: I93d0d0d4dbf14bcb88dad23e6ad49d2ecd47badd
/frameworks/av/media/libmedia/AudioTrack.cpp
bb6c9a05840d924b502ce0f1868fca4881ada1ed 25-Sep-2014 Eric Laurent <elaurent@google.com> audio: fix stream type for accessibility usage

Make sure that accessibility prompts are heard when
a ringtone is active by forcing stream type
to AUDIO_STREAM_RING when phone state is AUDIO_MODE_RINGTONE.

Bug: 17558149.
Change-Id: Ia3bead8052fca5cbf282c267f7b9b06014fef628
/frameworks/av/media/libmedia/AudioTrack.cpp
dfc34daba6d6cb923683d96689a0cb7c7006eee5 19-Sep-2014 Glenn Kasten <gkasten@google.com> Reduce log spam from getTimestamp errors

Bug: 17576481
Change-Id: I07d99e7c42b7d4f0994b5a6d9c9fe8eb29fbbe40
/frameworks/av/media/libmedia/AudioTrack.cpp
7f1bc8af1c46695191bf7e2aba6467f3616629c0 12-Sep-2014 Andy Hung <hunga@google.com> Fix AudioTrack offloaded timestamp handling.

getTimestamp for offloaded tracks now returns WOULD_BLOCK for
situations where the timestamp is unavailable due to the
previous track still flushing or the timestamp is stale.
It is fixed for normal playback conditions.

Bug: 14659809
Bug: 17428188
Change-Id: Ic9ec07ccabc604236979769db5c4ea2dec252660
/frameworks/av/media/libmedia/AudioTrack.cpp
200092b7f21d2b98f30b800e79d152636f9ba225 16-Aug-2014 Glenn Kasten <gkasten@google.com> Clean up AudioTrack position and timestamp handling

Replace epoch concept by observing and accumulating server delta
positions. The advantage of using server deltas instead of absolute
values is that they (1) are not sensitive to 32-bit wraparound,
(2) are not sensitive to server behavior for stop(), and
(3) prepare for future 64-bit client positions without requiring 64-bit
positions on server.

Add comments to AudioTrack::getTimestamp() and friends
that the timestamp output parameter is undefined on error.

Don't allow getTimestamp to return a negative frame position after stop().

Accumulate the client released frames, which may be useful for a future API.

Bug: 11815245
Change-Id: I652940fa2db2f34a78c012a3ead0d9204fa29c6e
/frameworks/av/media/libmedia/AudioTrack.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/media/libmedia/AudioTrack.cpp
d9d7fa0873796ac661c44a7fcd6ad5ff697ff01f 24-Jun-2014 Jean-Michel Trivi <jmtrivi@google.com> Support for audio attributes on audio output of media player

Change-Id: Iae4995c98e64add1ab9e6c8ae6501515032755f5
/frameworks/av/media/libmedia/AudioTrack.cpp
34fb29696b0f3abf61b10f8d053b1f33d501de0a 19-Jun-2014 Mark Salyzyn <salyzyn@google.com> libmedia: 64-bit compile warnings

Change-Id: I600f062fa7148c01851023c1240c39939e648002
/frameworks/av/media/libmedia/AudioTrack.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/media/libmedia/AudioTrack.cpp
5bd3f38638acab633d181359cc9ec27b80f84d43 14-Jun-2014 Jean-Michel Trivi <jmtrivi@google.com> AudioPolicyManager: return output for audio attributes

In AudioPolicyManager, support querying an output
or playback strategy for audio attributes,
instead of a stream type,
In AudioTrack creation, use the output returned
for the track's attributes.

Change-Id: I0fef05845ba676404775e2e338c10e6a96237268
/frameworks/av/media/libmedia/AudioTrack.cpp
faabb51ceef13bf1e3f692219ac410c1cd75d0de 12-Jun-2014 Jean-Michel Trivi <jmtrivi@google.com> AudioTrack construction with audio attributes

Store audio attributes in AudioTrack class.
When an AudioTrack is "set" with non null audio
attributes, derive a stream type that reflects
the attributes.
When an AudioTrack is "set" without attributes,
and only has a stream type, derive default
audio attributes.

Change-Id: I322b91fa9a7e193118960c5e78cdddd85d66f9ad
/frameworks/av/media/libmedia/AudioTrack.cpp
9c68ac03f16cc32625f6965e869432eae4fded2d 13-Jun-2014 Jean-Michel Trivi <jmtrivi@google.com> Merge "AudioSystem: remove unused stream type"
3bcffa136909c1fb6e88ee4efd12ccac18360a85 13-Jun-2014 Eric Laurent <elaurent@google.com> force command flush after releasing a reference to shared memory

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

See issues 10711502 and 2801375.

Bug: 14057166.
Change-Id: If55f36f00d452d6cf00cf83bd2fba1c8f3abcb57
/frameworks/av/media/libmedia/AudioTrack.cpp
b7f24b101d43139b4c747129bfbc4ecf5c468b86 11-Jun-2014 Jean-Michel Trivi <jmtrivi@google.com> AudioSystem: remove unused stream type

The audio stream type is not used in the getSampleRate() and
getFrameCount() methods.

Change-Id: I3d065ae272bd039204cd323cdab9b60460034f2d
/frameworks/av/media/libmedia/AudioTrack.cpp
b4db73d022f3de3530bc2b3c9c831ccfdd1a2ead 20-May-2014 Andy Hung <hunga@google.com> Merge "Use new channel count functions for audio masks"
c56f3426099a3cf2d07ccff8886050c7fbce140f 22-Mar-2014 Glenn Kasten <gkasten@google.com> Pass stereo gains as packed minifloat

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

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

Change-Id: I63bce9e82e0a61546d8ff475fb94bcb700d99c96
/frameworks/av/media/libmedia/AudioTrack.cpp
e541269be94f3a1072932d51537905b120ef4733 16-May-2014 Andy Hung <hunga@google.com> Use new channel count functions for audio masks

Change-Id: Ia658ab4b6320d19fdb50f123c930918724ff0ef3
Signed-off-by: Andy Hung <hunga@google.com>
/frameworks/av/media/libmedia/AudioTrack.cpp
b773038277ba328696832b690b91ce6e95bd1a6c 01-May-2014 Glenn Kasten <gkasten@google.com> Add client side support for more AUDIO_FORMAT_PCM_*

As much as possible, the checks for specific formats are done on server
side. The only exception is 8-bit, which needs a client side workaround.

Change-Id: I52fe086c039460c8dac009de03b67eb54c56a836
/frameworks/av/media/libmedia/AudioTrack.cpp
c4b88a8d0f524666bf0f390075c334d047a104f2 01-May-2014 Glenn Kasten <gkasten@google.com> Fix bug for direct track with PCM != 16-bit

The AUDIO_FORMAT_PCM_8_BIT format was being converted to
AUDIO_FORMAT_PCM_16_BIT on client side even for direct tracks.
That conversion was incorrect; it should only be done for mixed tracks.

Also remove checks for specific PCM formats in the generic part of
server side of createTrack. Those format checks should only be done by
the thread. This will allow direct tracks for PCM 8-bit, PCM 24-bit, etc.

Change-Id: If5b9fd79f8642ed93e2aeabcaf4809b2ed798978
/frameworks/av/media/libmedia/AudioTrack.cpp
877a0ac7e8677fa1cbd0e8565ad9d38ba0db5fc0 01-May-2014 Glenn Kasten <gkasten@google.com> Use AUDIO_INTERLEAVE_* constants

Change-Id: I6609fa75c9a57fc4ca3887d626a2f4fb8b6593a1
/frameworks/av/media/libmedia/AudioTrack.cpp
142f519aa1acd5804d111e60d100f170fed28405 26-Mar-2014 Glenn Kasten <gkasten@google.com> Use symbol AUDIO_IO_HANDLE_NONE from <system/audio.h>

Change-Id: Id6b1aa17558eb73e17f22b8eab6cd02e00a96dff
/frameworks/av/media/libmedia/AudioTrack.cpp
ecdca392ed40e89a6ef14b86446e952c35497ac4 26-Mar-2014 Glenn Kasten <gkasten@google.com> Merge "Use symbolic constants from <system/audio.h>"
8c7b9fb41585fccb06573252823b929c82a40999 26-Mar-2014 Glenn Kasten <gkasten@google.com> Merge "Remove streamType parameter from AudioSystem::getLatency()"
ebb80e4f9873cc1a5ee3f766323f622bb0c07ae5 26-Mar-2014 Glenn Kasten <gkasten@google.com> Remove dead code

Change-Id: I0878d11451c7bbbf96b59f5fe0cd97ba1f033aa9
/frameworks/av/media/libmedia/AudioTrack.cpp
241618f1b286f9e7e02fe61e96d9194e2e1e8a7a 26-Mar-2014 Glenn Kasten <gkasten@google.com> Remove streamType parameter from AudioSystem::getLatency()

Change-Id: Ie7346e93436ddc215cad7d16be555dcb6c277d54
/frameworks/av/media/libmedia/AudioTrack.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/media/libmedia/AudioTrack.cpp
c5a17425986b4ce3384e6956762c86018b49c4a0 13-Mar-2014 Glenn Kasten <gkasten@google.com> Remove name output parameter from createTrack

It was only used for one log.
A better solution will be a per-track unique ID.

Change-Id: Ia440e02ae4a5a4019a9a2d08970e1ee93ac4c3a3
/frameworks/av/media/libmedia/AudioTrack.cpp
c644345b0b8f5292a049c4cee2bb7a2a6159b884 11-Mar-2014 Jean-Michel Trivi <jmtrivi@google.com> Merge "AudioTrack non-blocking write"
3a90f2849d49bf65f2d6257fd6da30ae46d745fa 10-Mar-2014 Marco Nelissen <marcone@google.com> Fix freeze on pause

isOffloaded() tries to lock mLock again. We should be calling isOffloaded_l()
b/13394633

Change-Id: I155be6fee937f894d8e6c974e593223ab6014ade
/frameworks/av/media/libmedia/AudioTrack.cpp
1c32a00b8750998562a8d76351ba5c6d2ed788c8 07-Mar-2014 Glenn Kasten <gkasten@google.com> Merge "Simplify AudioTrack stream end and fix race"
7064fd2dcdfeafea53cd5a992bb78c413542f29f 08-Jan-2014 Haynes Mathew George <hgeorge@codeaurora.org> AudioTrack: When paused, return cached playback position

An offload output can be re-used between two audio tracks having
the same configuration. A timestamp query for a paused track
while the other is running would return an incorrect time.
To fix this, cache the playback position on a pause() and return
this time when requested until the track is resumed.

Bug: 12826612.
Change-Id: I324112ea9827e52fff53ef44cd8513c8d85a0bc4
/frameworks/av/media/libmedia/AudioTrack.cpp
720ad9ddb2ac6b55b0dfbfcd2d8360151d8ac427 04-Feb-2014 Jean-Michel Trivi <jmtrivi@google.com> AudioTrack non-blocking write

Bug 7531968

Change-Id: I6d0e79fa8cab5b6eb36bcc34977f4cf0d7eec8ea
/frameworks/av/media/libmedia/AudioTrack.cpp
33ca5cf8826f5fcd9c011e8d336138b62d982f2a 28-Feb-2014 Glenn Kasten <gkasten@google.com> Merge "Make openRecord_l more like createTrack_l for fast tracks: part 1"
bce50bfc3846ab008bafa75c5d3f29fd7b5395f7 28-Feb-2014 Glenn Kasten <gkasten@google.com> Fix type of AudioTrack/AudioRecord parameter frameCount

It's size_t consistently

Change-Id: I29638ef59ac773218025f2403a3508a307b487e0
/frameworks/av/media/libmedia/AudioTrack.cpp
838b3d8bafa4a781e277870dee4e0390165cff52 28-Feb-2014 Glenn Kasten <gkasten@google.com> Fix type of AudioTrack/AudioRecord parameter notificationFrames

It's uint32_t consistently

Change-Id: If8298c7e9aeea2b951fe47b675adbdf48d104846
/frameworks/av/media/libmedia/AudioTrack.cpp
c6ba823a397abf865b02f4f48fe18231f94d8e87 27-Feb-2014 Glenn Kasten <gkasten@google.com> Make openRecord_l more like createTrack_l for fast tracks: part 1

Use the transfer mode to distinguish use cases, as the presence of
a callback handler is not sufficient. For example, the track could be
configured for synchronous transfer with write() or read(), and also
have a callback handler for position updates. But that does not mean
the track can operate in fast track mode.

Change-Id: I2a7f1f0ca98e68efe180b524496985109d8ce291
/frameworks/av/media/libmedia/AudioTrack.cpp
c08d20b6a37122ebf116262c9372509ed060d4c1 25-Feb-2014 Glenn Kasten <gkasten@google.com> Simplify error handling after track creation

IAudioFlinger::createTrack and IAudioFlinger::openRecord
both guarantee that (status == OK) == (sp<> != 0).

Change-Id: I91cb4f7e843019efb65cace7ba146f7da7aa5b59
/frameworks/av/media/libmedia/AudioTrack.cpp
5f631515d098c29603cda88f7a7e7580a2d55b57 25-Feb-2014 Glenn Kasten <gkasten@google.com> Unify comments and whitespace between AudioTrack and AudioRecord

Change-Id: I5320a6b2d7f7077cb12d7da4f2ca30a940100bf2
/frameworks/av/media/libmedia/AudioTrack.cpp
e3247bf8dd4f8fa8dfa3a108260241ae4a967569 25-Feb-2014 Glenn Kasten <gkasten@google.com> Update channel fields at same place in AudioTrack and AudioRecord

Change-Id: I4b649feeef47e7968a9fa3a460217017ca9b05fe
/frameworks/av/media/libmedia/AudioTrack.cpp
86f04663032ddaa25110149d709bbf896ad83b02 25-Feb-2014 Glenn Kasten <gkasten@google.com> Add log at entry to set() in AudioTrack and AudioRecord

Change-Id: Ife23b88474c1d62c0cf682c1a310d951f2c0f54a
/frameworks/av/media/libmedia/AudioTrack.cpp
d457c970c8d08519cd77280a90b61ae1e342cfe3 11-Feb-2014 Marco Nelissen <marcone@google.com> Track pid for each session

so they can be properly freed.

Change-Id: I6f389035bc29e74e7c367c1c6d0252b180f666b3
/frameworks/av/media/libmedia/AudioTrack.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/media/libmedia/AudioTrack.cpp
43bdc1de363a3c72c7dcf9c9a898bac109dc7cb5 10-Feb-2014 Glenn Kasten <gkasten@google.com> Fix build after merge from AOSP

Change-Id: I1cd3432c02db1600e49ade67e6a89e39e7a8d3ed
/frameworks/av/media/libmedia/AudioTrack.cpp
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
cac3daa6332bf6d1f7d26adc4a9915f3d7992dd9 07-Feb-2014 Glenn Kasten <gkasten@google.com> Use printf format %#x for audio_format_t in logs

Change-Id: I1c611d1037685d52ccc84efe0fccd6413ec938e9
/frameworks/av/media/libmedia/AudioTrack.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/media/libmedia/AudioTrack.cpp
df576995a5aad3428aeeef765387d650945c161d 28-Jan-2014 Eric Laurent <elaurent@google.com> AudioTrack: fix obtainBuffer timeout calculation

AudioTrack::obtainBuffer() passes a pointer to a timeout
variable that has gone out of scope when calling
ClientProxy::obtainBuffer().

Same fix for AudioRecord.

Bug: 11968591.
Change-Id: I22af8f94fa2f8cc54ab5c25c89167c805e754317
/frameworks/av/media/libmedia/AudioTrack.cpp
363fb75db26698cbb50065506e0c80b61d1fbf92 15-Jan-2014 Glenn Kasten <gkasten@google.com> Remove the redundant parameters from createTrack_l()

AudioRecord::openRecord_l() code was refactored earlier to
remove the redundant parameters:
> Change-Id: I124dce344b1d11c2dd66ca5e2c9aec0c52c230e2

This changelist refactors AudioTrack similarly.

Change-Id: Iefd2bd662870ea81d04eff7b7c26f9c8b0dadd26
/frameworks/av/media/libmedia/AudioTrack.cpp
38e905b3cbba4da443d799b16999989781afc6d8 13-Jan-2014 Glenn Kasten <gkasten@google.com> Refactor code related to I/O handles to reduce chance for leaks

The AudioRecord input handle code was refactored earlier
to fix a potential handle leak, and to simplify the code:
> Change-Id: I124dce344b1d11c2dd66ca5e2c9aec0c52c230e2

This changelist refactors AudioTrack similarly,
and adds further cleanup of both AudioTrack and AudioRecord.

We attempt to implement the rules for referencing counting I/O handles,
but there is still the possibility of a handle leak if the client process
dies after allocating the handle reference but before releasing it.
That issue is being tracked separately.

Details:
- AudioSystem::getOutput() is now called within createTrack_l
- restoreTrack_l was missing offload info
now it has the info available,
but is not yet being called for offloaded tracks
- AudioTrack::getOutput() is now const
- Remove getOutput_l()

Change-Id: I44a0a623d24fc5847bcac0939c276400568adbca
/frameworks/av/media/libmedia/AudioTrack.cpp
f0002d142e6d24c5438600b2c259679de710f8ac 24-Jan-2014 Glenn Kasten <gkasten@google.com> Merge "Replace control block frameCount_ by explicit in/out parameter"
1071915ad4ffb47825a946706f8fa73c0d22d7f8 17-Jan-2014 Glenn Kasten <gkasten@google.com> Merge "Make copy of audio_offload_info_t for future use"
543140eb709a07bc386eb5f667a4a72e31dba56c 17-Jan-2014 Glenn Kasten <gkasten@google.com> Merge "Move up initialization of mFormat, mStreamType, and mSharedBuffer earlier"
0ce5ca5e113d58cbcb7cb48615d6dbbf3fbe7c66 17-Jan-2014 Glenn Kasten <gkasten@google.com> Merge "Cleanup createTrack error handling"
d0b33f63a9364364a827e77da26b112edf3c4d6e 17-Jan-2014 Glenn Kasten <gkasten@google.com> Merge "Remove dead code in AudioTrack::processAudioBuffer"
a1ebc3b03d4dca534374c19e3c4f32ee687942e3 17-Jan-2014 Glenn Kasten <gkasten@google.com> Merge "Improve logs in AudioTrack::getMinFrameCount"
32a7e0a5f7b000951b9adb80b17796f35b024816 17-Jan-2014 Glenn Kasten <gkasten@google.com> Merge "Unify comments between AudioTrack and AudioRecord"
b5ccb2d99b2af400c70777a6452f090ac14f5a96 13-Jan-2014 Glenn Kasten <gkasten@google.com> Make copy of audio_offload_info_t for future use

Change-Id: I515970aa0660418d5d1640fb1bf477e112c89bdd
/frameworks/av/media/libmedia/AudioTrack.cpp
dd5f4c8c4059f890e81b28b026a688febb4e1dd9 13-Jan-2014 Glenn Kasten <gkasten@google.com> Move up initialization of mFormat, mStreamType, and mSharedBuffer earlier

This will allow removal of most of the parameter list to createTrack_l.

Also check for valid stream type at client so we can log a better error
message.

Change-Id: Ia7176896d47fbb49106119fca26d9de8e7efe859
/frameworks/av/media/libmedia/AudioTrack.cpp
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/media/libmedia/AudioTrack.cpp
70c0bfbe5ec88dcc3efa2bd8df26f36cff1cf03a 15-Jan-2014 Glenn Kasten <gkasten@google.com> Improve logs in AudioTrack::getMinFrameCount

Change-Id: I8b478e6abdded26a43f32c131931939e9ae36fd7
/frameworks/av/media/libmedia/AudioTrack.cpp
7103d9671ded507fd3f6938297019a32f71ea5a0 15-Jan-2014 Glenn Kasten <gkasten@google.com> Remove dead code in AudioTrack::processAudioBuffer

Change-Id: I0baefe9dc08bb5ec45d34698fc764caa160789d2
/frameworks/av/media/libmedia/AudioTrack.cpp
ac1954cb9a480a409e8cee4193fc534a6a29fbb6 15-Jan-2014 Glenn Kasten <gkasten@google.com> Merge "Document AudioTrack mFrameCount and mReqFrameCount better"
2b2165c75790050810460c8de3f414876bce4c0e 13-Jan-2014 Glenn Kasten <gkasten@google.com> Unify comments between AudioTrack and AudioRecord

Change-Id: I00a1025e2891a1c96218b3c2187eaddda6614ebc
/frameworks/av/media/libmedia/AudioTrack.cpp
23a7545c4de71e989c2d8ebf1d5b9dcf463c36a9 13-Jan-2014 Glenn Kasten <gkasten@google.com> Document locking rules for mFlags, and fix discrepancies

Change-Id: Id45ba544cc84133ed5e578fb4fd8a11b62211dc1
/frameworks/av/media/libmedia/AudioTrack.cpp
84fba38b60c2ddb02b9a787f56be88fc084b4a16 14-Jan-2014 Glenn Kasten <gkasten@google.com> Merge "Fix race in AudioTrack::getParameters()"
b1bef51fec06e8bceec914d1b48b411d3ff2adff 13-Jan-2014 Glenn Kasten <gkasten@google.com> Improve error logging for getOutputSamplingRate

Change-Id: I3b52402a663b27efe1d7c6a4f684521f33f3ff8f
/frameworks/av/media/libmedia/AudioTrack.cpp
2c6c5294388e251ebc1e00d6c8785190561c27fc 13-Jan-2014 Glenn Kasten <gkasten@google.com> Fix race in AudioTrack::getParameters()

mOutput is protected by mLock.

Change-Id: Id02e627062855ca60f28bd8961b1d5f44939c727
/frameworks/av/media/libmedia/AudioTrack.cpp
396fabdb6efcdac5aea3d9f559d1beedf6a4cedc 08-Jan-2014 Glenn Kasten <gkasten@google.com> Document AudioTrack mFrameCount and mReqFrameCount better

and remove unnecessary initialization of mFrameCount in set().

Change-Id: I9effeb0a6dd035ca02fe77f6992c55d9515b4df6
/frameworks/av/media/libmedia/AudioTrack.cpp
66a0467fdddada4caabd0f0a999fbb367fea7bee 08-Jan-2014 Glenn Kasten <gkasten@google.com> Cleanup AudioTrack::getMinFrameCount error handling

Guarantee to return a non-zero frameCount for return status NO_ERROR;

Return the correct specific status_t if any of the AudioSystem APIs fail,
instead of the generic NO_INIT.

API change: getMinFramCount no longer defaults to zero on error, so
callers _must_ check the return status. This change makes
getMinFrameCount more like other APIs. All known callers were reviewed,
and they do check the return status.

Change-Id: I4a8342a75ee89a068c23c84b8380ed9d1b968507
/frameworks/av/media/libmedia/AudioTrack.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/media/libmedia/AudioTrack.cpp
7c7be1e05634d96d08210efb4bdeb012ffba440d 20-Dec-2013 Glenn Kasten <gkasten@google.com> Fix some (but not all) unused parameter warnings

Change-Id: Ia99e23a0b46db3f3e6aa46f9018e63c14f4af369
/frameworks/av/media/libmedia/AudioTrack.cpp
dfeed91152cb54772b1411d7e82833ca4a48efcc 27-Nov-2013 Eric Laurent <elaurent@google.com> AudioTrack: fix position callback after restore

When restoring an AudioTrack, the next position callback point
should not be modified and set ahead of current buffer head.
Otherwise, as frames are dropped, the new position is never reached
and an application relying on position callbacks to reload the buffer
would be stalled.

Bug: 11868603.
Change-Id: I93b2a311642a0c89944b78bcc0482d4ceed98ae4
/frameworks/av/media/libmedia/AudioTrack.cpp
5e49afd05566820517747b9a8071c99ec0918328 27-Jul-2013 Eric Laurent <elaurent@google.com> update offloaded audio track sampling rate

AudioPlayer must read the sampling rate from offloaded audio sinks
whenever a new time position is computed as the decoder can update
the sampling rate on the fly.

Change-Id: I997e5248cfd4017aeceb4e11689324ded2a5bc88
/frameworks/av/media/libmedia/AudioTrack.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"
b5fed68bcdd6f44424c9e4d12bfe9a3ff51bd62e 03-Dec-2013 Glenn Kasten <gkasten@google.com> Increase kFastTrackMultiplier from 1 to 2

Change-Id: I158f147295eebcea96e4047d7618069bc48bdd7d
/frameworks/av/media/libmedia/AudioTrack.cpp
b31788687736666e58b852e744a93f772d3f7148 27-Nov-2013 Eric Laurent <elaurent@google.com> AudioTrack: fix position callback after restore

When restoring an AudioTrack, the next position callback point
should not be modified and set ahead of current buffer head.
Otherwise, as frames are dropped, the new position is never reached
and an application relying on position callbacks to reload the buffer
would be stalled.

Bug: 11868603.
Change-Id: I93b2a311642a0c89944b78bcc0482d4ceed98ae4
/frameworks/av/media/libmedia/AudioTrack.cpp
6f59db12a64f4496866952a251122ccb77a36c6b 27-Jul-2013 Eric Laurent <elaurent@google.com> update offloaded audio track sampling rate

AudioPlayer must read the sampling rate from offloaded audio sinks
whenever a new time position is computed as the decoder can update
the sampling rate on the fly.

Change-Id: I997e5248cfd4017aeceb4e11689324ded2a5bc88
/frameworks/av/media/libmedia/AudioTrack.cpp
8ba90326d683b035d99e24db669093e4602a7149 30-Oct-2013 Glenn Kasten <gkasten@google.com> Remove default channel mask for AudioTrack

It doesn't make sense to have a default channel mask, since the caller
needs to know what format it will use when supplying data, and there
is currently no API to return the channel mask of an AudioTrack.
audio_is_output_channel() does not allow 0, so it will catch any
stragglers (I'm not aware of any).

Also move channel mask validation earlier.

Change-Id: Ia018ded8711455581a2a935f37432b049422d492
/frameworks/av/media/libmedia/AudioTrack.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/media/libmedia/AudioTrack.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/media/libmedia/AudioTrack.cpp
abe0948c7b9aa32dceb82cebbfca52beb782754b 17-Oct-2013 Glenn Kasten <gkasten@google.com> am b2059ff3: am f8f15b05: Merge "Fix race condition in AudioTrack::pause followed by start" into klp-dev

* commit 'b2059ff384eee8ffb70a7ec8fc5570405201c734':
Fix race condition in AudioTrack::pause followed by start
f8f15b05fe051009945c9042a1a9260280e0feb2 17-Oct-2013 Glenn Kasten <gkasten@google.com> Merge "Fix race condition in AudioTrack::pause followed by start" into klp-dev
598de6c701e989385eeffa7c5dfd61f0459a2631 17-Oct-2013 Glenn Kasten <gkasten@google.com> Fix race condition in AudioTrack::pause followed by start

Bug: 11148722
Change-Id: Iec88f00c8510363d4418e4b8d5b34feb06ecf04d
/frameworks/av/media/libmedia/AudioTrack.cpp
771f1b6d196b7924707fc44177ac3a88fc31fa9e 17-Oct-2013 Eric Laurent <elaurent@google.com> am 7f8c3973: am 120a8847: Merge "AudioTrack: fix head position after restore" into klp-dev

* commit '7f8c397378a7ee5abd395413be71388ad36d3ed2':
AudioTrack: fix head position after restore
cc21e4f1e41dfa17e7e2bef995fcd22c45f6bcd0 17-Oct-2013 Eric Laurent <elaurent@google.com> AudioTrack: fix head position after restore

The head position transfered to the new track
by restoreTrack_l() must take into account the frames that
are dropped from the old track to avoid a non recoverable
offset in the playback head position returned to applications.

Bug: 11230062.
Change-Id: I51143a08b95e8f264ed709ae2054360315f2b8b1
/frameworks/av/media/libmedia/AudioTrack.cpp
7a72e2aca9a6c46a08bc605166f90915aaeb81cb 07-Oct-2013 Glenn Kasten <gkasten@google.com> Merge "Fix AudioTrack pause followed by stop"
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/media/libmedia/AudioTrack.cpp
96f04886d1c1bfbc422e2be033ea66be83e42441 20-Sep-2013 Glenn Kasten <gkasten@google.com> Simplify AudioTrack stream end and fix race

Bug: 10994052
Change-Id: Ib2e38e7a600bcffef8cbc68c1722e40fbbc7ea67
/frameworks/av/media/libmedia/AudioTrack.cpp
397edb3377e5775f4df60afb8bf6d4711e5adc0e 31-Aug-2013 Glenn Kasten <gkasten@google.com> Fix AudioTrack pause followed by stop

Now the stop is not a nop.

Bug: 10993355
Change-Id: Idfbfd6d14897574578b80648a16e0fc73765cb6c
/frameworks/av/media/libmedia/AudioTrack.cpp
9d2c78c4798ffd8c276c1bf0eaa0b34bc255a2da 23-Sep-2013 Eric Laurent <elaurent@google.com> AudioTrack: fix music resume

Fix regression introduced by commit 5a6cd22 in AudioTrack resume:
the callback thread was not signaled if paused internaly.

Bug: 10895013.
Change-Id: Ic356b115132d6fccbcee2d9bb855e92671dc20c5
/frameworks/av/media/libmedia/AudioTrack.cpp
5a6cd224d07c05b496b6aca050ce5ecf96f125af 20-Sep-2013 Glenn Kasten <gkasten@google.com> Fix slow AudioTrack and AudioRecord destruction

There were two causes for the slowness:

When thread was paused, it used nanosleep and sleep. These usually
run to completion (except for POSIX signal, which we avoid because it
is low-level). Instead, replace the nanosleep and sleep by condition
timed wait, as that can be made to return early by a condition signal.
Another advantage of condition timed wait is that a condition wait was
already being used at top of thread loop, so it is a simpler change.

The AudioRecord destructor was missing a proxy interrupt that was correct
in AudioTrack. This proxy interrupt is needed in case another thread
is blocked in proxy obtainBuffer.

Does not address the 1 second polling for NS_WHENEVER.

Bug: 10822765
Change-Id: Id665994551e87e4d7da9c7b015f424fd7a0b5560
/frameworks/av/media/libmedia/AudioTrack.cpp
ce8828a016b082f730152af2204b8ea3610dc1ec 17-Sep-2013 Glenn Kasten <gkasten@google.com> Fix underruns when fast track denied due to SRC

OpenSL ES requests a fast track. If sample rate conversion is needed,
the request is denied by server, and a larger client buffer is used
to handle the higher latency of a normal track. However the client
notification period was calculated based on buffer being divided into
2 sub-buffers. That resulted in the notification period being too long.
The server pulls chunks that are smaller than half the total buffer.
So now the client uses 3 sub-buffers when there is SRC.

Also removed the 'defer wake' optimization because it was incorrect.
This optimization attempted to reduce the number of wakeups of client,
when server releaseBuffer knows that another releaseBuffer will be
following. But there is no way for the first releaseBuffer to predict
how soon the second releaseBuffer will occur. In some cases it was
a long time, and the client underran. So now the client is woken up
immediately if the total number of available frames to client is >=
the minimum number the client wants to see (the notification period).

Also fix bug where minimum frame count was not being used in the
calculation of notification period.

Bug: 10342804
Change-Id: I3c246f4e7bc3684a344f2cf08268dc082e338e2a
/frameworks/av/media/libmedia/AudioTrack.cpp
fe346c707f59d763ded93bc3d27b51f0c0408258 30-Aug-2013 Glenn Kasten <gkasten@google.com> Fix miscellanous AudioTrack::getTimestamp() bugs

Check that get_presentation_position is non-NULL before calling.

AudioTrack::getTimestamp not implemented for fast tracks.

Fix typo in Track::getTimestamp().

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

Change-Id: Ie8d9dc1f28d8927634e04175a68b147ffc2ea8eb
/frameworks/av/media/libmedia/AudioTrack.cpp
56b592240073b1ab116c6e23a9c4c34ef5ad80d8 30-Aug-2013 Glenn Kasten <gkasten@google.com> Merge "Add IAudioTrack::getTimestamp()" into klp-dev
865f6f248bf10189272020ebfdbf4827433caf0f 30-Aug-2013 Glenn Kasten <gkasten@google.com> Merge "New AudioTrack C++ API for audio timestamps" into klp-dev
42a6f422c09ca6a960673e0e805ddf71a9b51bef 29-Aug-2013 Eric Laurent <elaurent@google.com> AudioTrack: fix write retries for compressed audio

When the amount of frames that can be written to the buffer
is less than requested, AudioTrack::processAudioBuffer() estimates
the time needed to free the missing amount of frames and asks the
callback thread to sleep.
This behavior is not possible for compressed audio and should not
be enabled for offloaded tracks.

Change-Id: I5b657283cfba06254c9ac0ea9b447467cce7eb61
/frameworks/av/media/libmedia/AudioTrack.cpp
53cec22821072719ee02c856e9ac2dda2496c570 29-Aug-2013 Glenn Kasten <gkasten@google.com> Add IAudioTrack::getTimestamp()

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

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

Change-Id: I9861d1454cff7decf795d5d5898ac7999a9f3b7e
/frameworks/av/media/libmedia/AudioTrack.cpp
ce70374bf105f8a6160bf5dd70affea012b2a464 20-Jul-2013 Glenn Kasten <gkasten@google.com> New AudioTrack C++ API for audio timestamps

This new API is intended to replace latency(), especially for A/V sync.
The application will receive periodic timestamp notifications. The period
is unspecified, but will likely be more frequent after a pause or stop,
set position, underrun, display on/off change, route change, or when audio
framework notices drift. It will be up to the higher level application
(e.g. Stagefright) to reconstruct a clock that updates more frequently.

The current latency() method doesn't indicate when latency changes
due to screen on/off state, route changes, etc.

Includes squahsed change-Id: I2082f8752040be0c234b1a6f1be2e269abf2ce7c
Dummy implementation of AudioTrack:getTimestamp()
Rename AudioTrack::Timestamp to AudioTimestamp.
Renaming and pulling up to a higher level allows more modules to use it.

Change-Id: Ibf7f6a207c3f8d8697f25ede2cd5200697fadb86
(cherry picked from commit dd69eb893867634fd169c03204a6ad7c74b351e7)
/frameworks/av/media/libmedia/AudioTrack.cpp
ec9a032c2e104ab1e3b5bf73e69dab1408ced0ad 28-Aug-2013 Eric Laurent <elaurent@google.com> AudioTrack: fix unwanted underrun when restarting

When restarting an AudioTrack from stopped state, it is necessary
to force refresh of mRemainingFrames by processAudioBuffer() as
the last write before stop() could be partial. No doing so will lead
into unnecessary sleep before filling the non contiguous part
of the buffer returned by obtainBuffer() when processAudioBuffer()
is executed for the first time after start().

Change-Id: Id703f8dc092a6f07c905eee194054b4a978f979d
/frameworks/av/media/libmedia/AudioTrack.cpp
d054c32443a493513ab63529b0c8b1aca290278c 12-Jul-2013 Glenn Kasten <gkasten@google.com> Move control block mName to createTrack() output

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

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

Change-Id: I7b6d31e24531954ab1ecdf3ed56c19433700bd89
/frameworks/av/media/libmedia/AudioTrack.cpp
b1a270d1e926fb9a01b4265a7675ed0c2c8f4868 14-May-2013 Richard Fitzgerald <rf@opensource.wolfsonmicro.com> libmedia: offloaded playback support

- start() returns a status so that upper layers can
recreate a non offloaded track in case of error.

- Added states to handle offloaded tracks specific:
- waiting for stream end (drain) notification by
audio flinger
- allow pause while waiting for stream end notification

- getPosition() queries the render position directly from
audio HAL.

- disable APIs not applicable to offloaded tracks

- Modified track restoring behavior for invalidated
offloaded tracks: just send the callback and wait for
upper layers to create a new track.

- Added wait for stream end management in audio track client
proxy. Similar to obtainBuffer and should be factored in.

Change-Id: I0fc48117946364cb255afd653195498891f622bd
Signed-off-by: Eric Laurent <elaurent@google.com>
/frameworks/av/media/libmedia/AudioTrack.cpp
cff1b2359b8a302f19539c0bc5d25c98a52733fd 17-Jul-2013 Glenn Kasten <gkasten@google.com> Merge "Add comments"
fb1fdc9d6603aa228362e7349451f6455c9849c2 11-Jul-2013 Glenn Kasten <gkasten@google.com> Add comments

Change-Id: Ifbf3a46a4183c8abc0feee1c588953ab10303cc1
/frameworks/av/media/libmedia/AudioTrack.cpp
b0dfd4613225a3b2a17bdf8d85e89a4b04d65ef3 11-Jul-2013 Glenn Kasten <gkasten@google.com> Fix type error in AudioTrack::processAudioBuffer

It returned a bool instead of nsecs_t

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

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

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

- CBlk flag for stream end

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

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

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

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

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

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

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

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

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

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

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

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

Change-Id: I3ab41138aa1083d81fe83b886a9b1021ec7320f1
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Eric Laurent <elaurent@google.com>
/frameworks/av/media/libmedia/AudioTrack.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/media/libmedia/AudioTrack.cpp
bb6f0a0bb413817d707cfb4c4a30847fda520787 04-Jun-2013 Glenn Kasten <gkasten@google.com> Fix underruns when sample rate != native sample rate

This forces a minimum of 3 application buffers when the sample rates
don't match, using the normal mixer and low latency HAL.

There is still an issue that the latency() varies depending on whether
screen was off or on at the time of creating the AudioTrack.

With screen on:
I/AudioTrack( 2028): afFrameCount=960, minBufCount=2, afSampleRate=48000, afLatency=50
I/AudioTrack( 2028): minFrameCount: 2646, afFrameCount=960, minBufCount=3, sampleRate=44100, afSampleRate=48000, afLatency=50

With screen off:
I/AudioTrack( 2817): afFrameCount=960, minBufCount=4, afSampleRate=48000, afLatency=84
I/AudioTrack( 2817): minFrameCount: 3528, afFrameCount=960, minBufCount=4, sampleRate=44100, afSampleRate=48000, afLatency=84

Change-Id: Ib45515edff2afcd672dda34881b658c800ffc25a
/frameworks/av/media/libmedia/AudioTrack.cpp
7c027248e1a4ccd5b22bc4deafb03e2d87ac8f38 26-Dec-2012 Glenn Kasten <gkasten@google.com> Consistent whitespace

Change-Id: I118cce68d3b777f9ec9b6bfb70367496422a40f2
/frameworks/av/media/libmedia/AudioTrack.cpp
61aa989a5768b9b0571ca14edaf15886509a0ec8 03-May-2013 Eric Laurent <elaurent@google.com> am 1641f328: am 4170f515: Merge "Remove timing jitter during startup of audio" into jb-mr2-dev

* commit '1641f328d4de3b2b61481607dc482ccaefe808a9':
Remove timing jitter during startup of audio
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/media/libmedia/AudioTrack.cpp
9c6745f128648f6e0144b74ee593911a9fa10d51 30-Nov-2012 Glenn Kasten <gkasten@google.com> Propose new interpretation for setPosition and setLoop

Add new API getBufferPosition to return position relative
to start of fixed buffer.

Change-Id: I7aca8e392d45b988545f07b36b5032691057b03e
/frameworks/av/media/libmedia/AudioTrack.cpp
d5681bc9a38fe4cd1d591e6ae62b9c68fb851041 22-Dec-2012 Glenn Kasten <gkasten@google.com> Merge "Start isolating control block accesses in a proxy"
8d6cc842e8d525405c68e57fdf3bc5da0b4d7e87 03-Feb-2012 Glenn Kasten <gkasten@google.com> Remove unnecessary parameter

Just get the parameter on server side

Change-Id: I433a63104dbb257e0d862be2ab61847cb36d1c15
/frameworks/av/media/libmedia/AudioTrack.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/media/libmedia/AudioTrack.cpp
a8190fc518b6769257896605f3aee091aeb60b50 04-Dec-2012 Glenn Kasten <gkasten@google.com> Split off the current control block to separate file

Prepare for a new implementation of step() etc.

Change-Id: I268421976ba577aa1fb5d7015de5441c05861190
/frameworks/av/media/libmedia/AudioTrack.cpp
083d1c1492d496960d5b28f4664ff02101736677 01-Dec-2012 Glenn Kasten <gkasten@google.com> Emphasize distinction between streaming and static

Update comments and improve error checks to match

Change-Id: I7370d6e59a7ef26dfb284a8b058d5ab2e0a42ccf
/frameworks/av/media/libmedia/AudioTrack.cpp
4bae3649d504d590a546717a8e49f96a30d9a745 30-Nov-2012 Glenn Kasten <gkasten@google.com> flush() comments and checks

flush() is only useful for streaming mode.
It is a no-op if track is active or uses a static buffer.

Change-Id: I918ac181ffae3d16a0d67d8a7208f4aec61b5bd6
/frameworks/av/media/libmedia/AudioTrack.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/media/libmedia/AudioTrack.cpp
01437b7cdaecf53acb46b50ff8b5d86b9d36eb20 29-Nov-2012 Glenn Kasten <gkasten@google.com> AudioTrack inline short const methods

Change-Id: I142917edb454d510bbe545e94e6eaea30b650fae
/frameworks/av/media/libmedia/AudioTrack.cpp
a42ff007a17d63df22c60dd5e5fd811ee45ca1b3 14-Nov-2012 Glenn Kasten <gkasten@google.com> Clean up channel count and channel mask

Channel count is uint32_t.
Remove redundant mask parameter to AudioTrack::createTrack_l()
and AudioRecord::openRecord_l().

Change-Id: I5dc2b18eb609b2c0dc3091994cbaa4628062c17f
/frameworks/av/media/libmedia/AudioTrack.cpp
aa25c0321bd4b9eb46a4d1cb4ac5fa47af30eeb4 17-Nov-2012 Glenn Kasten <gkasten@google.com> Merge ""if" statements use curly braces per media style"
67ba2b6b8018ce7556cdd880dbf28d06a92ebb78 17-Nov-2012 Glenn Kasten <gkasten@google.com> Merge "Don't use control block frame count after create"
b603744e96b07b1d5bf745bde593fb2c025cefcf 14-Nov-2012 Glenn Kasten <gkasten@google.com> Don't use control block frame count after create

This is part of a series to clean up the control block.

Change-Id: I7f4cb05aef63053f8e2ab05b286d302260ef4758
/frameworks/av/media/libmedia/AudioTrack.cpp
d65d73c4ae74d084751b417615a78cbe7a51372a 23-Jun-2012 Glenn Kasten <gkasten@google.com> "if" statements use curly braces per media style

Change-Id: I130e7849fd1da7a0b7fe56c3c53919d26e3843b8
/frameworks/av/media/libmedia/AudioTrack.cpp
827e5f1237757aee78b677efcf0f7c44fd0dd3d8 02-Nov-2012 Glenn Kasten <gkasten@google.com> Don't explicitly log tid

If needed, it can be obtained with adb logcat -v threadtime

Change-Id: I91b3911d20f7bcfc3361db4052db21ff9181f1cf
/frameworks/av/media/libmedia/AudioTrack.cpp
e33054eb968cbf8ccaee1b0ff0301403902deed6 14-Nov-2012 Glenn Kasten <gkasten@google.com> Use size_t for frame counts

Also fix typo: bufferCount should be frameCount.

Change-Id: Ibed539504db75ef99dc21c8ff1bf2987122063a5
/frameworks/av/media/libmedia/AudioTrack.cpp
60a839204713e0f8258d082af83262b1eb33a6c3 21-Jun-2012 Glenn Kasten <gkasten@google.com> Clean up frame size in AudioTrack and AudioFlinger

TrackBase::mFrameSize, mChannelMask, and mChannelCount are now const.
Use TrackBase::mFrameSize instead of re-calculating frame size.
AudioFlinger only sees 16-bit PCM format, conversion from 8-bit is
now entirely on the client side. Previously a small part of the
responsibility was on server side also.
size_t is unsigned, so use %u in logs.
Fix theoretical bug where TrackBase constructor was over-allocating space
for non-linear AudioTrack or 8-bit PCM AudioRecord (probably benign).

Change-Id: I7cbbba0bf4dba29ea751d8af341ab8e5cbbdc206
/frameworks/av/media/libmedia/AudioTrack.cpp
3b16c766d1ae2cfd8487e8ffb2b23936fc0a8e17 14-Nov-2012 Glenn Kasten <gkasten@google.com> Use uint32_t for sample rate

Change-Id: Ie240b48fb54b08359f69ecd4e5f8bda3d15cbe80
/frameworks/av/media/libmedia/AudioTrack.cpp
22eb4e239fbe9103568147d566d7482e480350b8 07-Nov-2012 Glenn Kasten <gkasten@google.com> Update audio comments

Change-Id: I85d7d2f6381b251db5695202fec75128883a8662
/frameworks/av/media/libmedia/AudioTrack.cpp
83a0382dc17364567667a4e6135db43f5bd92efc 12-Nov-2012 Glenn Kasten <gkasten@google.com> Move frame size out of the control block

This is part of a series to clean up the control block.

Change-Id: Ifab1c42ac0f8be704e571b292713cd2250d12a3f
/frameworks/av/media/libmedia/AudioTrack.cpp
bc0f6b92bba33ca9c2e76f2a520d290f055da6b2 12-Nov-2012 Glenn Kasten <gkasten@google.com> Fix regression for AudioTrack::write() 8-bit PCM

Bug: 7526532
Change-Id: I8ddd1f0e9d035b54401788dcc422591281dcd97a
/frameworks/av/media/libmedia/AudioTrack.cpp
b929e417853694e37aba1ef4399f188987b709d9 08-Nov-2012 Glenn Kasten <gkasten@google.com> Move buffers pointer out of the control block

This is part of a series to clean up the control block.

Change-Id: Ie474557db7cb360f2d9a0f11600a68f5a3d46f07
/frameworks/av/media/libmedia/AudioTrack.cpp
a47f3165f53c8e8fb8907a94de7417e2c3047eeb 07-Nov-2012 Glenn Kasten <gkasten@google.com> Simplify AudioTrack::restoreTrack_l()

Remove CBLK_RESTORING and CBLK_RESTORED from control block flags,
for AudioTrack only. They are still used by AudioRecord.

This is part of a series to clean up the control block.

Change-Id: Iae4798f5b527c492bdaf789987ff3a1dadd0cb37
/frameworks/av/media/libmedia/AudioTrack.cpp
659004c2949620d8adb29e1d950a2dd1c75ba9a9 08-Nov-2012 Glenn Kasten <gkasten@google.com> Merge "Add all-channel AudioTrack::setVolume() API"
755e8e1dcf36f282b727ff22d87d3c2fac70d30a 08-Nov-2012 Glenn Kasten <gkasten@google.com> Merge "Fix call to restoreTrack_l() without lock held"
d5ed6e88a9bea1879e41d7defaf1edea7c09f554 02-Nov-2012 Glenn Kasten <gkasten@google.com> Fix call to restoreTrack_l() without lock held

Also document lock order

Change-Id: I2c1f273a0a51fa79ee3dd766de8d23083e270051
/frameworks/av/media/libmedia/AudioTrack.cpp
864585df53eb97c31e77b3ad7c0d89e4f9b42588 07-Nov-2012 Glenn Kasten <gkasten@google.com> Remove CBLK_DIRECTION from control block flags

This is part of a series to clean up the control block.

Change-Id: I0265fece3247356b585d4d48fbda6f37aea8a851
/frameworks/av/media/libmedia/AudioTrack.cpp
8fa3ad0e4c77f7868348ad2a4cacc34c34e7c39e 07-Nov-2012 Glenn Kasten <gkasten@google.com> Merge "Remove CBLK_FAST from control block flags"
e0b07179a48ee50fda931d2aa1b3c751d167e4d7 07-Nov-2012 Glenn Kasten <gkasten@google.com> Remove CBLK_FAST from control block flags

This is part of a series to clean up the control block.

Change-Id: Ic881a3560d9547cb63fcc0cefec87aa3da480e0d
/frameworks/av/media/libmedia/AudioTrack.cpp
05d499958e4030938ed77a924ebdd9899f36752e 06-Nov-2012 Glenn Kasten <gkasten@google.com> Remove unused fields in AudioTrack::Buffer

Change-Id: Iab75f6e2348d8b6d1f3cec95aeb3fcd5135dfb50
/frameworks/av/media/libmedia/AudioTrack.cpp
d2c38fc4d5dc742d7441444316849510dd2b7363 01-Nov-2012 Glenn Kasten <gkasten@google.com> Cache mCblk in local variable cblk

Use "iMem" for sp<IMemory>

Change-Id: I2f1fbbc517fbd77cfc92f6c3b1f253c26bae93b0
/frameworks/av/media/libmedia/AudioTrack.cpp
8e825a57202ce6cb2ddac67683ee5885334ce75d 06-Nov-2012 Glenn Kasten <gkasten@google.com> Merge "Simplify control block flag names"
b1c0993b215c5c3eebd1c6bafc22bba23d57a70b 28-Feb-2012 Glenn Kasten <gkasten@google.com> Add all-channel AudioTrack::setVolume() API

Add combined channel APIs setVolume to AudioTrack,
and remove obsolete getVolume.

Change-Id: I0c87bfdbff4f4292259fa33e65f67badbafd270b
/frameworks/av/media/libmedia/AudioTrack.cpp
847d05dc8fa144dcf8f4f435d6a6ac1727f00937 28-Feb-2012 Glenn Kasten <gkasten@google.com> Remove deprecated AudioTrack APIs

Change-Id: I88be6525f3e33df529c0c3cb701d12a484809477
/frameworks/av/media/libmedia/AudioTrack.cpp
9c5fdd83f9b9f49be35107971feb33528d60b945 05-Nov-2012 Glenn Kasten <gkasten@google.com> Simplify control block flag names

Use only one symbol per flag

Change-Id: Ia3582e2134abd60c896d11337face65383e79c7c
/frameworks/av/media/libmedia/AudioTrack.cpp
9a08ebc8de71e260efb86cd1a04559b075b38ebc 02-Nov-2012 Glenn Kasten <gkasten@google.com> Fix spurious wakeup waiting for new IAudioTrack

If there was a spurious wakeup while waiting for another thread to create
a new IAudioTrack, we assumed that the track has been created when it
might not have been.

Change-Id: I5f3999b4f7a06a00aabd65a746cc7222fff396ab
/frameworks/av/media/libmedia/AudioTrack.cpp
85ab62c4b433df3f1a9826bed1c9bec07a86c750 01-Nov-2012 Glenn Kasten <gkasten@google.com> Line length 100

Change-Id: Ib28fd7b9ce951a6933f006e7f8812ba617625530
/frameworks/av/media/libmedia/AudioTrack.cpp
896adcd3ae6a1c7010e526327eff54e16179987b 13-Sep-2012 Eric Laurent <elaurent@google.com> audioflinger: send priority request from a thread

When creating a fast AudioTrack, a request is sent to SchedulingPolicyService
to elevate the requesting thread priority. This generates a binder
call into system_server process and to a JAVA service via JNI.
If the thread from which the track was created is in the system_server
process and does not have the "can call java" attribute, a crash occurs because
the binder optimization reuses the same thread to process the returning binder
call and no JNI env is present.

The fix consists in sending the priority change request from the AudioFlinger
mixer thread, not from the binder thread.

This also reverts the workaround in commit 73431968

Bug 7126707.

Change-Id: I3347adf71ffbb56ed8436506d4357eab693078a3
/frameworks/av/media/libmedia/AudioTrack.cpp
73431968e3c5cf420b5d63c54cf72d10ff7ee7bc 13-Sep-2012 Jean-Michel Trivi <jmtrivi@google.com> Workaround for track recreation bug

Ignore thread can call Java parameter to work around bug where
AudioTrack instance gets recreated when key clicks are enabled
and WFD gets turned on, with the wrong parameters.

Change-Id: Ia42c8704b46fe3ffea560b05b60939fa2e4b29e1
/frameworks/av/media/libmedia/AudioTrack.cpp
c3ae93f21280859086ae371428ffd32f39e76d50 30-Jul-2012 Glenn Kasten <gkasten@google.com> Update audio comments

Change-Id: Ie7504d0ddb252f7e4d4f99ed0b44cfc7b1049816
/frameworks/av/media/libmedia/AudioTrack.cpp
a997e7a7c5aa2fc7e95316218316f8b7b98786ba 07-Aug-2012 Glenn Kasten <gkasten@google.com> Revert "Swap the order of creating IAudioTrack and thread"

This reverts commit 5d464eb0b8cffb994a754ff108795e858a882414.
It caused the wrong thread ID -1 to be passed to IAudioFlinger::createTrack().

Change-Id: Ic221d2bb4af572d3d2d752af19238c52f6728e3a
/frameworks/av/media/libmedia/AudioTrack.cpp
5d464eb0b8cffb994a754ff108795e858a882414 23-Jun-2012 Glenn Kasten <gkasten@google.com> Swap the order of creating IAudioTrack and thread

Simplifies the error recovery in case IAudioTrack fails.

Change-Id: I6aee41a2ac747a5689fb4836b04174e6107bf32f
/frameworks/av/media/libmedia/AudioTrack.cpp
28b76b334f92a15a2be3cc9e2f7d229a3275d1ac 04-Jul-2012 Glenn Kasten <gkasten@google.com> Use audio_channel_mask_t for channel mask

Change-Id: I1c1896da48983aa9f1462a4b471f910498816f60
/frameworks/av/media/libmedia/AudioTrack.cpp
04cd0186305e2b59d23c9147787046c6662029cc 25-Jun-2012 Glenn Kasten <gkasten@google.com> getMinFrameCount error handling

Convention is for "get" APIs that directly return status_t and indirectly
return a value via a pointer, to return BAD_VALUE if the pointer is NULL.
Also indirectly return 0 for other errors.

Change-Id: I1599f20ecb26e9723f9fb384ffbf911ff3a2ce1c
/frameworks/av/media/libmedia/AudioTrack.cpp
d4070955e28ae62aa4be1657f9d32acde104bb86 12-Jul-2012 Glenn Kasten <gkasten@google.com> Remove dead code in libmedia

Change-Id: I7d8201590cda29c9fa99662a4fdba222091febfe
/frameworks/av/media/libmedia/AudioTrack.cpp
d3a9ff4b725de612bf0354c035ba8f8564dbc6e8 21-Jun-2012 Glenn Kasten <gkasten@google.com> Move declarations of local variables to first use

Change-Id: I48b193a742b32b6746aa938b84dc405124a6a5c3
/frameworks/av/media/libmedia/AudioTrack.cpp
192cbbad773979a6fe3b5a0c223356de4fc3309c 13-Jun-2012 Eric Laurent <elaurent@google.com> Fix audio track pause.

AudioTrack::pause() should signal the control block condition
to release threads waiting for available buffers in obtainBuffer().
Otherwise the behavior relies on the timout on the condition
or the fact that audioflinger will mix a new audio buffer while executing
the pause.

Bug 6653769.

Change-Id: I5f8f73c471fe306070f30b814f32fd4b4dc1d575
/frameworks/av/media/libmedia/AudioTrack.cpp
0c9d26d187017f7fb028ab52a0fbc6395142faa4 31-May-2012 Glenn Kasten <gkasten@google.com> Log track name on obtain/releaseBuffer warnings

This should help diagnose problems by allowing us to correlate
the logs with the dumpsys media.audio_flinger output.

Change-Id: I8c7c592b4f87d13b0f29c66ce7a2f301a0f063c9
/frameworks/av/media/libmedia/AudioTrack.cpp
df839841d2db4cb8e2acb10205b3942622b3e7a2 31-May-2012 Eric Laurent <elaurent@google.com> Do not keep audio wake lock when apps underrun.

Do not automatically restart an AudioTrack after an underrun
if the callback is executed but no data is written by the app.

Bug 6541286.

Change-Id: I11e7ab8dc968d7ff087058fec68f44490d3a7731
/frameworks/av/media/libmedia/AudioTrack.cpp
2986460984580833161bdaabc7f17da1005a8961 09-May-2012 Eric Laurent <elaurent@google.com> Fix issues with synchronous record start.

- Added a timeout in case the trigger event is never fired.
- Extend AudioRecord obtainBuffer() timeout in case of
synchronous start to avoid spurious warning.
- Make sure that the event is triggered if the track is
destroyed.
- Reject event if the triggering track is in an incompatible state.

Also fix a problem when restoring a static AudioTrack after
a mediaserver crash.

Bug 6449468.

Change-Id: Ib36e11111fb88f73caa31dcb0622792737d57a4b
/frameworks/av/media/libmedia/AudioTrack.cpp
093000f7d11839b920e8dfaa42ed1d09f48e24b8 03-May-2012 Glenn Kasten <gkasten@google.com> Don't allow AudioTrack frameCount to decrease

This is a workaround for bug that client can cache return value of
frameCount(), and is not notified when this value changes due to automatic
re-recreation of the underlying IAudioTrack.

A better long-term fix would be to notify clients when these kinds of
parameters change, and to fix assumptions in client code that they are
constant (e.g. in SoundPool and maybe obtainBuffer).

Also, once a fast track request is denied, don't request it again.

Bug: 6431187
Change-Id: I55b4ff30bbd9ed3a402e39452a38de52cdea53a9
/frameworks/av/media/libmedia/AudioTrack.cpp
f4022f90db5acb680870db8c1150b673cdd211d9 02-May-2012 Glenn Kasten <gkasten@google.com> Fix race in AudioTrack destruction

Bug: 6427369
Change-Id: Id3b4487406235b881f6f0b4b95c5a02a9b797e75
/frameworks/av/media/libmedia/AudioTrack.cpp
31dfd1db7a4d2228d9642008af6f3dd744368eb6 01-May-2012 Glenn Kasten <gkasten@google.com> Disable fast track log spam

except for "denied by client" and "denied by server"

Change-Id: I133ab747933729cc1f386813ee06ece055bdb294
/frameworks/av/media/libmedia/AudioTrack.cpp
e0fa467e1150c65a7b1b1ed904c579b40f97c9df 24-Apr-2012 Glenn Kasten <gkasten@google.com> Move frame count calculations for fast tracks

For fast tracks: move the default and minimum frame count calculations
from client to server. If accepted, the default and minimum frame count
is the fast mixer (HAL) frame count. If denied, the default and minimum
frame count is the same as it currently is for normal tracks.

For normal tracks: there is no change yet, preserve legacy behavior for
now but add a FIXME to change this later.

Bug fix: the test for buffer alignment matches channelCount was wrong.

Bug fix: check for 8-bit data in shared memory, which isn't supported.

Optimizations:
- in set(), only call AudioSystem::getOutputSamplingRate() when needed
- in createTrack_l(), only call AudioSystem::getSamplingRate() and
AudioSystem::getFrameCount() when needed

Change-Id: I79d2fe507db1a8f7bb094c71da8a129951dbb82f
/frameworks/av/media/libmedia/AudioTrack.cpp
a636433cbd09c0708b85f337ef45c0cdef3bcb4d 19-Apr-2012 Glenn Kasten <gkasten@google.com> Use C APIs instead of C++ APIs for policy

The C++ APIs are going away.

Note: we use tid == 0 which is not supported yet by the C APIs,
do not submit this until that is added.

Change-Id: I0e90789e6c81c69f2544e899c52421ea5d1342be
/frameworks/av/media/libmedia/AudioTrack.cpp
ca8b28013c0558a4a3323a1a0f58520277200086 23-Apr-2012 Glenn Kasten <gkasten@google.com> Fix regression in AudioTrack::pause()

Bug: 6379646
Change-Id: I12b53bc4118499ddc73a53a981f3f56328140868
/frameworks/av/media/libmedia/AudioTrack.cpp
3acbd053c842e76e1a40fc8a0bf62de87eebf00f 28-Feb-2012 Glenn Kasten <gkasten@google.com> Configure policy of mediaserver threads

Change-Id: Ifd825590ba36996064a458f64453a94b84722cb0
/frameworks/av/media/libmedia/AudioTrack.cpp
1948eb3ea6eee336e8cdab9b0c693f93f5f19993 14-Apr-2012 Eric Laurent <elaurent@google.com> Add support for deep audio buffers

Allow AudioSink to use deep audio buffering when the
source is audio only and its duration is more than
a certain threshold.
This helps improve battery life but implies higher
audio latency.

Change-Id: Ie79915b61c370292f05aabda9779356570e03cbb
/frameworks/av/media/libmedia/AudioTrack.cpp
0ca3cf94c0dfc173ad7886ae162c4b67067539f6 18-Apr-2012 Eric Laurent <elaurent@google.com> rename audio policy output flags

Change-Id: I27c46bd1d1b2b5f96b87af7d05b951fef18a1312
/frameworks/av/media/libmedia/AudioTrack.cpp
1a9ed11a472493cac7f6dfcbfac2064526a493ed 21-Mar-2012 Eric Laurent <elaurent@google.com> audio policy: add configuration file

removed outputs to stream mapping cache in audio system: the output for a
given stream type must always be queried from audio policy manager as the cache
is not always updated fast enough by audioflinger callback.

removed AudioFlinger::PlaybackThread::setStreamValid() not used anymore if
stream to output mapping is not cached.

Change-Id: Ieca720c0b292181f81247259c8a44359bc74c66b
/frameworks/av/media/libmedia/AudioTrack.cpp
4a4a0959bca78e03e3c3f486ba17829c28314d8c 19-Mar-2012 Glenn Kasten <gkasten@google.com> AudioTrack client fast policy

Change-Id: I42ce691df3f586ac061b62237f35a263a0116f1f
/frameworks/av/media/libmedia/AudioTrack.cpp
a1472d9883e35edd280201c8be3191695007dfd4 30-Mar-2012 Marco Nelissen <marcone@google.com> Make AudioTrack/AudioRecord handle more than 2^32 frames

b/6160363
Change-Id: I471815012c6a113ec2c4dd7676e8fa288a70bc76
/frameworks/av/media/libmedia/AudioTrack.cpp
b83d38feeeb88a8a2a6219e1fca2480b5a14fb0d 26-Mar-2012 Glenn Kasten <gkasten@google.com> Merge "IAudioFlinger::createTrack and openRecord flags"
291f4d505aff81969e6666049d3cc3446f836af2 19-Mar-2012 Glenn Kasten <gkasten@google.com> Remove enforceFrameCount

It was only used to decide whether to issue a warning.
The warning was issued the first time track was created but
not at re-creation. Now it is a verbose message every time,
not a warning since it happens all the time with key clicks on A2DP.

Change-Id: I9d39f53c0a7eb84b666e55b1b76ff830cf8f37ba
/frameworks/av/media/libmedia/AudioTrack.cpp
63c1faa8dea7feb90255d31ef2a133d8f2818844 21-Mar-2012 Glenn Kasten <gkasten@google.com> Merge "Update comments"
ea7939a079b3600cab955760839b021326f8cfc3 14-Mar-2012 Glenn Kasten <gkasten@google.com> Whitespace

Fix indentation, and add blank lines in key places for clarity

Change-Id: I57a0a8142394f83203161aa9b8aa9276abf3ed7c
/frameworks/av/media/libmedia/AudioTrack.cpp
17a736c3e1d062d7fc916329eb32aef8935614af 14-Feb-2012 Glenn Kasten <gkasten@google.com> Update comments

Change-Id: I327663a020670d0a72ff57bd0b682e2ce0528650
/frameworks/av/media/libmedia/AudioTrack.cpp
a075db4ff9b086ac2885df77bb6da0869293df92 06-Mar-2012 Glenn Kasten <gkasten@google.com> IAudioFlinger::createTrack and openRecord flags

createTrack and openRecord don't need the "old" flags parameter,
which was either audio_policy_output_t or audio_in_acoustics_t
shifted left by 16 bits. But they do need "new" flags, which
are defined by the application use case. Initially, the only
application use case flag is timed output, but others are planned.

For output, the audio_policy_output_t flags are passed to
AudioSystem::getOutput, which returns an audio_io_handle_t, and that
handle is then passed to createTrack. So createTrack doesn't need the
old flags parameter.

For input, the audio_in_acoustics_t flags are passed to
AudioSystem::getInput, which returns an audio_io_handle_t, and that
handle is then passed to openRecord. So openRecord doesn't need the
old flags parameter.

Change-Id: I18a9870911846cca69d420c19fe6a9face2fe8c4
/frameworks/av/media/libmedia/AudioTrack.cpp
e53b9ead781c36e96d6b6f012ddffc93a3d80f0d 13-Mar-2012 Glenn Kasten <gkasten@google.com> Whitespace and indentation

Fix indentation to be multiple of 4.
Make it easier to search:
sp< not sp < to
"switch (...)" instead of "switch(...)" (also "if" and "while")
Remove redundant blank line at start or EOF.
Remove whitespace at end of line.
Remove extra blank lines where they don't add value.

Use git diff -b or -w to verify.

Change-Id: I966b7ba852faa5474be6907fb212f5e267c2874e
/frameworks/av/media/libmedia/AudioTrack.cpp
18868c5db2f90309c6d11e5837822135e4a0c0fa 07-Mar-2012 Glenn Kasten <gkasten@google.com> Use audio_policy_output_flags_t consistently

This affects:
- IAudioFlinger::openOutput
- AudioTrack::AudioTrack
- AudioTrack::set
- apps that call these

Change-Id: I26fb281bac6cb87593d17697bc9cb37a835af205
/frameworks/av/media/libmedia/AudioTrack.cpp
d8d6185c978c9b27ca69e7791785e0983ed9e8b8 06-Mar-2012 Eric Laurent <elaurent@google.com> AudioTrack: relax check on minimum buffer size

Current AudioTrack implementation enforces that the requested audio
buffer size is at least corresponding the audio latency.
This requirement is too strong and leads to problems with current
stagefright and AudioSink implementations when playing over output
streams with long latency.

Ultimately, the AudioSink design should be changed to specify a minimum
buffer size in time or frames units but not in buffer count units.

Change-Id: I8ba603956f92ac49143a8249572665aa548f2f0f
/frameworks/av/media/libmedia/AudioTrack.cpp
480b46802bef1371d5caa16ad5454fce04769c57 28-Feb-2012 Glenn Kasten <gkasten@google.com> Shorten thread names

prctl(PR_SET_NAME) limits to 15 characters. Before we had names like
"Binder Thread #" and the counter was cut off :-( Also remove redundant
"thread" at end of name; it's always a thread.

Change-Id: I1f99c2730ba0787ed9b59c15914356cddf698e2f
/frameworks/av/media/libmedia/AudioTrack.cpp
4ff14bae91075eb274eb1c2975982358946e7e63 09-Feb-2012 John Grossman <johngro@google.com> Upintegrate Audio Flinger changes from ICS_AAH

Bring in changes to audio flinger made to support timed audio tracks
and HW master volume control.

Change-Id: Ide52d48809bdbed13acf35fd59b24637e35064ae
Signed-off-by: John Grossman <johngro@google.com>
/frameworks/av/media/libmedia/AudioTrack.cpp
d9b9b8d09e7471b0ffa21cfa9f944ef4ad300a71 14-Feb-2012 Glenn Kasten <gkasten@google.com> Merge "Update comments"
99e53b86eebb605b70dd7591b89bf61a9414ed0e 19-Jan-2012 Glenn Kasten <gkasten@google.com> Update comments

We no longer put the filename at start of file.

Change-Id: Ic435b159a23105681e3d4a6cb1ac097bc853302e
/frameworks/av/media/libmedia/AudioTrack.cpp
ed15977476a3d53103866e6d527fa3fb65d4166c 14-Feb-2012 Glenn Kasten <gkasten@google.com> Merge "Remove dead code AudioTrack::getLoop"
6dbc1359f778575d09d6da722b060a6d72c2e7c5 02-Feb-2012 Glenn Kasten <gkasten@google.com> AudioRecord and AudioTrack client tid

Inform AudioFlinger of the tid of the callback thread.

Change-Id: I670df92dd06749b057238b48ed1094b13aab720b
/frameworks/av/media/libmedia/AudioTrack.cpp
38f5d71e72f3b76c5b519614d27f051d53cd2712 08-Feb-2012 Glenn Kasten <gkasten@google.com> Remove dead code AudioTrack::getLoop

Change-Id: I868329c52f31bc20125f068500d8f892b4ec9796
/frameworks/av/media/libmedia/AudioTrack.cpp
4f9b0c54011eb8fd2ccfb393c2dcd51cd07800e0 08-Feb-2012 Glenn Kasten <gkasten@google.com> Merge "Remove dead mutex in AudioTrack/AudioRecord thread"
a5224f319e2ba4b51ddb4287705ccf8d4b8ecc51 04-Jan-2012 Glenn Kasten <gkasten@google.com> AudioTrack declare more methods const

Change-Id: I4999e984460893961d0d8092cff17f3cf07d7214
/frameworks/av/media/libmedia/AudioTrack.cpp
a0d68338a88c2ddb4502f95017b546d603ef1ec7 28-Jan-2012 Glenn Kasten <gkasten@google.com> Use NULL not 0 for raw pointers

Use if (p != NULL) instead of if (ptr)

Change-Id: Iaec3413a59ccbf233c98fcd918cc7d70ac5da9fa
/frameworks/av/media/libmedia/AudioTrack.cpp
0e265cf36d201a7ccc0238b5c60b50f43d1dc450 02-Feb-2012 Glenn Kasten <gkasten@google.com> Remove dead mutex in AudioTrack/AudioRecord thread

The client callback threads had mutexes called AudioTrackThread::mLock
and ClientRecordThread::mLock. These mutexes were only used by start()
and stop(), and were unused by the thread itself. But start() and
stop() already have their own protection provided by AudioTrack::mLock
and AudioRecord::mLock. So the thread mutexes can be removed.

Change-Id: I098406d381645d77fba06a15511e179a327848ef
/frameworks/av/media/libmedia/AudioTrack.cpp
83d86538c4c479a9225c75ab27938e8f05abb9c8 17-Jan-2012 Glenn Kasten <gkasten@google.com> Make AudioTrack control block volume field private

This is part of the process of abstracting the control block
to make it easier to maintain.

Change-Id: Idb8f461e68dab3bcf268159cc0781651c6fb7094
/frameworks/av/media/libmedia/AudioTrack.cpp
05bfe50e13793404a78c20c850d467d17734d496 20-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Move memcpy_to_i16_from_u8 to audio_utils"
c813985abd8ba61e999b3505f6a332574f87a1be 18-Jan-2012 Andreas Huber <andih@google.com> Temporarily restore AudioSystem/AudioTrack APIs with their former signatures

until we get updated prebuilts from vendor.

Change-Id: I8aae81d2513edca0ab268053a11c8c4206879e61
/frameworks/av/media/libmedia/AudioTrack.cpp
b1cf75c4935001f61057989ee3cf27bbf09ecd9c 17-Jan-2012 Glenn Kasten <gkasten@google.com> Track volume cleanup

Always read and write track volumes atomically. In most places this was
already being done, but there were a couple places where the left and
right channels were read independently.

Changed constant MAX_GAIN_INT to be a uint32_t instead of a float.
It is always used as a uint32_t in comparisons and assignments.
Use MAX_GAIN_INT in more places.

Now that volume is always accessed atomically, removed the union
and alias for uint16_t volume[2], and kept only volumeLR.

Removed volatile as it's meaningless.

In AudioFlinger, clamp the track volumes read from shared memory
before applying master and stream volume.

Change-Id: If65e2b27e5bc3db5bf75540479843041b58433f0
/frameworks/av/media/libmedia/AudioTrack.cpp
511754b5839fd9b09fc56b89ae007fbc39084a33 11-Jan-2012 Glenn Kasten <gkasten@google.com> Move memcpy_to_i16_from_u8 to audio_utils

This will make it easier for this kind of code to be optimized
for each target architecture.

Change-Id: I9efd27d6c0175b00b9a784353244805cec63c0b8
/frameworks/av/media/libmedia/AudioTrack.cpp
613882293184e575a44bff681a3decaefe889e69 17-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Use size_t for frame size"
0107954f72153db747a3727dc1157e9236dfed90 17-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Use audio_stream_type_t consistently"
05632a5fa4b88ca474294887fc92a9fcdf0e2352 03-Jan-2012 Glenn Kasten <gkasten@google.com> AudioTrack and AudioFlinger send level cleanup

Add an API to control block for getting/setting send level.
This allow us to make the mSendLevel field private.

Document the lack of barriers.

Use 0.0f to initialize floating-point values (for doc only).

Change-Id: I59f83b00adeb89eeee227e7648625d9a835be7a4
/frameworks/av/media/libmedia/AudioTrack.cpp
b9980659501d0428d65d8292f3c32da69d37fbd2 11-Jan-2012 Glenn Kasten <gkasten@google.com> Use size_t for frame size

except in the control block, where we don't have room.

In AudioFlinger::ThreadBase::TrackBase::getBuffer,
read the frame size from control block only once.

Change-Id: Id6c4bccd4ed3e07d91df6bbea43bae45524f9f4e
/frameworks/av/media/libmedia/AudioTrack.cpp
fff6d715a8db0daf08a50634f242c40268de3d49 13-Jan-2012 Glenn Kasten <gkasten@google.com> Use audio_stream_type_t consistently

At native level it was a mixture of audio_stream_type_t, int, uint32_t,
and uint8_t. Java is still int. Also fixed a couple of hard-coded -1
instead of AUDIO_STREAM_DEFAULT, and in startToneCommand a hard-coded 0
instead of AUDIO_STREAM_VOICE_CALL.

Change-Id: Ia33bfd70edca8c2daec9052984b369cd8eee2a83
/frameworks/av/media/libmedia/AudioTrack.cpp
4cc55d53d542c4f4ed645738cebb65b9e7eb6c44 12-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Use audio_format_t consistently"
83bc7f3cf78b28a818417f40a4f0c00593993366 04-Jan-2012 Glenn Kasten <gkasten@google.com> libmedia new can't fail on Android

Change-Id: Ie79dd5abb8078b35474bf0f1b3a6ff994a3a3360
/frameworks/av/media/libmedia/AudioTrack.cpp
5c7b3bcc88e2b472f1f7b416d89222714b96a567 09-Jan-2012 Glenn Kasten <gkasten@google.com> Merge "Clean up AudioTrack::mActive and stopped()"
29357bc2c0dd7c43ad3bd0c8e3efa4e6fd9bfd47 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/157220

Bug: 5449033
Change-Id: Ic9c19d30693bd56755f55906127cd6bd7126096c
/frameworks/av/media/libmedia/AudioTrack.cpp
5ff1dd576bb93c45b44088a51544a18fc43ebf58 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
/frameworks/av/media/libmedia/AudioTrack.cpp
e1c3962e268ffc12bfd1bd9ea84da1f135f36960 04-Jan-2012 Glenn Kasten <gkasten@google.com> Use audio_format_t consistently

Was int, uint32_t, uint16_t, and uint8_t with 2-bit bitfield.
Also replace 0 by AUDIO_FORMAT_DEFAULT and replace 1 by
AUDIO_FORMAT_PCM_16_BIT.

Change-Id: Ia8804f53f1725669e368857d5bb2044917e17975
/frameworks/av/media/libmedia/AudioTrack.cpp
9a2aaf927e56a4b4acab23ef16b3f133a9f48a63 03-Jan-2012 Glenn Kasten <gkasten@google.com> Clean up AudioTrack::mActive and stopped()

mActive is protected by mLock; volatile is meaningless on SMP.

Fixed a couple of places where mActive was accessed without a lock:
- stopped()
- processAudioBuffer()

Added stopped_l() for cases where we already hold the lock.

Made mActive a bool not int.

Moved down a lock in setPosition that was being acquired too early.

Change-Id: I73ff368e991c0db9f9472df0b3f96fd33fcc7311
/frameworks/av/media/libmedia/AudioTrack.cpp
f6b1678f8f508b447155a81b44e214475ab634a8 15-Dec-2011 Glenn Kasten <gkasten@google.com> Use the standard CC_LIKELY and CC_UNLIKELY macros

Several source files privately defined macros LIKELY and UNLIKELY in terms
of __builtin_expect. But <cutils/compiler.h> already has CC_LIKELY and
CC_UNLIKELY which are intended for this purpose. So rename the private
uses to use the standard names.

In addition, AudioFlinger was relying on the macro expanding to extra ( ).

Change-Id: I2494e087a0c0cac0ac998335f5e9c8ad02955873
/frameworks/av/media/libmedia/AudioTrack.cpp
42968939dfce0954d6540011199045ec4ed7de80 15-Dec-2011 Glenn Kasten <gkasten@google.com> Merge "Fix indentation and whitespace"
2eda60a8485cfe70a60e72156beffdc470ecb093 15-Dec-2011 Glenn Kasten <gkasten@google.com> Merge "Audio C++ comments"
c5ac4cb3a5124860ccfc7e4ff66251c55a5595ca 12-Dec-2011 Glenn Kasten <gkasten@google.com> Fix indentation and whitespace

Use git diff -w to verify.

Change-Id: Ib65be0a1ecf65d6cad516110604e3855bf68a638
/frameworks/av/media/libmedia/AudioTrack.cpp
1d334101f1289cf4c8967af6e78ac22619175982 15-Dec-2011 Glenn Kasten <gkasten@google.com> Merge "Remove unnecessary this->"
b299dc4ded29a226daac07f195d1558e660d2f9f 15-Dec-2011 Glenn Kasten <gkasten@google.com> Merge "Remove redundant clear()"
362c4e697d8e9c034e964ac7b40227e054491547 14-Dec-2011 Glenn Kasten <gkasten@google.com> Audio C++ comments

Change-Id: I84906ebb9dfcfa5b96b287d18364b407f02a30c1
/frameworks/av/media/libmedia/AudioTrack.cpp
91eb8bfbe253a6b6fe1aa23fb884a601c28991c4 13-Dec-2011 Glenn Kasten <gkasten@google.com> Remove redundant clear()

Change-Id: Ie5e4e63cbc8fa85ef50451dddf8f149fa864b132
/frameworks/av/media/libmedia/AudioTrack.cpp
9054897ab9ffb307fadae81b774a1fc61cb542e7 13-Dec-2011 Glenn Kasten <gkasten@google.com> Remove unnecessary this->

Change-Id: I72038f5d4568f0633d3e4ab90f4b67e2dd22c332
/frameworks/av/media/libmedia/AudioTrack.cpp
f0c495012bad92230604a9a12a907812ec49ee8f 30-Nov-2011 Glenn Kasten <gkasten@google.com> AudioTrack::setVolume check range

Change-Id: Ie182bf0f741f1f49f68c02a1e7437a2a34d34fc5
/frameworks/av/media/libmedia/AudioTrack.cpp
879135196fd1c97deefc538c888037c56c2879a7 23-Jun-2011 Glenn Kasten <gkasten@google.com> Bug 4903178 Restore priority and cgroup on stop

On AudioTrack and AudioRecord stop or failed start, restore the priority
and cgroup of the caller to their previous values, rather than forcing
to NORMAL. Dependent on new thread APIs.

Also fixes bug where priority was set to AUDIO but cgroup not set.

Change-Id: Ib83893918fb4fdf57c6b87884b51038997a631d8
/frameworks/av/media/libmedia/AudioTrack.cpp
3856b090cd04ba5dd4a59a12430ed724d5995909 20-Oct-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/143865

Bug: 5449033
Change-Id: I0122812ed6ff6f5b59fe4a43ab8bff0577adde0a
/frameworks/av/media/libmedia/AudioTrack.cpp
cfe2ba6b01a258e39f9c215ffc7b750e0b68f708 14-Sep-2011 Eric Laurent <elaurent@google.com> Issue 5298399: Lost speech after a crash in gTalk.

Fixed problem in AudioTrack::restoreTrack_l() causing a permanent
failure if the IAudioTrack interface to AudioFlinger could not be
restored at the first attempt.

Change-Id: I039d4fe2dca8d3baf71f1a6c51119f27a67b6611
/frameworks/av/media/libmedia/AudioTrack.cpp
2267ba18d0d2b2d4bd7f5411821ad89ac2659a88 07-Sep-2011 Eric Laurent <elaurent@google.com> AudioTrack: extend callback thread sleep time

Do not force wake up the AudioTrack thread every 10ms if no timed
events (loop, markers..) have to be processed.
This will help reduce power consumption.

Change-Id: Icb425b13800690008dd07c27ffac84739e3dbba3
/frameworks/av/media/libmedia/AudioTrack.cpp
408b8dc3c0a364c6f6b4991d15da9e6bcc2b8008 06-Sep-2011 Eric Laurent <elaurent@google.com> Issue 5247986: Battery drain due to audio wakelock

The problem occurs when activating or deactivating A2DP connection
while SoudPool has a channel active. This can happen quite frequently now
that the UI sound effects are enabled by default.
If PCM data is remaining in the AudioTrack buffer when it is restroyed and
re-created on the new AudioFlinger output thread, this data is flushed.
As a consequence, no underrun or request for new data callback is sent to
SoundPool and the sound channel remains active for ever as the end of the
sample is never detected.

Change-Id: I13e0c11e4ce3f83bff7f58d347ca814b6a86712b
/frameworks/av/media/libmedia/AudioTrack.cpp
9f6530f53ae9eda43f4e7c1cb30d2379db00aa00 30-Aug-2011 Eric Laurent <elaurent@google.com> 226483: A2DP connected, but music out to speaker

When the A2DP headset is connected, there is a possible
race condition when the audio tracks are moved from
the mixer thread attached to the speaker output to the thread
attached to A2DP output.
As the request to clear the stream type to output mapping cache in
the client process is asynchronous, it is possible that the flag
indicating to the client audio track to re-create the IAudioTrack
on the new thread is processed before the cache is invalidated.
In this case, the track will be attached to the old thread and
music will continue playing over the device speaker instead of being
redirected to A2DP headset.

Change-Id: Ib2ce1eb5320eaff83287b93779061bf4e7a330df
/frameworks/av/media/libmedia/AudioTrack.cpp
cd07594333cbe8b2c86c6609cce01a74d6cc33f8 26-Aug-2011 Jean-Michel Trivi <jmtrivi@google.com> Bug 4364249 Play position is 0 after flushing AudioTrack

AudioTrack::stop() is not synchronous, so a stop() followed
by flush(), which is synchronous, will not always report
a playhead position of 0 after being called.
This CL adds a flag to mark a track as flushed, and report the
correct playhead position in this state.
Bug 5217011 has been created to address the real issue in the
future, where flush could be made synchronous, to properly
address bug 4364249.

Change-Id: Icf989d41a6bcd5985bb87764c287f3edb7e26d12
/frameworks/av/media/libmedia/AudioTrack.cpp
3a34befc6fb04a4945a849e8bda8b84e4bf973fe 02-Aug-2011 Marco Nelissen <marcone@google.com> Keep effects sessions active when the caller dies.

Don't remove effects until the session they are in goes away or all
AudioEffects have been explicitly released. This allows the control
panel process to die without stopping the effects.

Change-Id: I4496e5df080230ca1af149dec95c1309ab8ea888
/frameworks/av/media/libmedia/AudioTrack.cpp
68cbeba4e21aa53f52fb99b74dfa1910af31a3eb 23-Jun-2011 Glenn Kasten <gkasten@google.com> Merge "Fix warnings for uninitialized local variables"
d0965dde97f2815ae0a15fe6b40946f8a741a81e 23-Jun-2011 Glenn Kasten <gkasten@google.com> Fix warnings for uninitialized local variables

Change-Id: Ic9b03b0fd215444e76c7b7bebb385f7831c557e0
/frameworks/av/media/libmedia/AudioTrack.cpp
671a636931295d9c33ffca74551a804479d01241 17-Jun-2011 Eric Laurent <elaurent@google.com> Added audio_bytes_per_sample() helper function

Change-Id: Ibfcd75c4c241a53d5f052c25ada091904991048a
/frameworks/av/media/libmedia/AudioTrack.cpp
7394a4f358fa9908a9f0a7c954b65c399f4268e6 14-Jun-2011 Dima Zavin <dima@android.com> audio: update for audio/audio_policy header names/locations

Change-Id: I36c49352eee57559403cd1597f56a8485a360289
Signed-off-by: Dima Zavin <dima@android.com>
/frameworks/av/media/libmedia/AudioTrack.cpp
c6854100cea4fcd0f20cb2ac8235c02d1849b3a1 02-Jun-2011 Glenn Kasten <gkasten@google.com> Remove unnecessary level of priority indirection

Change-Id: I942d43973c20a7ace8b0d3f78b4da97e45e996c6
/frameworks/av/media/libmedia/AudioTrack.cpp
0d255b2d9061ba31f13ada3fc0f7e51916407176 25-May-2011 Jean-Michel Trivi <jmtrivi@google.com> Use channel mask instead of channel count for track creation

Record and playback objects (resp AudioRecord and AudioTrack)
are created using a channel mask, but this information is lost
in the mixer because only the channel count is known to
AudioFlinger. A channel count can always be derived from a
channel mask.

The change consists in:
- disambiguiting variable names for channel masks and counts
- passing the mask information from the client to AudioFlinger
and the mixer.
- when using the DIRECT ouput, only verifying the format of
the track is compatible with the output's for PCM.

Change-Id: I50d87bfb7d7afcabdf5f12d4ab75ef3a54132c0e
/frameworks/av/media/libmedia/AudioTrack.cpp
64760240f931714858a59c1579f07264d7182ba2 11-May-2011 Dima Zavin <dima@android.com> update for new audio.h header location

Change-Id: Ic4c62c4037800802427eb7d3c7f5eb8b25d18876
Signed-off-by: Dima Zavin <dima@android.com>
/frameworks/av/media/libmedia/AudioTrack.cpp
fce7a473248381cc83a01855f92581077d3c9ee2 20-Apr-2011 Dima Zavin <dima@android.com> audio/media: convert to using the audio HAL and new audio defs

Change-Id: Ibc637918637329e4f2b62f4ac7781102fbc269f5
Signed-off-by: Dima Zavin <dima@android.com>
/frameworks/av/media/libmedia/AudioTrack.cpp
38ccae2c0324daa305f3fe77d25fdf5edec0b0e1 29-Mar-2011 Eric Laurent <elaurent@google.com> New fix for issue 4111672: control block flags

The first fix (commit 913af0b4) is problematic because it makes threads
in mediaserver process block on the cblk mutex. This is not permitted
as it can cause audio to skip or worse have a malicious application
prevent all audio playback by keeping the mutex locked.

The fix consists in using atomic operations when modifying the control
block flags.

Also fixed audio_track_cblk_t::framesReady() so that it doesn't block
when called from AudioFlinger (only applies when a loop is active).

Change-Id: Ibf0abb562ced3e9f64118afdd5036854bb959428
/frameworks/av/media/libmedia/AudioTrack.cpp
9b7d950f1f3b0c526712b713dbceb0e22762c015 21-Mar-2011 Eric Laurent <elaurent@google.com> Fix issue 3483718: audio streaming and A2DP.

The problem is that when switching from A2DP to device speakers or headset,
The AudioTrack binder interface to AudioFlinger must be destroyed and restored
to accomodate new buffer size requirements. Current AudioTrack implementation
did not restore properly the PCM buffer write index which caused a mismatch between
the written frame count in the mediaplayer renderer and the AudioTrack. The renderer
could then believe the AudioTrack buffer was full and stop writing data preventing the
AudioTrack to reach a bufffer full condition and resume playback.

The rendered was also modified to refresh the AudioTrack frame count (buffer size)
inside the write loop in NuPlayer::Renderer::onDrainAudioQueue() as this count can change
from one write to the next.

Also modified AudioTrack::obtainBuffer() to check for track invalidated status before
querying for available space in the buffer. This avoids writing to the old track's
buffer until full before detecting the invalidated condition and create a new track.

Change-Id: I16a857e464e466880847f52f640820aa271539ad
/frameworks/av/media/libmedia/AudioTrack.cpp
33797ea64d067dfeaacbfd7ebe7f3383b73961b5 17-Mar-2011 Eric Laurent <elaurent@google.com> Fix issue 4111672: AudioTrack control block flags

Make sure that all read/modify/write operations on the AudioTrack
and AudioRecord control block flags field are protected by the
control block's mutex.

Also fix potential infinite loop in AudioTrack::write() if the
written size is not a multiple of frame size.

Change-Id: Ib3d557eb45dcc3abeb32c9aa56058e2873afee27
/frameworks/av/media/libmedia/AudioTrack.cpp
1703cdfee717b1b312bf8979816a9e2f16a82e5d 07-Mar-2011 Eric Laurent <elaurent@google.com> Fix issue 3439872: video chat and bluetooth SCO

This change fixes the stability problems experienced when using
a bluetooth headset supporting both A2DP and SCO. Problems occur
when starting the video chat at which time the A2DP output is being
stopped to start SCO. At that time, active AudioTracks are invalidated
by AudioFlinger so that a new AudioTrack binder interface can be
recreated by the client process on the new mixer thread with correct parameters.
The problem was that the process to restore the binder interface was not
protected against concurrent requests which caused 2 binder interfaces
to be created sometimes. This could lead to permanent client deadlock
if one of the client threads was waiting for a condition of the first
created binder interface while the second one was created (as the AudioFlinger
would only signal conditions on the last one created).
This concurrent request situation is more likely to happen when a client
uses the JAVA AudioTrack as the JNI implementation uses simultaneously the
native AudioTrack callback and write push mechanisms. By doing so, the code
that checks if the binder interface should be restored (in obtainBuffer()) is
much more likely to be called concurrently from two different threads.

The fix consists in protecting the critical binder interface restore phase
with a flag in the AudioTrack control block. The first thread acting upon the binder
interface restore request will raise the flag and the second thread will just wait for
a condition to be signaled when the restore process is complete.

Also protected all accesses to the AudioTrack control block by a mutex to prevent
access while the track is being destroyed and restored. If a mutex cannot be held
(e.g because we call a callback function), acquire a strong reference on the IAudioTrack
to prevent its destruction while the cblk is being accessed.

Modified AudioTrack JNI to use GetByteArrayElements() instead of
GetPrimitiveArrayCritical() when writing audio buffers. Entering a critical section would
cause the JNI to abort if a mediaserver crash occurs during a write due to the AudioSystem
callback being called during the critical section when media server process restarts.
Anyway with current JNI implementation, either versions do not copy data most of the times
and the criticial version does not guaranty no data copy.

The same modifications have been made to AudioRecord.

Change-Id: Idc5aa711a04c3eee180cdd03f44fe17f3c4dcb52
/frameworks/av/media/libmedia/AudioTrack.cpp
f5aafb209d01ba2ab6cb55d1a12cfc653e2b4be0 18-Nov-2010 Eric Laurent <elaurent@google.com> Fix issue 3157123.

Use a Mutex wherever atomic operations were used in AudioTrack,
AudioRecord, AudioFlinger and AudioEffect classes.

Change-Id: I6f55b2cabdcd93d64ef19446735b8f33720f8dbc
/frameworks/av/media/libmedia/AudioTrack.cpp
44d9848d6656777a18019223e0d35f2fcc67719a 01-Oct-2010 Eric Laurent <elaurent@google.com> Issue 3032913: improve AudioTrack recovery time

This issue showed that when an AudioTrack underruns during a too long period
of time and is therefore disabled by audioflinger mixer, it takes an additional
delay of up to 3 seconds to recover.
This fix adds a simple mechanism to recover immediately when the client application
is ready to write data again in the AudioTrack buffer

Also throttle warnings on record overflows

Change-Id: I8b2c71578dd134b9e60a15ee4d91b70f3799cb3d
/frameworks/av/media/libmedia/AudioTrack.cpp
2beeb50b1bba9e92f6cacfeca37fe9fa9d36ead1 16-Jul-2010 Eric Laurent <elaurent@google.com> Added support for auxiliary audio effects to AudioTrack and MediaPlayer.

Added methods to AudioTrack and MediaPlayer java classes to enable use of
auxiliary audio effects. The effect can be attached and detached by specifying its
ID and the send level controlled.

Change-Id: Ie74ff54a453096a742688476f612ce355543b6f3
/frameworks/av/media/libmedia/AudioTrack.cpp
a514bdb58b5de4986679f72b7204b4764f7a2778 21-Jun-2010 Eric Laurent <elaurent@google.com> Added support for audio sessions in MediaPlayer and AudioTrack.

Audio sessions are used to associate audio effects to particular instances (or groups) of MediaPlayers or AudioTracks.

Change-Id: Ib94eec43241cfcb416590f435ddce7ab39a07640
/frameworks/av/media/libmedia/AudioTrack.cpp
33005a932c60a0780fe9b7307d5988df3d9f6c26 16-Jun-2010 Chia-chi Yeh <chiachi@android.com> media: add AudioTrack::getMinFrameCount().

Change-Id: If15162583d1d16d89f59be0793106afe77417f35
/frameworks/av/media/libmedia/AudioTrack.cpp
be916aa1267e2e6b1c148f51d11bcbbc79cb864c 02-Jun-2010 Eric Laurent <elaurent@google.com> Issue 2667801: [Audio Effect Framework] AudioFlinger, AudioMixer AudioTrack modifications.

First drop of audio framework modifications for audio effects support.

- AudioTrack/AudioRecord:
Added support for auxiliary effects in AudioTrack
Added support for audio sessions
Fixed left right channel inversion in setVolume()

- IAudioFlinger:
Added interface methods for effect enumeraiton and instantiation
Added support for audio sessions.

- IAudioTrack:
Added method to attach auxiliary effect.

- AudioFlinger
Created new classes to control effect engines in effect library and manage effect connections to tracks or
output mix:
EffectModule: wrapper object controlling the effect engine implementation in the effect library. There
is one EffectModule per instance of an effect in a given audio session
EffectChain: group of effects associated to one audio session. There is one EffectChain per audio session.
EffectChain for session 0 is for output mix effects, other chains are attached to audio tracks
with same session ID. Each chain contains a variable number of EffectModules
EffectHandle: implements the IEffect interface. There is one EffectHandle object for each application
controlling (or using) an effect module. THe EffectModule maintians a list of EffectHandles.

Added support for effect modules and effect chains creation in PlaybackThread.
modified mixer thread loop to allow track volume control by effect modules and call effect processing.

-AudioMixer
Each track now specifies its output buffer used by mixer for accumulation
Modified mixer process functions to process tracks by groups of tracks with same buffer
Modified track process functions to support accumulation to auxiliary channel

Change-Id: I26d5f7c9e070a89bdd383e1a659f8b7ca150379c
/frameworks/av/media/libmedia/AudioTrack.cpp
d1b449aad6c087a69f5ec66b7facb2845b73f1cb 14-May-2010 Eric Laurent <elaurent@google.com> Fix issue 2553359: Pandora does not work well with Passion deskdock / Cardock.

The problem is due to a too big difference between the buffer size used at the hardware interface and at the A2DP interface.
When no resampling occurs we don't notice problems but the timing is very tight. As soon as resampling is activated, the AudioTrack underruns.
This is because the AudioTrack buffers are not resized when moving the AudioTrack from hardware to A2DP output.
The AudioTrack buffers are calculated based on a hardware output buffer size of 3072 bytes. Which is much less than the A2DP output buffer size (10240).

The solution consists in creating new tracks with new buffers in AudioFlinger when the A2DP output is opened
instead of just transfering active tracks from hardware output mixer thread to the new A2DP output mixer thread.
To avoid synchronization issues between mixer threads and client processes, this is done by invalidating tracks
by setting a flag in their control block and having AudioTrack release the handle on this track (IAudioTrack)
and create a new IAudioTrack when this flag is detected next time obtainBuffer() or start() is executed.

AudioFlinger modifications:
- invalidate the tracks when setStreamOutput() is called
- make sure that notifications of output opening/closing and change of stream type to output mapping are sent synchronously to client process.
This is necessary so that AudioSystem has the new stream to output mapping when the AudioTrack detects the invalidate flag in the client process.
Previously their were sent when the corresponding thread loop was executed.

AudioTrack modifications:
- move frame count calculation and verification from set() to createTrack() so that is is updated every time a new IAudioTrack is created.
- detect track invalidate flag in obtainBuffer() and start() and create a new IAudioTrack.

AudioTrackShared modifications
- group all flags (out, flowControlFlag, forceReady...) into a single bit filed to save space.

Change-Id: I9ac26b6192230627d35084e1449640caaf7d56ee
/frameworks/av/media/libmedia/AudioTrack.cpp
54b1a0550411c2fd2084d82d28934d505c37349a 20-Mar-2010 Mathias Agopian <mathias@google.com> libutils Condition are now PRIVATE by default

Condition must be initialized with SHARED for the old behavior, where
they can be used accross processes.

Updated the two places android that require SHARED conditions.

PRIVATE conditions (and mutexes) use more efficient syscalls.

Change-Id: I9a281a4b88206e92ac559c66554e886b9c62db3a
/frameworks/av/media/libmedia/AudioTrack.cpp
867d2f6ce668968e463eb86b856d21525f12fd67 26-Jan-2010 Mathias Agopian <mathias@google.com> Simplify the MemoryDealer implementation

At some point the implementation became complicated because of
SurfaceFlinger's special needs, since we are now relying on gralloc
we can go back to much simpler MemoryDealer.

Removed HeapInterface and AllocatorInterface, since those don't need
to be paramterized anymore. Merged SimpleMemory and Allocation.
Made SimplisticAllocator non virtual.

Removed MemoryDealer flags (READ_ONLY, PAGE_ALIGNED)

Removed a lot of unneeded code.
/frameworks/av/media/libmedia/AudioTrack.cpp
6100d2d60517ff33ed8eb35d0b7ea63cde0831c9 19-Nov-2009 Eric Laurent <elaurent@google.com> Issue 2265163: Audio still reported routed through earpiece on sholes

This is a second attempt to fix the audio routed to earpiece syndrom.
The root cause identified this time is the crash of an application having an active AudioTrack playing on the VOICE_CALL stream type.
When this happens, the AudioTrack destructor is not called and the audio policy manager is not notified of the track stop.
Results a situation where the VOICE_CALL stream is considered as always in use by audio policy manager which makes that audio is routed to earpiece.

The fix consists in moving the track start/stop/close notification to audio policiy manager from AudioTrack to AudioFlinger Track objet.
The net result is that in the case of a client application crash, the AudioFlinger TrackHandle object (which implements the remote side of the IAudioTrack binder interface) destructor is called which in turn destroys the Track object and we can notify the audio policy manager of the track stop and removal.

The same modification is made for AudioRecord although no bug related to record has been reported yet.
Also fixed a potential problem if record stop is called while the record thread is exiting.
/frameworks/av/media/libmedia/AudioTrack.cpp
2b584244930c9de0e3bc46898a801e9ccb731900 10-Nov-2009 Eric Laurent <elaurent@google.com> Improvements for issue 2197683: English IME key-press latency is noticeably higher on passion than sholes

This change goes with a kernel driver change that reduces the audio buffer size from 4800 bytes (~27ms) to 3072 bytes (~17ms).
- The AudioFlinger modifcations in change 0bca68cfff161abbc992fec82dc7c88079dd1a36 have been removed: the short sleep period was counter productive when the AudioTrack is using the call back thread as it causes to many preemptions.
- AudioFlinger mixer thread now detects long standby exit time and in this case anticipates start by writing 0s as soon as a track is enabled even if not ready for mixing.
- AudioTrack::start() is modified to start call back thread before starting the IAudioTrack so that thread startup time is masked by IAudioTrack start and mixer thread wakeup time.
/frameworks/av/media/libmedia/AudioTrack.cpp
34f1d8ecd23169a5f299937e3aaf1bd7937578a0 04-Nov-2009 Eric Laurent <elaurent@google.com> Fix issue 2203561: Sholes: audio playing out of earpiece.

Create a new IAudioTrack interface to AudioFlinger when start() fails due to a broken pipe error.
Do the same if start fails due to the same error after time out in obtainBuffer().
Do not indicate that the AudioTrack is started to AudioPolicyManager if IAudioTrack start fails.
This avoids that an AudioTrack keeps a dead IAudioTrack after a media server crash.

Same modifications for AudioRecord.

Add a flag to ToneGenerator indicating that the callback thread can call Java. Without it, when the media server crashes and restarts, the AudioSystem error callback will crash in JNI if the IAudiotrack is created from AudioTrack callback thread.
/frameworks/av/media/libmedia/AudioTrack.cpp
3302526f6276911b2dc40c731ea7fa0e7972d908 04-Aug-2009 Eric Laurent <elaurent@google.com> Fix problem in AudioTrack with 8 bit PCM and direct output.

Do not perform 8 to 16 bit conversion in AudioTrack write() and processAudioBuffer() if direct output flag is set.
/frameworks/av/media/libmedia/AudioTrack.cpp
c2f1f07084818942352c6bbfb36af9b6b330eb4e 17-Jul-2009 Eric Laurent <elaurent@google.com> Fix issue 1795088 Improve audio routing code

Initial commit for review.
Integrated comments after patch set 1 review.
Fixed lockup in AudioFlinger::ThreadBase::exit()
Fixed lockup when playing tone with AudioPlocyService startTone()
/frameworks/av/media/libmedia/AudioTrack.cpp
b07c28b90b2d2793be2b8878d813b607f3eebbb7 14-Jul-2009 Mathias Agopian <mathias@google.com> add a ctor to Mutex to specify the type, which can be shared. This is used by sf and af an soon will allow some optimization in the kernel for non shared mutexes
/frameworks/av/media/libmedia/AudioTrack.cpp
349dba337e07e129f6ba49a132999f0b73fedbe3 07-Jul-2009 Eric Laurent <elaurent@google.com> am 88e209dc: Fix issue 1743700: AudioTrack: setPlaybackRate can not set the playback rate to twice of the ouputSR

Merge commit '88e209dcf8c2ebddda5c272f46d1bd5478bc639c'

* commit '88e209dcf8c2ebddda5c272f46d1bd5478bc639c':
Fix issue 1743700: AudioTrack: setPlaybackRate can not set the playback rate to twice of the ouputSR
573266210fb2b2e7d86fbd46d0dfe16763611d91 07-Jul-2009 Eric Laurent <elaurent@google.com> Fix issue 1743700: AudioTrack: setPlaybackRate can not set the playback rate to twice of the ouputSR

Store sample rate on 32 bits instead of 16 bits in audio_track_cblk_t.
Removed sampleRate() methods from AudioTrack and AudioRecord: replaced by getSampleRate().
AudioTrack::setSampleRate() no returns a status.
/frameworks/av/media/libmedia/AudioTrack.cpp
7562408b2261d38415453378b6188f74fda99d88 20-May-2009 Mathias Agopian <mathias@google.com> move libbinder's header files under includes/binder
/frameworks/av/media/libmedia/AudioTrack.cpp
1dd70b9f04961a06fcb73a97fca10a53b3245d3c 21-Apr-2009 Eric Laurent <elaurent@google.com> Fix issue 1745312: Various cleanups in media framework

AudioTrack, AudioRecord:
- remove useless mAudioFlinger member of AudioTrack and AudioRecord.
- signal cblk.cv condition in stop() method to speed up stop completion.
- extend wait condition timeout in obtainBuffer() when waitCount is -1 to avoid waking up callback thread unnecessarily

AudioFlinger:
- remove some warnings in AudioFlinger.cpp.
- remove function AudioFlinger::MixerThread::removetrack_l() as its content is never executed.
- remove useless call to setMasterVolume in AudioFlinger::handleForcedSpeakerRoute().
- Offset VOICE_CALL stream volume to reflect actual volume that is never 0 in hardware (this fix has been made in the open source): 0.01 + v * 0.99.

AudioSystem.java:
- correct typo in comment

IAudioflinger, IAudioFlingerClient:
- make AudioFlinger binder interfaces used for callbacks ONEWAY.

AudioHardwareInterface:
- correct routeStrings[] table in AudioHardwareInteface.cpp
/frameworks/av/media/libmedia/AudioTrack.cpp
2c22aeb65e801f663a754d043062f85e49f77739 25-Mar-2009 Jean-Michel Trivi <> Automated import from //branches/donutburger/...@140663,140663
/frameworks/av/media/libmedia/AudioTrack.cpp
1179bc9b0e3d17c984e8f4ad38561c049dd102fa 19-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake_rel/...@140373
/frameworks/av/media/libmedia/AudioTrack.cpp
8555d0867c3e8fe6cc5c7ad40af557fe6b92fa72 05-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@136594
/frameworks/av/media/libmedia/AudioTrack.cpp
89fa4ad53f2f4d57adbc97ae1149fc00c9b6f3c5 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/av/media/libmedia/AudioTrack.cpp
15f767b960b38059a74a42a33e16d8df2aec8bc1 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/av/media/libmedia/AudioTrack.cpp
ad04d9201452001dbaac4349f084cc9316190b89 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@132589
/frameworks/av/media/libmedia/AudioTrack.cpp
99ffda877980468a9ae31e013cd10fb3645df1b0 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@137055
/frameworks/av/media/libmedia/AudioTrack.cpp
25658fd43d150a45fb37734a9f9f27f48bb5c133 19-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@132276
/frameworks/av/media/libmedia/AudioTrack.cpp
7a2146d5807030b2629f347736be5301b61e8811 13-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@131421
/frameworks/av/media/libmedia/AudioTrack.cpp
5e07b5774c8b376776caa4f5b0a193767697e97e 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/frameworks/av/media/libmedia/AudioTrack.cpp
e5198b620a9a208ec59ea8457282404725f8ff6e 20-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@127101
/frameworks/av/media/libmedia/AudioTrack.cpp
cce8bd12da6d8419a8770e4552a51ec297c250c2 10-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@125939
/frameworks/av/media/libmedia/AudioTrack.cpp
7b5eb023f8d87cca6d830ae6c11c6aadbe02aca8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/av/media/libmedia/AudioTrack.cpp
2729ea9262ca60d93047e984739887cfc89e82eb 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/av/media/libmedia/AudioTrack.cpp